Add OpenAPI spec for ConversationController
[akkoma] / lib / pleroma / web / api_spec / schemas / status.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.ApiSpec.Schemas.Status do
6 alias OpenApiSpex.Schema
7 alias Pleroma.Web.ApiSpec.Schemas.Account
8 alias Pleroma.Web.ApiSpec.Schemas.Emoji
9 alias Pleroma.Web.ApiSpec.Schemas.FlakeID
10 alias Pleroma.Web.ApiSpec.Schemas.Poll
11 alias Pleroma.Web.ApiSpec.Schemas.VisibilityScope
12
13 require OpenApiSpex
14
15 OpenApiSpex.schema(%{
16 title: "Status",
17 description: "Response schema for a status",
18 type: :object,
19 properties: %{
20 account: Account,
21 application: %Schema{
22 type: :object,
23 properties: %{
24 name: %Schema{type: :string},
25 website: %Schema{type: :string, nullable: true, format: :uri}
26 }
27 },
28 bookmarked: %Schema{type: :boolean},
29 card: %Schema{
30 type: :object,
31 nullable: true,
32 properties: %{
33 type: %Schema{type: :string, enum: ["link", "photo", "video", "rich"]},
34 provider_name: %Schema{type: :string, nullable: true},
35 provider_url: %Schema{type: :string, format: :uri},
36 url: %Schema{type: :string, format: :uri},
37 image: %Schema{type: :string, nullable: true, format: :uri},
38 title: %Schema{type: :string},
39 description: %Schema{type: :string}
40 }
41 },
42 content: %Schema{type: :string, format: :html},
43 created_at: %Schema{type: :string, format: "date-time"},
44 emojis: %Schema{type: :array, items: Emoji},
45 favourited: %Schema{type: :boolean},
46 favourites_count: %Schema{type: :integer},
47 id: FlakeID,
48 in_reply_to_account_id: %Schema{type: :string, nullable: true},
49 in_reply_to_id: %Schema{type: :string, nullable: true},
50 language: %Schema{type: :string, nullable: true},
51 media_attachments: %Schema{
52 type: :array,
53 items: %Schema{
54 type: :object,
55 properties: %{
56 id: %Schema{type: :string},
57 url: %Schema{type: :string, format: :uri},
58 remote_url: %Schema{type: :string, format: :uri},
59 preview_url: %Schema{type: :string, format: :uri},
60 text_url: %Schema{type: :string, format: :uri},
61 description: %Schema{type: :string},
62 type: %Schema{type: :string, enum: ["image", "video", "audio", "unknown"]},
63 pleroma: %Schema{
64 type: :object,
65 properties: %{mime_type: %Schema{type: :string}}
66 }
67 }
68 }
69 },
70 mentions: %Schema{
71 type: :array,
72 items: %Schema{
73 type: :object,
74 properties: %{
75 id: %Schema{type: :string},
76 acct: %Schema{type: :string},
77 username: %Schema{type: :string},
78 url: %Schema{type: :string, format: :uri}
79 }
80 }
81 },
82 muted: %Schema{type: :boolean},
83 pinned: %Schema{type: :boolean},
84 pleroma: %Schema{
85 type: :object,
86 properties: %{
87 content: %Schema{type: :object, additionalProperties: %Schema{type: :string}},
88 conversation_id: %Schema{type: :integer},
89 direct_conversation_id: %Schema{
90 type: :integer,
91 nullable: true,
92 description:
93 "The ID of the Mastodon direct message conversation the status is associated with (if any)"
94 },
95 emoji_reactions: %Schema{
96 type: :array,
97 items: %Schema{
98 type: :object,
99 properties: %{
100 name: %Schema{type: :string},
101 count: %Schema{type: :integer},
102 me: %Schema{type: :boolean}
103 }
104 }
105 },
106 expires_at: %Schema{type: :string, format: "date-time", nullable: true},
107 in_reply_to_account_acct: %Schema{type: :string, nullable: true},
108 local: %Schema{type: :boolean},
109 spoiler_text: %Schema{type: :object, additionalProperties: %Schema{type: :string}},
110 thread_muted: %Schema{type: :boolean}
111 }
112 },
113 poll: %Schema{type: Poll, nullable: true},
114 reblog: %Schema{
115 allOf: [%OpenApiSpex.Reference{"$ref": "#/components/schemas/Status"}],
116 nullable: true
117 },
118 reblogged: %Schema{type: :boolean},
119 reblogs_count: %Schema{type: :integer},
120 replies_count: %Schema{type: :integer},
121 sensitive: %Schema{type: :boolean},
122 spoiler_text: %Schema{type: :string},
123 tags: %Schema{
124 type: :array,
125 items: %Schema{
126 type: :object,
127 properties: %{
128 name: %Schema{type: :string},
129 url: %Schema{type: :string, format: :uri}
130 }
131 }
132 },
133 uri: %Schema{type: :string, format: :uri},
134 url: %Schema{type: :string, nullable: true, format: :uri},
135 visibility: VisibilityScope
136 },
137 example: %{
138 "account" => %{
139 "acct" => "nick6",
140 "avatar" => "http://localhost:4001/images/avi.png",
141 "avatar_static" => "http://localhost:4001/images/avi.png",
142 "bot" => false,
143 "created_at" => "2020-04-07T19:48:51.000Z",
144 "display_name" => "Test テスト User 6",
145 "emojis" => [],
146 "fields" => [],
147 "followers_count" => 1,
148 "following_count" => 0,
149 "header" => "http://localhost:4001/images/banner.png",
150 "header_static" => "http://localhost:4001/images/banner.png",
151 "id" => "9toJCsKN7SmSf3aj5c",
152 "locked" => false,
153 "note" => "Tester Number 6",
154 "pleroma" => %{
155 "background_image" => nil,
156 "confirmation_pending" => false,
157 "hide_favorites" => true,
158 "hide_followers" => false,
159 "hide_followers_count" => false,
160 "hide_follows" => false,
161 "hide_follows_count" => false,
162 "is_admin" => false,
163 "is_moderator" => false,
164 "relationship" => %{
165 "blocked_by" => false,
166 "blocking" => false,
167 "domain_blocking" => false,
168 "endorsed" => false,
169 "followed_by" => false,
170 "following" => true,
171 "id" => "9toJCsKN7SmSf3aj5c",
172 "muting" => false,
173 "muting_notifications" => false,
174 "requested" => false,
175 "showing_reblogs" => true,
176 "subscribing" => false
177 },
178 "skip_thread_containment" => false,
179 "tags" => []
180 },
181 "source" => %{
182 "fields" => [],
183 "note" => "Tester Number 6",
184 "pleroma" => %{"actor_type" => "Person", "discoverable" => false},
185 "sensitive" => false
186 },
187 "statuses_count" => 1,
188 "url" => "http://localhost:4001/users/nick6",
189 "username" => "nick6"
190 },
191 "application" => %{"name" => "Web", "website" => nil},
192 "bookmarked" => false,
193 "card" => nil,
194 "content" => "foobar",
195 "created_at" => "2020-04-07T19:48:51.000Z",
196 "emojis" => [],
197 "favourited" => false,
198 "favourites_count" => 0,
199 "id" => "9toJCu5YZW7O7gfvH6",
200 "in_reply_to_account_id" => nil,
201 "in_reply_to_id" => nil,
202 "language" => nil,
203 "media_attachments" => [],
204 "mentions" => [],
205 "muted" => false,
206 "pinned" => false,
207 "pleroma" => %{
208 "content" => %{"text/plain" => "foobar"},
209 "conversation_id" => 345_972,
210 "direct_conversation_id" => nil,
211 "emoji_reactions" => [],
212 "expires_at" => nil,
213 "in_reply_to_account_acct" => nil,
214 "local" => true,
215 "spoiler_text" => %{"text/plain" => ""},
216 "thread_muted" => false
217 },
218 "poll" => nil,
219 "reblog" => nil,
220 "reblogged" => false,
221 "reblogs_count" => 0,
222 "replies_count" => 0,
223 "sensitive" => false,
224 "spoiler_text" => "",
225 "tags" => [],
226 "uri" => "http://localhost:4001/objects/0f5dad44-0e9e-4610-b377-a2631e499190",
227 "url" => "http://localhost:4001/notice/9toJCu5YZW7O7gfvH6",
228 "visibility" => "private"
229 }
230 })
231 end