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.DomainBlockOperation do
6 alias OpenApiSpex.Operation
7 alias OpenApiSpex.Schema
8 alias Pleroma.Web.ApiSpec.Helpers
9 alias Pleroma.Web.ApiSpec.Schemas.DomainBlockRequest
10 alias Pleroma.Web.ApiSpec.Schemas.DomainBlocksResponse
12 def open_api_operation(action) do
13 operation = String.to_existing_atom("#{action}_operation")
14 apply(__MODULE__, operation, [])
17 def index_operation do
19 tags: ["domain_blocks"],
20 summary: "Fetch domain blocks",
21 description: "View domains the user has blocked.",
22 security: [%{"oAuth" => ["follow", "read:blocks"]}],
23 operationId: "DomainBlockController.index",
25 200 => Operation.response("Domain blocks", "application/json", DomainBlocksResponse)
30 def create_operation do
32 tags: ["domain_blocks"],
33 summary: "Block a domain",
37 - hide all public posts from it
38 - hide all notifications from it
39 - remove all followers from it
40 - prevent following new users from it (but does not remove existing follows)
42 operationId: "DomainBlockController.create",
43 requestBody: Helpers.request_body("Parameters", DomainBlockRequest, required: true),
44 security: [%{"oAuth" => ["follow", "write:blocks"]}],
46 200 => Operation.response("Empty object", "application/json", %Schema{type: :object})
51 def delete_operation do
53 tags: ["domain_blocks"],
54 summary: "Unblock a domain",
55 description: "Remove a domain block, if it exists in the user's array of blocked domains.",
56 operationId: "DomainBlockController.delete",
57 requestBody: Helpers.request_body("Parameters", DomainBlockRequest, required: true),
58 security: [%{"oAuth" => ["follow", "write:blocks"]}],
60 200 => Operation.response("Empty object", "application/json", %Schema{type: :object})