Merge branch 'develop' into openapi/account
[akkoma] / lib / pleroma / web / api_spec / schemas / account.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.Account do
6 alias OpenApiSpex.Schema
7 alias Pleroma.Web.ApiSpec.Schemas.AccountEmoji
8 alias Pleroma.Web.ApiSpec.Schemas.AccountField
9 alias Pleroma.Web.ApiSpec.Schemas.ActorType
10 alias Pleroma.Web.ApiSpec.Schemas.VisibilityScope
11
12 require OpenApiSpex
13
14 OpenApiSpex.schema(%{
15 title: "Account",
16 description: "Response schema for an account",
17 type: :object,
18 properties: %{
19 acct: %Schema{type: :string},
20 avatar_static: %Schema{type: :string},
21 avatar: %Schema{type: :string},
22 bot: %Schema{type: :boolean},
23 created_at: %Schema{type: :string, format: "date-time"},
24 display_name: %Schema{type: :string},
25 emojis: %Schema{type: :array, items: AccountEmoji},
26 fields: %Schema{type: :array, items: AccountField},
27 follow_requests_count: %Schema{type: :integer},
28 followers_count: %Schema{type: :integer},
29 following_count: %Schema{type: :integer},
30 header_static: %Schema{type: :string},
31 header: %Schema{type: :string},
32 id: %Schema{type: :string},
33 locked: %Schema{type: :boolean},
34 note: %Schema{type: :string},
35 statuses_count: %Schema{type: :integer},
36 url: %Schema{type: :string},
37 username: %Schema{type: :string},
38 pleroma: %Schema{
39 type: :object,
40 properties: %{
41 allow_following_move: %Schema{type: :boolean},
42 background_image: %Schema{type: :boolean, nullable: true},
43 chat_token: %Schema{type: :string},
44 confirmation_pending: %Schema{type: :boolean},
45 hide_favorites: %Schema{type: :boolean},
46 hide_followers_count: %Schema{type: :boolean},
47 hide_followers: %Schema{type: :boolean},
48 hide_follows_count: %Schema{type: :boolean},
49 hide_follows: %Schema{type: :boolean},
50 is_admin: %Schema{type: :boolean},
51 is_moderator: %Schema{type: :boolean},
52 skip_thread_containment: %Schema{type: :boolean},
53 tags: %Schema{type: :array, items: %Schema{type: :string}},
54 unread_conversation_count: %Schema{type: :integer},
55 notification_settings: %Schema{
56 type: :object,
57 properties: %{
58 followers: %Schema{type: :boolean},
59 follows: %Schema{type: :boolean},
60 non_followers: %Schema{type: :boolean},
61 non_follows: %Schema{type: :boolean},
62 privacy_option: %Schema{type: :boolean}
63 }
64 },
65 relationship: %Schema{
66 type: :object,
67 properties: %{
68 blocked_by: %Schema{type: :boolean},
69 blocking: %Schema{type: :boolean},
70 domain_blocking: %Schema{type: :boolean},
71 endorsed: %Schema{type: :boolean},
72 followed_by: %Schema{type: :boolean},
73 following: %Schema{type: :boolean},
74 id: %Schema{type: :string},
75 muting: %Schema{type: :boolean},
76 muting_notifications: %Schema{type: :boolean},
77 requested: %Schema{type: :boolean},
78 showing_reblogs: %Schema{type: :boolean},
79 subscribing: %Schema{type: :boolean}
80 }
81 },
82 settings_store: %Schema{
83 type: :object
84 }
85 }
86 },
87 source: %Schema{
88 type: :object,
89 properties: %{
90 fields: %Schema{type: :array, items: AccountField},
91 note: %Schema{type: :string},
92 privacy: VisibilityScope,
93 sensitive: %Schema{type: :boolean},
94 pleroma: %Schema{
95 type: :object,
96 properties: %{
97 actor_type: ActorType,
98 discoverable: %Schema{type: :boolean},
99 no_rich_text: %Schema{type: :boolean},
100 show_role: %Schema{type: :boolean}
101 }
102 }
103 }
104 }
105 },
106 example: %{
107 "JSON" => %{
108 "acct" => "foobar",
109 "avatar" => "https://mypleroma.com/images/avi.png",
110 "avatar_static" => "https://mypleroma.com/images/avi.png",
111 "bot" => false,
112 "created_at" => "2020-03-24T13:05:58.000Z",
113 "display_name" => "foobar",
114 "emojis" => [],
115 "fields" => [],
116 "follow_requests_count" => 0,
117 "followers_count" => 0,
118 "following_count" => 1,
119 "header" => "https://mypleroma.com/images/banner.png",
120 "header_static" => "https://mypleroma.com/images/banner.png",
121 "id" => "9tKi3esbG7OQgZ2920",
122 "locked" => false,
123 "note" => "cofe",
124 "pleroma" => %{
125 "allow_following_move" => true,
126 "background_image" => nil,
127 "confirmation_pending" => true,
128 "hide_favorites" => true,
129 "hide_followers" => false,
130 "hide_followers_count" => false,
131 "hide_follows" => false,
132 "hide_follows_count" => false,
133 "is_admin" => false,
134 "is_moderator" => false,
135 "skip_thread_containment" => false,
136 "chat_token" =>
137 "SFMyNTY.g3QAAAACZAAEZGF0YW0AAAASOXRLaTNlc2JHN09RZ1oyOTIwZAAGc2lnbmVkbgYARNplS3EB.Mb_Iaqew2bN1I1o79B_iP7encmVCpTKC4OtHZRxdjKc",
138 "unread_conversation_count" => 0,
139 "tags" => [],
140 "notification_settings" => %{
141 "followers" => true,
142 "follows" => true,
143 "non_followers" => true,
144 "non_follows" => true,
145 "privacy_option" => false
146 },
147 "relationship" => %{
148 "blocked_by" => false,
149 "blocking" => false,
150 "domain_blocking" => false,
151 "endorsed" => false,
152 "followed_by" => false,
153 "following" => false,
154 "id" => "9tKi3esbG7OQgZ2920",
155 "muting" => false,
156 "muting_notifications" => false,
157 "requested" => false,
158 "showing_reblogs" => true,
159 "subscribing" => false
160 },
161 "settings_store" => %{
162 "pleroma-fe" => %{}
163 }
164 },
165 "source" => %{
166 "fields" => [],
167 "note" => "foobar",
168 "pleroma" => %{
169 "actor_type" => "Person",
170 "discoverable" => false,
171 "no_rich_text" => false,
172 "show_role" => true
173 },
174 "privacy" => "public",
175 "sensitive" => false
176 },
177 "statuses_count" => 0,
178 "url" => "https://mypleroma.com/users/foobar",
179 "username" => "foobar"
180 }
181 }
182 })
183 end