1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ApiSpec.AccountOperation do
6 alias OpenApiSpex.Operation
7 alias Pleroma.Web.ApiSpec.Helpers
8 alias Pleroma.Web.ApiSpec.Schemas.Account
9 alias Pleroma.Web.ApiSpec.Schemas.AccountCreateRequest
10 alias Pleroma.Web.ApiSpec.Schemas.AccountCreateResponse
12 @spec open_api_operation(atom) :: Operation.t()
13 def open_api_operation(action) do
14 operation = String.to_existing_atom("#{action}_operation")
15 apply(__MODULE__, operation, [])
18 @spec create_operation() :: Operation.t()
19 def create_operation do
22 summary: "Register an account",
24 "Creates a user and account records. Returns an account access token for the app that initiated the request. The app should save this token for later, and should wait for the user to confirm their account by clicking a link in their email inbox.",
25 operationId: "AccountController.create",
26 requestBody: Helpers.request_body("Parameters", AccountCreateRequest, required: true),
28 200 => Operation.response("Account", "application/json", AccountCreateResponse)
33 def verify_credentials_operation do
36 description: "Test to make sure that the user token works.",
37 summary: "Verify account credentials",
38 operationId: "AccountController.verify_credentials",
39 security: [%{"oAuth" => ["read:accounts"]}],
41 200 => Operation.response("Account", "application/json", Account)
46 def update_credentials_operation do
50 def relationships_operation do
58 def statuses_operation do
62 def followers_operation do
66 def following_operation, do: :ok
67 def lists_operation, do: :ok
68 def follow_operation, do: :ok
69 def unfollow_operation, do: :ok
70 def mute_operation, do: :ok
71 def unmute_operation, do: :ok
72 def block_operation, do: :ok
73 def unblock_operation, do: :ok
74 def follows_operation, do: :ok
75 def mutes_operation, do: :ok
76 def blocks_operation, do: :ok
77 def endorsements_operation, do: :ok