1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ApiSpec.FollowRequestOperation do
6 alias OpenApiSpex.Operation
7 alias OpenApiSpex.Schema
8 alias Pleroma.Web.ApiSpec.Schemas.Account
9 alias Pleroma.Web.ApiSpec.Schemas.AccountRelationship
11 def open_api_operation(action) do
12 operation = String.to_existing_atom("#{action}_operation")
13 apply(__MODULE__, operation, [])
16 def index_operation do
18 tags: ["Follow requests"],
19 summary: "Retrieve follow requests",
20 security: [%{"oAuth" => ["read:follows", "follow"]}],
21 operationId: "FollowRequestController.index",
24 Operation.response("Array of Account", "application/json", %Schema{
27 example: [Account.schema().example]
33 def authorize_operation do
35 tags: ["Follow requests"],
36 summary: "Accept follow request",
37 operationId: "FollowRequestController.authorize",
38 parameters: [id_param()],
39 security: [%{"oAuth" => ["follow", "write:follows"]}],
41 200 => Operation.response("Relationship", "application/json", AccountRelationship)
46 def reject_operation do
48 tags: ["Follow requests"],
49 summary: "Reject follow request",
50 operationId: "FollowRequestController.reject",
51 parameters: [id_param()],
52 security: [%{"oAuth" => ["follow", "write:follows"]}],
54 200 => Operation.response("Relationship", "application/json", AccountRelationship)
60 Operation.parameter(:id, :path, :string, "Conversation ID",