aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/api_spec/schemas
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pleroma/web/api_spec/schemas')
-rw-r--r--lib/pleroma/web/api_spec/schemas/account.ex4
-rw-r--r--lib/pleroma/web/api_spec/schemas/account_create_request.ex60
-rw-r--r--lib/pleroma/web/api_spec/schemas/account_create_response.ex27
-rw-r--r--lib/pleroma/web/api_spec/schemas/account_field_attribute.ex24
-rw-r--r--lib/pleroma/web/api_spec/schemas/account_follows_request.ex18
-rw-r--r--lib/pleroma/web/api_spec/schemas/account_mute_request.ex24
-rw-r--r--lib/pleroma/web/api_spec/schemas/account_relationships_response.ex58
-rw-r--r--lib/pleroma/web/api_spec/schemas/account_update_credentials_request.ex125
-rw-r--r--lib/pleroma/web/api_spec/schemas/accounts_response.ex13
-rw-r--r--lib/pleroma/web/api_spec/schemas/api_error.ex (renamed from lib/pleroma/web/api_spec/schemas/list.ex)14
-rw-r--r--lib/pleroma/web/api_spec/schemas/custom_emoji.ex30
-rw-r--r--lib/pleroma/web/api_spec/schemas/emoji.ex (renamed from lib/pleroma/web/api_spec/schemas/account_emoji.ex)6
-rw-r--r--lib/pleroma/web/api_spec/schemas/lists_response.ex16
-rw-r--r--lib/pleroma/web/api_spec/schemas/poll.ex4
-rw-r--r--lib/pleroma/web/api_spec/schemas/status.ex4
-rw-r--r--lib/pleroma/web/api_spec/schemas/statuses_response.ex13
16 files changed, 14 insertions, 426 deletions
diff --git a/lib/pleroma/web/api_spec/schemas/account.ex b/lib/pleroma/web/api_spec/schemas/account.ex
index d128feb30..d54e2158d 100644
--- a/lib/pleroma/web/api_spec/schemas/account.ex
+++ b/lib/pleroma/web/api_spec/schemas/account.ex
@@ -4,10 +4,10 @@
defmodule Pleroma.Web.ApiSpec.Schemas.Account do
alias OpenApiSpex.Schema
- alias Pleroma.Web.ApiSpec.Schemas.AccountEmoji
alias Pleroma.Web.ApiSpec.Schemas.AccountField
alias Pleroma.Web.ApiSpec.Schemas.AccountRelationship
alias Pleroma.Web.ApiSpec.Schemas.ActorType
+ alias Pleroma.Web.ApiSpec.Schemas.Emoji
alias Pleroma.Web.ApiSpec.Schemas.FlakeID
alias Pleroma.Web.ApiSpec.Schemas.VisibilityScope
@@ -24,7 +24,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Account do
bot: %Schema{type: :boolean},
created_at: %Schema{type: :string, format: "date-time"},
display_name: %Schema{type: :string},
- emojis: %Schema{type: :array, items: AccountEmoji},
+ emojis: %Schema{type: :array, items: Emoji},
fields: %Schema{type: :array, items: AccountField},
follow_requests_count: %Schema{type: :integer},
followers_count: %Schema{type: :integer},
diff --git a/lib/pleroma/web/api_spec/schemas/account_create_request.ex b/lib/pleroma/web/api_spec/schemas/account_create_request.ex
deleted file mode 100644
index 49fa12159..000000000
--- a/lib/pleroma/web/api_spec/schemas/account_create_request.ex
+++ /dev/null
@@ -1,60 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.ApiSpec.Schemas.AccountCreateRequest do
- alias OpenApiSpex.Schema
- require OpenApiSpex
-
- OpenApiSpex.schema(%{
- title: "AccountCreateRequest",
- description: "POST body for creating an account",
- type: :object,
- properties: %{
- reason: %Schema{
- type: :string,
- description:
- "Text that will be reviewed by moderators if registrations require manual approval"
- },
- username: %Schema{type: :string, description: "The desired username for the account"},
- email: %Schema{
- type: :string,
- description:
- "The email address to be used for login. Required when `account_activation_required` is enabled.",
- format: :email
- },
- password: %Schema{
- type: :string,
- description: "The password to be used for login",
- format: :password
- },
- agreement: %Schema{
- type: :boolean,
- description:
- "Whether the user agrees to the local rules, terms, and policies. These should be presented to the user in order to allow them to consent before setting this parameter to TRUE."
- },
- locale: %Schema{
- type: :string,
- description: "The language of the confirmation email that will be sent"
- },
- # Pleroma-specific properties:
- fullname: %Schema{type: :string, description: "Full name"},
- bio: %Schema{type: :string, description: "Bio", default: ""},
- captcha_solution: %Schema{type: :string, description: "Provider-specific captcha solution"},
- captcha_token: %Schema{type: :string, description: "Provider-specific captcha token"},
- captcha_answer_data: %Schema{type: :string, description: "Provider-specific captcha data"},
- token: %Schema{
- type: :string,
- description: "Invite token required when the registrations aren't public"
- }
- },
- required: [:username, :password, :agreement],
- example: %{
- "username" => "cofe",
- "email" => "cofe@example.com",
- "password" => "secret",
- "agreement" => "true",
- "bio" => "☕️"
- }
- })
-end
diff --git a/lib/pleroma/web/api_spec/schemas/account_create_response.ex b/lib/pleroma/web/api_spec/schemas/account_create_response.ex
deleted file mode 100644
index 2237351a2..000000000
--- a/lib/pleroma/web/api_spec/schemas/account_create_response.ex
+++ /dev/null
@@ -1,27 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.ApiSpec.Schemas.AccountCreateResponse do
- alias OpenApiSpex.Schema
-
- require OpenApiSpex
-
- OpenApiSpex.schema(%{
- title: "AccountCreateResponse",
- description: "Response schema for an account",
- type: :object,
- properties: %{
- token_type: %Schema{type: :string},
- access_token: %Schema{type: :string},
- scope: %Schema{type: :array, items: %Schema{type: :string}},
- created_at: %Schema{type: :integer, format: :"date-time"}
- },
- example: %{
- "access_token" => "i9hAVVzGld86Pl5JtLtizKoXVvtTlSCJvwaugCxvZzk",
- "created_at" => 1_585_918_714,
- "scope" => ["read", "write", "follow", "push"],
- "token_type" => "Bearer"
- }
- })
-end
diff --git a/lib/pleroma/web/api_spec/schemas/account_field_attribute.ex b/lib/pleroma/web/api_spec/schemas/account_field_attribute.ex
deleted file mode 100644
index 89e483655..000000000
--- a/lib/pleroma/web/api_spec/schemas/account_field_attribute.ex
+++ /dev/null
@@ -1,24 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.ApiSpec.Schemas.AccountAttributeField do
- alias OpenApiSpex.Schema
-
- require OpenApiSpex
-
- OpenApiSpex.schema(%{
- title: "AccountAttributeField",
- description: "Request schema for account custom fields",
- type: :object,
- properties: %{
- name: %Schema{type: :string},
- value: %Schema{type: :string}
- },
- required: [:name, :value],
- example: %{
- "name" => "Website",
- "value" => "https://pleroma.com"
- }
- })
-end
diff --git a/lib/pleroma/web/api_spec/schemas/account_follows_request.ex b/lib/pleroma/web/api_spec/schemas/account_follows_request.ex
deleted file mode 100644
index 19dce0cb2..000000000
--- a/lib/pleroma/web/api_spec/schemas/account_follows_request.ex
+++ /dev/null
@@ -1,18 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.ApiSpec.Schemas.AccountFollowsRequest do
- alias OpenApiSpex.Schema
- require OpenApiSpex
-
- OpenApiSpex.schema(%{
- title: "AccountFollowsRequest",
- description: "POST body for muting an account",
- type: :object,
- properties: %{
- uri: %Schema{type: :string, format: :uri}
- },
- required: [:uri]
- })
-end
diff --git a/lib/pleroma/web/api_spec/schemas/account_mute_request.ex b/lib/pleroma/web/api_spec/schemas/account_mute_request.ex
deleted file mode 100644
index a61f6d04c..000000000
--- a/lib/pleroma/web/api_spec/schemas/account_mute_request.ex
+++ /dev/null
@@ -1,24 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.ApiSpec.Schemas.AccountMuteRequest do
- alias OpenApiSpex.Schema
- require OpenApiSpex
-
- OpenApiSpex.schema(%{
- title: "AccountMuteRequest",
- description: "POST body for muting an account",
- type: :object,
- properties: %{
- notifications: %Schema{
- type: :boolean,
- description: "Mute notifications in addition to statuses? Defaults to true.",
- default: true
- }
- },
- example: %{
- "notifications" => true
- }
- })
-end
diff --git a/lib/pleroma/web/api_spec/schemas/account_relationships_response.ex b/lib/pleroma/web/api_spec/schemas/account_relationships_response.ex
deleted file mode 100644
index 960e14db1..000000000
--- a/lib/pleroma/web/api_spec/schemas/account_relationships_response.ex
+++ /dev/null
@@ -1,58 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.ApiSpec.Schemas.AccountRelationshipsResponse do
- require OpenApiSpex
-
- OpenApiSpex.schema(%{
- title: "AccountRelationshipsResponse",
- description: "Response schema for account relationships",
- type: :array,
- items: Pleroma.Web.ApiSpec.Schemas.AccountRelationship,
- example: [
- %{
- "id" => "1",
- "following" => true,
- "showing_reblogs" => true,
- "followed_by" => true,
- "blocking" => false,
- "blocked_by" => true,
- "muting" => false,
- "muting_notifications" => false,
- "requested" => false,
- "domain_blocking" => false,
- "subscribing" => false,
- "endorsed" => true
- },
- %{
- "id" => "2",
- "following" => true,
- "showing_reblogs" => true,
- "followed_by" => true,
- "blocking" => false,
- "blocked_by" => true,
- "muting" => true,
- "muting_notifications" => false,
- "requested" => true,
- "domain_blocking" => false,
- "subscribing" => false,
- "endorsed" => false
- },
- %{
- "id" => "3",
- "following" => true,
- "showing_reblogs" => true,
- "followed_by" => true,
- "blocking" => true,
- "blocked_by" => false,
- "muting" => true,
- "muting_notifications" => false,
- "requested" => false,
- "domain_blocking" => true,
- "subscribing" => true,
- "endorsed" => false
- }
- ]
- })
-end
diff --git a/lib/pleroma/web/api_spec/schemas/account_update_credentials_request.ex b/lib/pleroma/web/api_spec/schemas/account_update_credentials_request.ex
deleted file mode 100644
index 35220c78a..000000000
--- a/lib/pleroma/web/api_spec/schemas/account_update_credentials_request.ex
+++ /dev/null
@@ -1,125 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.ApiSpec.Schemas.AccountUpdateCredentialsRequest do
- alias OpenApiSpex.Schema
- alias Pleroma.Web.ApiSpec.Schemas.AccountAttributeField
- alias Pleroma.Web.ApiSpec.Schemas.ActorType
- alias Pleroma.Web.ApiSpec.Schemas.VisibilityScope
- require OpenApiSpex
-
- OpenApiSpex.schema(%{
- title: "AccountUpdateCredentialsRequest",
- description: "POST body for creating an account",
- type: :object,
- properties: %{
- bot: %Schema{
- type: :boolean,
- description: "Whether the account has a bot flag."
- },
- display_name: %Schema{
- type: :string,
- description: "The display name to use for the profile."
- },
- note: %Schema{type: :string, description: "The account bio."},
- avatar: %Schema{
- type: :string,
- description: "Avatar image encoded using multipart/form-data",
- format: :binary
- },
- header: %Schema{
- type: :string,
- description: "Header image encoded using multipart/form-data",
- format: :binary
- },
- locked: %Schema{
- type: :boolean,
- description: "Whether manual approval of follow requests is required."
- },
- fields_attributes: %Schema{
- oneOf: [
- %Schema{type: :array, items: AccountAttributeField},
- %Schema{type: :object, additionalProperties: %Schema{type: AccountAttributeField}}
- ]
- },
- # NOTE: `source` field is not supported
- #
- # source: %Schema{
- # type: :object,
- # properties: %{
- # privacy: %Schema{type: :string},
- # sensitive: %Schema{type: :boolean},
- # language: %Schema{type: :string}
- # }
- # },
-
- # Pleroma-specific fields
- no_rich_text: %Schema{
- type: :boolean,
- description: "html tags are stripped from all statuses requested from the API"
- },
- hide_followers: %Schema{type: :boolean, description: "user's followers will be hidden"},
- hide_follows: %Schema{type: :boolean, description: "user's follows will be hidden"},
- hide_followers_count: %Schema{
- type: :boolean,
- description: "user's follower count will be hidden"
- },
- hide_follows_count: %Schema{
- type: :boolean,
- description: "user's follow count will be hidden"
- },
- hide_favorites: %Schema{
- type: :boolean,
- description: "user's favorites timeline will be hidden"
- },
- show_role: %Schema{
- type: :boolean,
- description: "user's role (e.g admin, moderator) will be exposed to anyone in the
- API"
- },
- default_scope: VisibilityScope,
- pleroma_settings_store: %Schema{
- type: :object,
- description: "Opaque user settings to be saved on the backend."
- },
- skip_thread_containment: %Schema{
- type: :boolean,
- description: "Skip filtering out broken threads"
- },
- allow_following_move: %Schema{
- type: :boolean,
- description: "Allows automatically follow moved following accounts"
- },
- pleroma_background_image: %Schema{
- type: :string,
- description: "Sets the background image of the user.",
- format: :binary
- },
- discoverable: %Schema{
- type: :boolean,
- description: "Discovery of this account in search results and other services is allowed."
- },
- actor_type: ActorType
- },
- example: %{
- bot: false,
- display_name: "cofe",
- note: "foobar",
- fields_attributes: [%{name: "foo", value: "bar"}],
- no_rich_text: false,
- hide_followers: true,
- hide_follows: false,
- hide_followers_count: false,
- hide_follows_count: false,
- hide_favorites: false,
- show_role: false,
- default_scope: "private",
- pleroma_settings_store: %{"pleroma-fe" => %{"key" => "val"}},
- skip_thread_containment: false,
- allow_following_move: false,
- discoverable: false,
- actor_type: "Person"
- }
- })
-end
diff --git a/lib/pleroma/web/api_spec/schemas/accounts_response.ex b/lib/pleroma/web/api_spec/schemas/accounts_response.ex
deleted file mode 100644
index b714f59e7..000000000
--- a/lib/pleroma/web/api_spec/schemas/accounts_response.ex
+++ /dev/null
@@ -1,13 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.ApiSpec.Schemas.AccountsResponse do
- require OpenApiSpex
-
- OpenApiSpex.schema(%{
- title: "AccountsResponse",
- type: :array,
- items: Pleroma.Web.ApiSpec.Schemas.Account
- })
-end
diff --git a/lib/pleroma/web/api_spec/schemas/list.ex b/lib/pleroma/web/api_spec/schemas/api_error.ex
index f85fac2b8..5815df94c 100644
--- a/lib/pleroma/web/api_spec/schemas/list.ex
+++ b/lib/pleroma/web/api_spec/schemas/api_error.ex
@@ -2,22 +2,18 @@
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
-defmodule Pleroma.Web.ApiSpec.Schemas.List do
+defmodule Pleroma.Web.ApiSpec.Schemas.ApiError do
alias OpenApiSpex.Schema
require OpenApiSpex
OpenApiSpex.schema(%{
- title: "List",
- description: "Response schema for a list",
+ title: "ApiError",
+ description: "Response schema for API error",
type: :object,
- properties: %{
- id: %Schema{type: :string},
- title: %Schema{type: :string}
- },
+ properties: %{error: %Schema{type: :string}},
example: %{
- "id" => "123",
- "title" => "my list"
+ "error" => "Something went wrong"
}
})
end
diff --git a/lib/pleroma/web/api_spec/schemas/custom_emoji.ex b/lib/pleroma/web/api_spec/schemas/custom_emoji.ex
deleted file mode 100644
index 5531b2081..000000000
--- a/lib/pleroma/web/api_spec/schemas/custom_emoji.ex
+++ /dev/null
@@ -1,30 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.ApiSpec.Schemas.CustomEmoji do
- alias OpenApiSpex.Schema
-
- require OpenApiSpex
-
- OpenApiSpex.schema(%{
- title: "CustomEmoji",
- description: "Response schema for an CustomEmoji",
- type: :object,
- properties: %{
- shortcode: %Schema{type: :string},
- url: %Schema{type: :string},
- static_url: %Schema{type: :string},
- visible_in_picker: %Schema{type: :boolean},
- category: %Schema{type: :string},
- tags: %Schema{type: :array}
- },
- example: %{
- "shortcode" => "aaaa",
- "url" => "https://files.mastodon.social/custom_emojis/images/000/007/118/original/aaaa.png",
- "static_url" =>
- "https://files.mastodon.social/custom_emojis/images/000/007/118/static/aaaa.png",
- "visible_in_picker" => true
- }
- })
-end
diff --git a/lib/pleroma/web/api_spec/schemas/account_emoji.ex b/lib/pleroma/web/api_spec/schemas/emoji.ex
index 6c1d4d95c..26f35e648 100644
--- a/lib/pleroma/web/api_spec/schemas/account_emoji.ex
+++ b/lib/pleroma/web/api_spec/schemas/emoji.ex
@@ -2,14 +2,14 @@
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
-defmodule Pleroma.Web.ApiSpec.Schemas.AccountEmoji do
+defmodule Pleroma.Web.ApiSpec.Schemas.Emoji do
alias OpenApiSpex.Schema
require OpenApiSpex
OpenApiSpex.schema(%{
- title: "AccountEmoji",
- description: "Response schema for account custom fields",
+ title: "Emoji",
+ description: "Response schema for an emoji",
type: :object,
properties: %{
shortcode: %Schema{type: :string},
diff --git a/lib/pleroma/web/api_spec/schemas/lists_response.ex b/lib/pleroma/web/api_spec/schemas/lists_response.ex
deleted file mode 100644
index 132454579..000000000
--- a/lib/pleroma/web/api_spec/schemas/lists_response.ex
+++ /dev/null
@@ -1,16 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.ApiSpec.Schemas.ListsResponse do
- alias Pleroma.Web.ApiSpec.Schemas.List
-
- require OpenApiSpex
-
- OpenApiSpex.schema(%{
- title: "ListsResponse",
- description: "Response schema for lists",
- type: :array,
- items: List
- })
-end
diff --git a/lib/pleroma/web/api_spec/schemas/poll.ex b/lib/pleroma/web/api_spec/schemas/poll.ex
index 5fc9e889f..0474b550b 100644
--- a/lib/pleroma/web/api_spec/schemas/poll.ex
+++ b/lib/pleroma/web/api_spec/schemas/poll.ex
@@ -4,7 +4,7 @@
defmodule Pleroma.Web.ApiSpec.Schemas.Poll do
alias OpenApiSpex.Schema
- alias Pleroma.Web.ApiSpec.Schemas.AccountEmoji
+ alias Pleroma.Web.ApiSpec.Schemas.Emoji
alias Pleroma.Web.ApiSpec.Schemas.FlakeID
require OpenApiSpex
@@ -20,7 +20,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Poll do
multiple: %Schema{type: :boolean},
votes_count: %Schema{type: :integer},
voted: %Schema{type: :boolean},
- emojis: %Schema{type: :array, items: AccountEmoji},
+ emojis: %Schema{type: :array, items: Emoji},
options: %Schema{
type: :array,
items: %Schema{
diff --git a/lib/pleroma/web/api_spec/schemas/status.ex b/lib/pleroma/web/api_spec/schemas/status.ex
index bf5f04691..aef0588d4 100644
--- a/lib/pleroma/web/api_spec/schemas/status.ex
+++ b/lib/pleroma/web/api_spec/schemas/status.ex
@@ -5,7 +5,7 @@
defmodule Pleroma.Web.ApiSpec.Schemas.Status do
alias OpenApiSpex.Schema
alias Pleroma.Web.ApiSpec.Schemas.Account
- alias Pleroma.Web.ApiSpec.Schemas.AccountEmoji
+ alias Pleroma.Web.ApiSpec.Schemas.Emoji
alias Pleroma.Web.ApiSpec.Schemas.FlakeID
alias Pleroma.Web.ApiSpec.Schemas.Poll
alias Pleroma.Web.ApiSpec.Schemas.VisibilityScope
@@ -41,7 +41,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do
},
content: %Schema{type: :string, format: :html},
created_at: %Schema{type: :string, format: "date-time"},
- emojis: %Schema{type: :array, items: AccountEmoji},
+ emojis: %Schema{type: :array, items: Emoji},
favourited: %Schema{type: :boolean},
favourites_count: %Schema{type: :integer},
id: FlakeID,
diff --git a/lib/pleroma/web/api_spec/schemas/statuses_response.ex b/lib/pleroma/web/api_spec/schemas/statuses_response.ex
deleted file mode 100644
index fb7c7e0aa..000000000
--- a/lib/pleroma/web/api_spec/schemas/statuses_response.ex
+++ /dev/null
@@ -1,13 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.ApiSpec.Schemas.StatusesResponse do
- require OpenApiSpex
-
- OpenApiSpex.schema(%{
- title: "StatusesResponse",
- type: :array,
- items: Pleroma.Web.ApiSpec.Schemas.Status
- })
-end