bf5f046919a53de93b6ecd8065490a9666cc831e
[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.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: AccountEmoji},
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{type: :string, nullable: true},
90 emoji_reactions: %Schema{
91 type: :array,
92 items: %Schema{
93 type: :object,
94 properties: %{
95 name: %Schema{type: :string},
96 count: %Schema{type: :integer},
97 me: %Schema{type: :boolean}
98 }
99 }
100 },
101 expires_at: %Schema{type: :string, format: "date-time", nullable: true},
102 in_reply_to_account_acct: %Schema{type: :string, nullable: true},
103 local: %Schema{type: :boolean},
104 spoiler_text: %Schema{type: :object, additionalProperties: %Schema{type: :string}},
105 thread_muted: %Schema{type: :boolean}
106 }
107 },
108 poll: %Schema{type: Poll, nullable: true},
109 reblog: %Schema{
110 allOf: [%OpenApiSpex.Reference{"$ref": "#/components/schemas/Status"}],
111 nullable: true
112 },
113 reblogged: %Schema{type: :boolean},
114 reblogs_count: %Schema{type: :integer},
115 replies_count: %Schema{type: :integer},
116 sensitive: %Schema{type: :boolean},
117 spoiler_text: %Schema{type: :string},
118 tags: %Schema{
119 type: :array,
120 items: %Schema{
121 type: :object,
122 properties: %{
123 name: %Schema{type: :string},
124 url: %Schema{type: :string, format: :uri}
125 }
126 }
127 },
128 uri: %Schema{type: :string, format: :uri},
129 url: %Schema{type: :string, nullable: true, format: :uri},
130 visibility: VisibilityScope
131 },
132 example: %{
133 "account" => %{
134 "acct" => "nick6",
135 "avatar" => "http://localhost:4001/images/avi.png",
136 "avatar_static" => "http://localhost:4001/images/avi.png",
137 "bot" => false,
138 "created_at" => "2020-04-07T19:48:51.000Z",
139 "display_name" => "Test テスト User 6",
140 "emojis" => [],
141 "fields" => [],
142 "followers_count" => 1,
143 "following_count" => 0,
144 "header" => "http://localhost:4001/images/banner.png",
145 "header_static" => "http://localhost:4001/images/banner.png",
146 "id" => "9toJCsKN7SmSf3aj5c",
147 "locked" => false,
148 "note" => "Tester Number 6",
149 "pleroma" => %{
150 "background_image" => nil,
151 "confirmation_pending" => false,
152 "hide_favorites" => true,
153 "hide_followers" => false,
154 "hide_followers_count" => false,
155 "hide_follows" => false,
156 "hide_follows_count" => false,
157 "is_admin" => false,
158 "is_moderator" => false,
159 "relationship" => %{
160 "blocked_by" => false,
161 "blocking" => false,
162 "domain_blocking" => false,
163 "endorsed" => false,
164 "followed_by" => false,
165 "following" => true,
166 "id" => "9toJCsKN7SmSf3aj5c",
167 "muting" => false,
168 "muting_notifications" => false,
169 "requested" => false,
170 "showing_reblogs" => true,
171 "subscribing" => false
172 },
173 "skip_thread_containment" => false,
174 "tags" => []
175 },
176 "source" => %{
177 "fields" => [],
178 "note" => "Tester Number 6",
179 "pleroma" => %{"actor_type" => "Person", "discoverable" => false},
180 "sensitive" => false
181 },
182 "statuses_count" => 1,
183 "url" => "http://localhost:4001/users/nick6",
184 "username" => "nick6"
185 },
186 "application" => %{"name" => "Web", "website" => nil},
187 "bookmarked" => false,
188 "card" => nil,
189 "content" => "foobar",
190 "created_at" => "2020-04-07T19:48:51.000Z",
191 "emojis" => [],
192 "favourited" => false,
193 "favourites_count" => 0,
194 "id" => "9toJCu5YZW7O7gfvH6",
195 "in_reply_to_account_id" => nil,
196 "in_reply_to_id" => nil,
197 "language" => nil,
198 "media_attachments" => [],
199 "mentions" => [],
200 "muted" => false,
201 "pinned" => false,
202 "pleroma" => %{
203 "content" => %{"text/plain" => "foobar"},
204 "conversation_id" => 345_972,
205 "direct_conversation_id" => nil,
206 "emoji_reactions" => [],
207 "expires_at" => nil,
208 "in_reply_to_account_acct" => nil,
209 "local" => true,
210 "spoiler_text" => %{"text/plain" => ""},
211 "thread_muted" => false
212 },
213 "poll" => nil,
214 "reblog" => nil,
215 "reblogged" => false,
216 "reblogs_count" => 0,
217 "replies_count" => 0,
218 "sensitive" => false,
219 "spoiler_text" => "",
220 "tags" => [],
221 "uri" => "http://localhost:4001/objects/0f5dad44-0e9e-4610-b377-a2631e499190",
222 "url" => "http://localhost:4001/notice/9toJCu5YZW7O7gfvH6",
223 "visibility" => "private"
224 }
225 })
226 end