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