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