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.Admin.RelayOperation do
6 alias OpenApiSpex.Operation
7 alias OpenApiSpex.Schema
9 import Pleroma.Web.ApiSpec.Helpers
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: ["Admin", "Relays"],
19 summary: "List Relays",
20 operationId: "AdminAPI.RelayController.index",
21 security: [%{"oAuth" => ["read"]}],
22 parameters: admin_api_params(),
25 Operation.response("Response", "application/json", %Schema{
30 items: %Schema{type: :string},
31 example: ["lain.com", "mstdn.io"]
39 def follow_operation do
41 tags: ["Admin", "Relays"],
42 summary: "Follow a Relay",
43 operationId: "AdminAPI.RelayController.follow",
44 security: [%{"oAuth" => ["write:follows"]}],
45 parameters: admin_api_params(),
47 request_body("Parameters", %Schema{
50 relay_url: %Schema{type: :string, format: :uri}
55 Operation.response("Status", "application/json", %Schema{
57 example: "http://mastodon.example.org/users/admin"
63 def unfollow_operation do
65 tags: ["Admin", "Relays"],
66 summary: "Unfollow a Relay",
67 operationId: "AdminAPI.RelayController.unfollow",
68 security: [%{"oAuth" => ["write:follows"]}],
69 parameters: admin_api_params(),
71 request_body("Parameters", %Schema{
74 relay_url: %Schema{type: :string, format: :uri}
79 Operation.response("Status", "application/json", %Schema{
81 example: "http://mastodon.example.org/users/admin"