Add ability to set a default post expiry (#321)
[akkoma] / lib / pleroma / web / api_spec / schemas / account.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.ApiSpec.Schemas.Account do
6 alias OpenApiSpex.Schema
7 alias Pleroma.Web.ApiSpec.Schemas.AccountField
8 alias Pleroma.Web.ApiSpec.Schemas.AccountRelationship
9 alias Pleroma.Web.ApiSpec.Schemas.ActorType
10 alias Pleroma.Web.ApiSpec.Schemas.Emoji
11 alias Pleroma.Web.ApiSpec.Schemas.FlakeID
12 alias Pleroma.Web.ApiSpec.Schemas.VisibilityScope
13
14 require OpenApiSpex
15
16 OpenApiSpex.schema(%{
17 title: "Account",
18 description: "Response schema for an account",
19 type: :object,
20 properties: %{
21 acct: %Schema{type: :string},
22 avatar_static: %Schema{type: :string, format: :uri},
23 avatar: %Schema{type: :string, format: :uri},
24 bot: %Schema{type: :boolean},
25 created_at: %Schema{type: :string, format: "date-time"},
26 display_name: %Schema{type: :string},
27 emojis: %Schema{type: :array, items: Emoji},
28 fields: %Schema{type: :array, items: AccountField},
29 follow_requests_count: %Schema{type: :integer},
30 followers_count: %Schema{type: :integer},
31 following_count: %Schema{type: :integer},
32 header_static: %Schema{type: :string, format: :uri},
33 header: %Schema{type: :string, format: :uri},
34 id: FlakeID,
35 locked: %Schema{type: :boolean},
36 note: %Schema{type: :string, format: :html},
37 statuses_count: %Schema{type: :integer},
38 url: %Schema{type: :string, format: :uri},
39 username: %Schema{type: :string},
40 pleroma: %Schema{
41 type: :object,
42 properties: %{
43 ap_id: %Schema{type: :string},
44 also_known_as: %Schema{type: :array, items: %Schema{type: :string}},
45 allow_following_move: %Schema{
46 type: :boolean,
47 description: "whether the user allows automatically follow moved following accounts"
48 },
49 background_image: %Schema{type: :string, nullable: true, format: :uri},
50 is_confirmed: %Schema{
51 type: :boolean,
52 description:
53 "whether the user account is waiting on email confirmation to be activated"
54 },
55 hide_favorites: %Schema{type: :boolean},
56 hide_followers_count: %Schema{
57 type: :boolean,
58 description: "whether the user has follower stat hiding enabled"
59 },
60 hide_followers: %Schema{
61 type: :boolean,
62 description: "whether the user has follower hiding enabled"
63 },
64 hide_follows_count: %Schema{
65 type: :boolean,
66 description: "whether the user has follow stat hiding enabled"
67 },
68 hide_follows: %Schema{
69 type: :boolean,
70 description: "whether the user has follow hiding enabled"
71 },
72 is_admin: %Schema{
73 type: :boolean,
74 description: "whether the user is an admin of the local instance"
75 },
76 is_moderator: %Schema{
77 type: :boolean,
78 description: "whether the user is a moderator of the local instance"
79 },
80 skip_thread_containment: %Schema{type: :boolean},
81 tags: %Schema{
82 type: :array,
83 items: %Schema{type: :string},
84 description:
85 "List of tags being used for things like extra roles or moderation(ie. marking all media as nsfw all)."
86 },
87 unread_conversation_count: %Schema{
88 type: :integer,
89 description: "The count of unread conversations. Only returned to the account owner."
90 },
91 notification_settings: %Schema{
92 type: :object,
93 properties: %{
94 block_from_strangers: %Schema{type: :boolean},
95 hide_notification_contents: %Schema{type: :boolean}
96 }
97 },
98 relationship: %Schema{allOf: [AccountRelationship], nullable: true},
99 settings_store: %Schema{
100 type: :object,
101 description:
102 "A generic map of settings for frontends. Opaque to the backend. Only returned in `verify_credentials` and `update_credentials`"
103 },
104 favicon: %Schema{
105 type: :string,
106 format: :uri,
107 nullable: true,
108 description: "Favicon image of the user's instance"
109 }
110 }
111 },
112 akkoma: %Schema{
113 type: :object,
114 properties: %{
115 note_ttl_days: %Schema{type: :integer}
116 }
117 },
118 source: %Schema{
119 type: :object,
120 properties: %{
121 fields: %Schema{type: :array, items: AccountField},
122 note: %Schema{
123 type: :string,
124 description:
125 "Plaintext version of the bio without formatting applied by the backend, used for editing the bio."
126 },
127 privacy: VisibilityScope,
128 sensitive: %Schema{type: :boolean},
129 pleroma: %Schema{
130 type: :object,
131 properties: %{
132 actor_type: ActorType,
133 discoverable: %Schema{
134 type: :boolean,
135 description:
136 "whether the user allows indexing / listing of the account by external services (search engines etc.)."
137 },
138 no_rich_text: %Schema{
139 type: :boolean,
140 description:
141 "whether the HTML tags for rich-text formatting are stripped from all statuses requested from the API."
142 },
143 show_role: %Schema{
144 type: :boolean,
145 description:
146 "whether the user wants their role (e.g admin, moderator) to be shown"
147 }
148 }
149 }
150 }
151 }
152 },
153 example: %{
154 "acct" => "foobar",
155 "avatar" => "https://mypleroma.com/images/avi.png",
156 "avatar_static" => "https://mypleroma.com/images/avi.png",
157 "bot" => false,
158 "created_at" => "2020-03-24T13:05:58.000Z",
159 "display_name" => "foobar",
160 "emojis" => [],
161 "fields" => [],
162 "follow_requests_count" => 0,
163 "followers_count" => 0,
164 "following_count" => 1,
165 "header" => "https://mypleroma.com/images/banner.png",
166 "header_static" => "https://mypleroma.com/images/banner.png",
167 "id" => "9tKi3esbG7OQgZ2920",
168 "locked" => false,
169 "note" => "cofe",
170 "pleroma" => %{
171 "allow_following_move" => true,
172 "background_image" => nil,
173 "is_confirmed" => false,
174 "hide_favorites" => true,
175 "hide_followers" => false,
176 "hide_followers_count" => false,
177 "hide_follows" => false,
178 "hide_follows_count" => false,
179 "is_admin" => false,
180 "is_moderator" => false,
181 "skip_thread_containment" => false,
182 "unread_conversation_count" => 0,
183 "tags" => [],
184 "notification_settings" => %{
185 "block_from_strangers" => false,
186 "hide_notification_contents" => false
187 },
188 "relationship" => %{
189 "blocked_by" => false,
190 "blocking" => false,
191 "domain_blocking" => false,
192 "endorsed" => false,
193 "followed_by" => false,
194 "following" => false,
195 "id" => "9tKi3esbG7OQgZ2920",
196 "muting" => false,
197 "muting_notifications" => false,
198 "note" => "",
199 "requested" => false,
200 "showing_reblogs" => true,
201 "subscribing" => false,
202 "notifying" => false
203 },
204 "settings_store" => %{
205 "pleroma-fe" => %{}
206 }
207 },
208 "source" => %{
209 "fields" => [],
210 "note" => "foobar",
211 "pleroma" => %{
212 "actor_type" => "Person",
213 "discoverable" => false,
214 "no_rich_text" => false,
215 "show_role" => true
216 },
217 "privacy" => "public",
218 "sensitive" => false
219 },
220 "statuses_count" => 0,
221 "url" => "https://mypleroma.com/users/foobar",
222 "username" => "foobar"
223 }
224 })
225 end