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