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