X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpleroma%2Fweb%2Fapi_spec%2Foperations%2Fpleroma_account_operation.ex;h=ad49f64261748ee0f0e2a1cdb73cadfa4bd15e17;hb=21720db8596a50d84200db5c564267cfe992580d;hp=90922c064afa2d1f069e20bd4a8b24e913d5191e;hpb=15c7e3b4bf15ceb5087dde139bde1eb4f3150627;p=akkoma
diff --git a/lib/pleroma/web/api_spec/operations/pleroma_account_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_account_operation.ex
index 90922c064..ad49f6426 100644
--- a/lib/pleroma/web/api_spec/operations/pleroma_account_operation.ex
+++ b/lib/pleroma/web/api_spec/operations/pleroma_account_operation.ex
@@ -1,10 +1,9 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ApiSpec.PleromaAccountOperation do
alias OpenApiSpex.Operation
- alias OpenApiSpex.Schema
alias Pleroma.Web.ApiSpec.Schemas.AccountRelationship
alias Pleroma.Web.ApiSpec.Schemas.ApiError
alias Pleroma.Web.ApiSpec.Schemas.FlakeID
@@ -19,8 +18,9 @@ defmodule Pleroma.Web.ApiSpec.PleromaAccountOperation do
def confirmation_resend_operation do
%Operation{
- tags: ["Accounts"],
- summary: "Resend confirmation email. Expects `email` or `nickname`",
+ tags: ["Account credentials"],
+ summary: "Resend confirmation email",
+ description: "Expects `email` or `nickname`.",
operationId: "PleromaAPI.AccountController.confirmation_resend",
parameters: [
Operation.parameter(:email, :query, :string, "Email of that needs to be verified",
@@ -40,52 +40,12 @@ defmodule Pleroma.Web.ApiSpec.PleromaAccountOperation do
}
end
- def update_avatar_operation do
- %Operation{
- tags: ["Accounts"],
- summary: "Set/clear user avatar image",
- operationId: "PleromaAPI.AccountController.update_avatar",
- requestBody:
- request_body("Parameters", update_avatar_or_background_request(), required: true),
- security: [%{"oAuth" => ["write:accounts"]}],
- responses: %{
- 200 => update_response(),
- 403 => Operation.response("Forbidden", "application/json", ApiError)
- }
- }
- end
-
- def update_banner_operation do
- %Operation{
- tags: ["Accounts"],
- summary: "Set/clear user banner image",
- operationId: "PleromaAPI.AccountController.update_banner",
- requestBody: request_body("Parameters", update_banner_request(), required: true),
- security: [%{"oAuth" => ["write:accounts"]}],
- responses: %{
- 200 => update_response()
- }
- }
- end
-
- def update_background_operation do
- %Operation{
- tags: ["Accounts"],
- summary: "Set/clear user background image",
- operationId: "PleromaAPI.AccountController.update_background",
- security: [%{"oAuth" => ["write:accounts"]}],
- requestBody:
- request_body("Parameters", update_avatar_or_background_request(), required: true),
- responses: %{
- 200 => update_response()
- }
- }
- end
-
def favourites_operation do
%Operation{
- tags: ["Accounts"],
- summary: "Returns favorites timeline of any user",
+ tags: ["Retrieve account information"],
+ summary: "Favorites",
+ description:
+ "Only returns data if the user has opted into sharing it. See `hide_favorites` in [Update account credentials](#operation/AccountController.update_credentials).",
operationId: "PleromaAPI.AccountController.favourites",
parameters: [id_param() | pagination_params()],
security: [%{"oAuth" => ["read:favourites"]}],
@@ -104,8 +64,9 @@ defmodule Pleroma.Web.ApiSpec.PleromaAccountOperation do
def subscribe_operation do
%Operation{
- tags: ["Accounts"],
- summary: "Subscribe to receive notifications for all statuses posted by a user",
+ tags: ["Account actions"],
+ summary: "Subscribe",
+ description: "Receive notifications for all statuses posted by the account.",
operationId: "PleromaAPI.AccountController.subscribe",
parameters: [id_param()],
security: [%{"oAuth" => ["follow", "write:follows"]}],
@@ -118,8 +79,9 @@ defmodule Pleroma.Web.ApiSpec.PleromaAccountOperation do
def unsubscribe_operation do
%Operation{
- tags: ["Accounts"],
- summary: "Unsubscribe to stop receiving notifications from user statuses",
+ tags: ["Account actions"],
+ summary: "Unsubscribe",
+ description: "Stop receiving notifications for all statuses posted by the account.",
operationId: "PleromaAPI.AccountController.unsubscribe",
parameters: [id_param()],
security: [%{"oAuth" => ["follow", "write:follows"]}],
@@ -136,52 +98,4 @@ defmodule Pleroma.Web.ApiSpec.PleromaAccountOperation do
required: true
)
end
-
- defp update_avatar_or_background_request do
- %Schema{
- title: "PleromaAccountUpdateAvatarOrBackgroundRequest",
- type: :object,
- properties: %{
- img: %Schema{
- nullable: true,
- type: :string,
- format: :binary,
- description: "Image encoded using `multipart/form-data` or an empty string to clear"
- }
- }
- }
- end
-
- defp update_banner_request do
- %Schema{
- title: "PleromaAccountUpdateBannerRequest",
- type: :object,
- properties: %{
- banner: %Schema{
- type: :string,
- nullable: true,
- format: :binary,
- description: "Image encoded using `multipart/form-data` or an empty string to clear"
- }
- }
- }
- end
-
- defp update_response do
- Operation.response("PleromaAccountUpdateResponse", "application/json", %Schema{
- type: :object,
- properties: %{
- url: %Schema{
- type: :string,
- format: :uri,
- nullable: true,
- description: "Image URL"
- }
- },
- example: %{
- "url" =>
- "https://cofe.party/media/9d0add56-bcb6-4c0f-8225-cbbd0b6dd773/13eadb6972c9ccd3f4ffa3b8196f0e0d38b4d2f27594457c52e52946c054cd9a.gif"
- }
- })
- end
end