6ab48193edf577828b81823ef4f9761d4a977882
[akkoma] / lib / pleroma / web / api_spec / schemas / account_update_credentials_request.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.AccountUpdateCredentialsRequest do
6 alias OpenApiSpex.Schema
7 alias Pleroma.Web.ApiSpec.Schemas.AccountAttributeField
8 alias Pleroma.Web.ApiSpec.Schemas.ActorType
9 alias Pleroma.Web.ApiSpec.Schemas.VisibilityScope
10 require OpenApiSpex
11
12 OpenApiSpex.schema(%{
13 title: "AccountUpdateCredentialsRequest",
14 description: "POST body for creating an account",
15 type: :object,
16 properties: %{
17 bot: %Schema{
18 type: :boolean,
19 description: "Whether the account has a bot flag."
20 },
21 display_name: %Schema{
22 type: :string,
23 description: "The display name to use for the profile."
24 },
25 note: %Schema{type: :string, description: "The account bio."},
26 avatar: %Schema{
27 type: :string,
28 description: "Avatar image encoded using multipart/form-data",
29 format: :binary
30 },
31 header: %Schema{
32 type: :string,
33 description: "Header image encoded using multipart/form-data",
34 format: :binary
35 },
36 locked: %Schema{
37 type: :boolean,
38 description: "Whether manual approval of follow requests is required."
39 },
40 fields_attributes: %Schema{
41 oneOf: [%Schema{type: :array, items: AccountAttributeField}, %Schema{type: :object}]
42 },
43 # NOTE: `source` field is not supported
44 #
45 # source: %Schema{
46 # type: :object,
47 # properties: %{
48 # privacy: %Schema{type: :string},
49 # sensitive: %Schema{type: :boolean},
50 # language: %Schema{type: :string}
51 # }
52 # },
53
54 # Pleroma-specific fields
55 no_rich_text: %Schema{
56 type: :boolean,
57 description: "html tags are stripped from all statuses requested from the API"
58 },
59 hide_followers: %Schema{type: :boolean, description: "user's followers will be hidden"},
60 hide_follows: %Schema{type: :boolean, description: "user's follows will be hidden"},
61 hide_followers_count: %Schema{
62 type: :boolean,
63 description: "user's follower count will be hidden"
64 },
65 hide_follows_count: %Schema{
66 type: :boolean,
67 description: "user's follow count will be hidden"
68 },
69 hide_favorites: %Schema{
70 type: :boolean,
71 description: "user's favorites timeline will be hidden"
72 },
73 show_role: %Schema{
74 type: :boolean,
75 description: "user's role (e.g admin, moderator) will be exposed to anyone in the
76 API"
77 },
78 default_scope: VisibilityScope,
79 pleroma_settings_store: %Schema{
80 type: :object,
81 description: "Opaque user settings to be saved on the backend."
82 },
83 skip_thread_containment: %Schema{
84 type: :boolean,
85 description: "Skip filtering out broken threads"
86 },
87 allow_following_move: %Schema{
88 type: :boolean,
89 description: "Allows automatically follow moved following accounts"
90 },
91 pleroma_background_image: %Schema{
92 type: :string,
93 description: "Sets the background image of the user.",
94 format: :binary
95 },
96 discoverable: %Schema{
97 type: :boolean,
98 description: "Discovery of this account in search results and other services is allowed."
99 },
100 actor_type: ActorType
101 },
102 example: %{
103 bot: false,
104 display_name: "cofe",
105 note: "foobar",
106 fields_attributes: [%{name: "foo", value: "bar"}],
107 no_rich_text: false,
108 hide_followers: true,
109 hide_follows: false,
110 hide_followers_count: false,
111 hide_follows_count: false,
112 hide_favorites: false,
113 show_role: false,
114 default_scope: "private",
115 pleroma_settings_store: %{"pleroma-fe" => %{"key" => "val"}},
116 skip_thread_containment: false,
117 allow_following_move: false,
118 discoverable: false,
119 actor_type: "Person"
120 }
121 })
122 end