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