3d2270c29007932eaf36091564e5149dea2e4876
[akkoma] / lib / pleroma / web / api_spec / operations / account_operation.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.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
11
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, [])
16 end
17
18 @spec create_operation() :: Operation.t()
19 def create_operation do
20 %Operation{
21 tags: ["accounts"],
22 summary: "Register an account",
23 description:
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),
27 responses: %{
28 200 => Operation.response("Account", "application/json", AccountCreateResponse)
29 }
30 }
31 end
32
33 def verify_credentials_operation do
34 %Operation{
35 tags: ["accounts"],
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"]}],
40 responses: %{
41 200 => Operation.response("Account", "application/json", Account)
42 }
43 }
44 end
45
46 def update_credentials_operation do
47 :ok
48 end
49
50 def relationships_operation do
51 :ok
52 end
53
54 def show_operation do
55 :ok
56 end
57
58 def statuses_operation do
59 :ok
60 end
61
62 def followers_operation do
63 :ok
64 end
65
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
78 end