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