add finch outbound proxy support (#158)
[akkoma] / lib / pleroma / web / api_spec / schemas / status.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.Status do
6 alias OpenApiSpex.Schema
7 alias Pleroma.Web.ApiSpec.Schemas.Account
8 alias Pleroma.Web.ApiSpec.Schemas.Attachment
9 alias Pleroma.Web.ApiSpec.Schemas.Emoji
10 alias Pleroma.Web.ApiSpec.Schemas.FlakeID
11 alias Pleroma.Web.ApiSpec.Schemas.Poll
12 alias Pleroma.Web.ApiSpec.Schemas.Tag
13 alias Pleroma.Web.ApiSpec.Schemas.VisibilityScope
14
15 require OpenApiSpex
16
17 OpenApiSpex.schema(%{
18 title: "Status",
19 description: "Response schema for a status",
20 type: :object,
21 properties: %{
22 account: %Schema{allOf: [Account], description: "The account that authored this status"},
23 application: %Schema{
24 description: "The application used to post this status",
25 type: :object,
26 nullable: true,
27 properties: %{
28 name: %Schema{type: :string},
29 website: %Schema{type: :string, format: :uri}
30 }
31 },
32 bookmarked: %Schema{type: :boolean, description: "Have you bookmarked this status?"},
33 card: %Schema{
34 type: :object,
35 nullable: true,
36 description: "Preview card for links included within status content",
37 required: [:url, :title, :description, :type],
38 properties: %{
39 type: %Schema{
40 type: :string,
41 enum: ["link", "photo", "video", "rich"],
42 description: "The type of the preview card"
43 },
44 provider_name: %Schema{
45 type: :string,
46 nullable: true,
47 description: "The provider of the original resource"
48 },
49 provider_url: %Schema{
50 type: :string,
51 format: :uri,
52 description: "A link to the provider of the original resource"
53 },
54 url: %Schema{type: :string, format: :uri, description: "Location of linked resource"},
55 image: %Schema{
56 type: :string,
57 nullable: true,
58 format: :uri,
59 description: "Preview thumbnail"
60 },
61 title: %Schema{type: :string, description: "Title of linked resource"},
62 description: %Schema{type: :string, description: "Description of preview"}
63 }
64 },
65 content: %Schema{type: :string, format: :html, description: "HTML-encoded status content"},
66 text: %Schema{
67 type: :string,
68 description: "Original unformatted content in plain text",
69 nullable: true
70 },
71 created_at: %Schema{
72 type: :string,
73 format: "date-time",
74 description: "The date when this status was created"
75 },
76 emojis: %Schema{
77 type: :array,
78 items: Emoji,
79 description: "Custom emoji to be used when rendering status content"
80 },
81 favourited: %Schema{type: :boolean, description: "Have you favourited this status?"},
82 favourites_count: %Schema{
83 type: :integer,
84 description: "How many favourites this status has received"
85 },
86 id: FlakeID,
87 in_reply_to_account_id: %Schema{
88 allOf: [FlakeID],
89 nullable: true,
90 description: "ID of the account being replied to"
91 },
92 in_reply_to_id: %Schema{
93 allOf: [FlakeID],
94 nullable: true,
95 description: "ID of the status being replied"
96 },
97 language: %Schema{
98 type: :string,
99 nullable: true,
100 description: "Primary language of this status"
101 },
102 media_attachments: %Schema{
103 type: :array,
104 items: Attachment,
105 description: "Media that is attached to this status"
106 },
107 mentions: %Schema{
108 type: :array,
109 description: "Mentions of users within the status content",
110 items: %Schema{
111 type: :object,
112 properties: %{
113 id: %Schema{allOf: [FlakeID], description: "The account id of the mentioned user"},
114 acct: %Schema{
115 type: :string,
116 description:
117 "The webfinger acct: URI of the mentioned user. Equivalent to `username` for local users, or `username@domain` for remote users."
118 },
119 username: %Schema{type: :string, description: "The username of the mentioned user"},
120 url: %Schema{
121 type: :string,
122 format: :uri,
123 description: "The location of the mentioned user's profile"
124 }
125 }
126 }
127 },
128 muted: %Schema{
129 type: :boolean,
130 description: "Have you muted notifications for this status's conversation?"
131 },
132 pinned: %Schema{
133 type: :boolean,
134 description: "Have you pinned this status? Only appears if the status is pinnable."
135 },
136 quote_id: %Schema{
137 type: :string,
138 description: "ID of the status being quoted",
139 nullable: true
140 },
141 quote: %Schema{
142 allOf: [%OpenApiSpex.Reference{"$ref": "#/components/schemas/Status"}],
143 nullable: true,
144 description: "Quoted status (if any)"
145 },
146 pleroma: %Schema{
147 type: :object,
148 properties: %{
149 content: %Schema{
150 type: :object,
151 additionalProperties: %Schema{type: :string},
152 description:
153 "A map consisting of alternate representations of the `content` property with the key being it's mimetype. Currently the only alternate representation supported is `text/plain`"
154 },
155 context: %Schema{
156 type: :string,
157 description: "The thread identifier the status is associated with"
158 },
159 conversation_id: %Schema{
160 type: :integer,
161 deprecated: true,
162 description:
163 "The ID of the AP context the status is associated with (if any); deprecated, please use `context` instead"
164 },
165 direct_conversation_id: %Schema{
166 type: :integer,
167 nullable: true,
168 description:
169 "The ID of the Mastodon direct message conversation the status is associated with (if any)"
170 },
171 emoji_reactions: %Schema{
172 type: :array,
173 description:
174 "A list with emoji / reaction maps. Contains no information about the reacting users, for that use the /statuses/:id/reactions endpoint.",
175 items: %Schema{
176 type: :object,
177 properties: %{
178 name: %Schema{type: :string},
179 count: %Schema{type: :integer},
180 me: %Schema{type: :boolean}
181 }
182 }
183 },
184 expires_at: %Schema{
185 type: :string,
186 format: "date-time",
187 nullable: true,
188 description:
189 "A datetime (ISO 8601) that states when the post will expire (be deleted automatically), or empty if the post won't expire"
190 },
191 in_reply_to_account_acct: %Schema{
192 type: :string,
193 nullable: true,
194 description: "The `acct` property of User entity for replied user (if any)"
195 },
196 local: %Schema{
197 type: :boolean,
198 description: "`true` if the post was made on the local instance"
199 },
200 spoiler_text: %Schema{
201 type: :object,
202 additionalProperties: %Schema{type: :string},
203 description:
204 "A map consisting of alternate representations of the `spoiler_text` property with the key being it's mimetype. Currently the only alternate representation supported is `text/plain`."
205 },
206 thread_muted: %Schema{
207 type: :boolean,
208 description: "`true` if the thread the post belongs to is muted"
209 },
210 parent_visible: %Schema{
211 type: :boolean,
212 description: "`true` if the parent post is visible to the user"
213 },
214 pinned_at: %Schema{
215 type: :string,
216 format: "date-time",
217 nullable: true,
218 description:
219 "A datetime (ISO 8601) that states when the post was pinned or `null` if the post is not pinned"
220 }
221 }
222 },
223 akkoma: %Schema{
224 type: :object,
225 properties: %{
226 source: %Schema{
227 nullable: true,
228 oneOf: [
229 %Schema{type: :string, example: 'plaintext content'},
230 %Schema{
231 type: :object,
232 properties: %{
233 content: %Schema{
234 type: :string,
235 description: "The source content of the status",
236 nullable: true
237 },
238 mediaType: %Schema{
239 type: :string,
240 description: "The source MIME type of the status",
241 example: "text/plain",
242 nullable: true
243 }
244 }
245 }
246 ]
247 }
248 }
249 },
250 poll: %Schema{allOf: [Poll], nullable: true, description: "The poll attached to the status"},
251 reblog: %Schema{
252 allOf: [%OpenApiSpex.Reference{"$ref": "#/components/schemas/Status"}],
253 nullable: true,
254 description: "The status being reblogged"
255 },
256 reblogged: %Schema{type: :boolean, description: "Have you boosted this status?"},
257 reblogs_count: %Schema{
258 type: :integer,
259 description: "How many boosts this status has received"
260 },
261 replies_count: %Schema{
262 type: :integer,
263 description: "How many replies this status has received"
264 },
265 sensitive: %Schema{
266 type: :boolean,
267 description: "Is this status marked as sensitive content?"
268 },
269 spoiler_text: %Schema{
270 type: :string,
271 description:
272 "Subject or summary line, below which status content is collapsed until expanded"
273 },
274 tags: %Schema{type: :array, items: Tag},
275 uri: %Schema{
276 type: :string,
277 format: :uri,
278 description: "URI of the status used for federation"
279 },
280 url: %Schema{
281 type: :string,
282 nullable: true,
283 format: :uri,
284 description: "A link to the status's HTML representation"
285 },
286 visibility: %Schema{
287 allOf: [VisibilityScope],
288 description: "Visibility of this status"
289 }
290 },
291 example: %{
292 "account" => %{
293 "acct" => "nick6",
294 "avatar" => "http://localhost:4001/images/avi.png",
295 "avatar_static" => "http://localhost:4001/images/avi.png",
296 "bot" => false,
297 "created_at" => "2020-04-07T19:48:51.000Z",
298 "display_name" => "Test テスト User 6",
299 "emojis" => [],
300 "fields" => [],
301 "followers_count" => 1,
302 "following_count" => 0,
303 "header" => "http://localhost:4001/images/banner.png",
304 "header_static" => "http://localhost:4001/images/banner.png",
305 "id" => "9toJCsKN7SmSf3aj5c",
306 "is_locked" => false,
307 "note" => "Tester Number 6",
308 "pleroma" => %{
309 "background_image" => nil,
310 "is_confirmed" => true,
311 "hide_favorites" => true,
312 "hide_followers" => false,
313 "hide_followers_count" => false,
314 "hide_follows" => false,
315 "hide_follows_count" => false,
316 "is_admin" => false,
317 "is_moderator" => false,
318 "relationship" => %{
319 "blocked_by" => false,
320 "blocking" => false,
321 "domain_blocking" => false,
322 "endorsed" => false,
323 "followed_by" => false,
324 "following" => true,
325 "id" => "9toJCsKN7SmSf3aj5c",
326 "muting" => false,
327 "muting_notifications" => false,
328 "note" => "",
329 "requested" => false,
330 "showing_reblogs" => true,
331 "subscribing" => false,
332 "notifying" => false
333 },
334 "skip_thread_containment" => false,
335 "tags" => []
336 },
337 "source" => %{
338 "fields" => [],
339 "note" => "Tester Number 6",
340 "pleroma" => %{"actor_type" => "Person", "discoverable" => false},
341 "sensitive" => false
342 },
343 "statuses_count" => 1,
344 "url" => "http://localhost:4001/users/nick6",
345 "username" => "nick6"
346 },
347 "application" => nil,
348 "bookmarked" => false,
349 "card" => nil,
350 "content" => "foobar",
351 "created_at" => "2020-04-07T19:48:51.000Z",
352 "emojis" => [],
353 "favourited" => false,
354 "favourites_count" => 0,
355 "id" => "9toJCu5YZW7O7gfvH6",
356 "in_reply_to_account_id" => nil,
357 "in_reply_to_id" => nil,
358 "language" => nil,
359 "media_attachments" => [],
360 "mentions" => [],
361 "muted" => false,
362 "pinned" => false,
363 "pleroma" => %{
364 "content" => %{"text/plain" => "foobar"},
365 "context" => "http://localhost:4001/objects/8b4c0c80-6a37-4d2a-b1b9-05a19e3875aa",
366 "conversation_id" => 345_972,
367 "direct_conversation_id" => nil,
368 "emoji_reactions" => [],
369 "expires_at" => nil,
370 "in_reply_to_account_acct" => nil,
371 "local" => true,
372 "spoiler_text" => %{"text/plain" => ""},
373 "thread_muted" => false
374 },
375 "poll" => nil,
376 "reblog" => nil,
377 "reblogged" => false,
378 "reblogs_count" => 0,
379 "replies_count" => 0,
380 "sensitive" => false,
381 "spoiler_text" => "",
382 "tags" => [],
383 "uri" => "http://localhost:4001/objects/0f5dad44-0e9e-4610-b377-a2631e499190",
384 "url" => "http://localhost:4001/notice/9toJCu5YZW7O7gfvH6",
385 "visibility" => "private"
386 }
387 })
388 end