Add ability to set a default post expiry (#321)
[akkoma] / lib / pleroma / web / api_spec / schemas / attachment.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.ApiSpec.Schemas.Attachment do
6 alias OpenApiSpex.Schema
7
8 require OpenApiSpex
9
10 OpenApiSpex.schema(%{
11 title: "Attachment",
12 description: "Represents a file or media attachment that can be added to a status.",
13 type: :object,
14 requried: [:id, :url, :preview_url],
15 properties: %{
16 id: %Schema{type: :string, description: "The ID of the attachment in the database."},
17 url: %Schema{
18 type: :string,
19 format: :uri,
20 description: "The location of the original full-size attachment"
21 },
22 remote_url: %Schema{
23 type: :string,
24 format: :uri,
25 description:
26 "The location of the full-size original attachment on the remote website. String (URL), or null if the attachment is local",
27 nullable: true
28 },
29 preview_url: %Schema{
30 type: :string,
31 format: :uri,
32 description: "The location of a scaled-down preview of the attachment"
33 },
34 text_url: %Schema{
35 type: :string,
36 format: :uri,
37 description: "A shorter URL for the attachment"
38 },
39 description: %Schema{
40 type: :string,
41 nullable: true,
42 description:
43 "Alternate text that describes what is in the media attachment, to be used for the visually impaired or when media attachments do not load"
44 },
45 type: %Schema{
46 type: :string,
47 enum: ["image", "video", "audio", "unknown"],
48 description: "The type of the attachment"
49 },
50 pleroma: %Schema{
51 type: :object,
52 properties: %{
53 mime_type: %Schema{type: :string, description: "mime type of the attachment"}
54 }
55 }
56 },
57 example: %{
58 id: "1638338801",
59 type: "image",
60 url: "someurl",
61 remote_url: "someurl",
62 preview_url: "someurl",
63 text_url: "someurl",
64 description: nil,
65 pleroma: %{mime_type: "image/png"}
66 }
67 })
68 end