differences_in_mastoapi_responses: Update account fields
[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.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 allow_following_move: %Schema{type: :boolean},
44 background_image: %Schema{type: :string, nullable: true},
45 chat_token: %Schema{type: :string},
46 confirmation_pending: %Schema{type: :boolean},
47 hide_favorites: %Schema{type: :boolean},
48 hide_followers_count: %Schema{type: :boolean},
49 hide_followers: %Schema{type: :boolean},
50 hide_follows_count: %Schema{type: :boolean},
51 hide_follows: %Schema{type: :boolean},
52 is_admin: %Schema{type: :boolean},
53 is_moderator: %Schema{type: :boolean},
54 skip_thread_containment: %Schema{type: :boolean},
55 tags: %Schema{type: :array, items: %Schema{type: :string}},
56 unread_conversation_count: %Schema{type: :integer},
57 notification_settings: %Schema{
58 type: :object,
59 properties: %{
60 followers: %Schema{type: :boolean},
61 follows: %Schema{type: :boolean},
62 non_followers: %Schema{type: :boolean},
63 non_follows: %Schema{type: :boolean},
64 privacy_option: %Schema{type: :boolean}
65 }
66 },
67 relationship: AccountRelationship,
68 settings_store: %Schema{
69 type: :object
70 }
71 }
72 },
73 source: %Schema{
74 type: :object,
75 properties: %{
76 fields: %Schema{type: :array, items: AccountField},
77 note: %Schema{type: :string},
78 privacy: VisibilityScope,
79 sensitive: %Schema{type: :boolean},
80 pleroma: %Schema{
81 type: :object,
82 properties: %{
83 actor_type: ActorType,
84 discoverable: %Schema{type: :boolean},
85 no_rich_text: %Schema{type: :boolean},
86 show_role: %Schema{type: :boolean}
87 }
88 }
89 }
90 }
91 },
92 example: %{
93 "acct" => "foobar",
94 "avatar" => "https://mypleroma.com/images/avi.png",
95 "avatar_static" => "https://mypleroma.com/images/avi.png",
96 "bot" => false,
97 "created_at" => "2020-03-24T13:05:58.000Z",
98 "display_name" => "foobar",
99 "emojis" => [],
100 "fields" => [],
101 "follow_requests_count" => 0,
102 "followers_count" => 0,
103 "following_count" => 1,
104 "header" => "https://mypleroma.com/images/banner.png",
105 "header_static" => "https://mypleroma.com/images/banner.png",
106 "id" => "9tKi3esbG7OQgZ2920",
107 "locked" => false,
108 "note" => "cofe",
109 "pleroma" => %{
110 "allow_following_move" => true,
111 "background_image" => nil,
112 "confirmation_pending" => true,
113 "hide_favorites" => true,
114 "hide_followers" => false,
115 "hide_followers_count" => false,
116 "hide_follows" => false,
117 "hide_follows_count" => false,
118 "is_admin" => false,
119 "is_moderator" => false,
120 "skip_thread_containment" => false,
121 "chat_token" =>
122 "SFMyNTY.g3QAAAACZAAEZGF0YW0AAAASOXRLaTNlc2JHN09RZ1oyOTIwZAAGc2lnbmVkbgYARNplS3EB.Mb_Iaqew2bN1I1o79B_iP7encmVCpTKC4OtHZRxdjKc",
123 "unread_conversation_count" => 0,
124 "tags" => [],
125 "notification_settings" => %{
126 "followers" => true,
127 "follows" => true,
128 "non_followers" => true,
129 "non_follows" => true,
130 "privacy_option" => false
131 },
132 "relationship" => %{
133 "blocked_by" => false,
134 "blocking" => false,
135 "domain_blocking" => false,
136 "endorsed" => false,
137 "followed_by" => false,
138 "following" => false,
139 "id" => "9tKi3esbG7OQgZ2920",
140 "muting" => false,
141 "muting_notifications" => false,
142 "requested" => false,
143 "showing_reblogs" => true,
144 "subscribing" => false
145 },
146 "settings_store" => %{
147 "pleroma-fe" => %{}
148 }
149 },
150 "source" => %{
151 "fields" => [],
152 "note" => "foobar",
153 "pleroma" => %{
154 "actor_type" => "Person",
155 "discoverable" => false,
156 "no_rich_text" => false,
157 "show_role" => true
158 },
159 "privacy" => "public",
160 "sensitive" => false
161 },
162 "statuses_count" => 0,
163 "url" => "https://mypleroma.com/users/foobar",
164 "username" => "foobar"
165 }
166 })
167 end