1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ApiSpec.Admin.StatusOperation do
6 alias OpenApiSpex.Operation
7 alias OpenApiSpex.Schema
8 alias Pleroma.Web.ApiSpec.Schemas.Account
9 alias Pleroma.Web.ApiSpec.Schemas.ApiError
10 alias Pleroma.Web.ApiSpec.Schemas.FlakeID
11 alias Pleroma.Web.ApiSpec.Schemas.Status
12 alias Pleroma.Web.ApiSpec.Schemas.VisibilityScope
14 import Pleroma.Web.ApiSpec.Helpers
15 import Pleroma.Web.ApiSpec.StatusOperation, only: [id_param: 0]
17 def open_api_operation(action) do
18 operation = String.to_existing_atom("#{action}_operation")
19 apply(__MODULE__, operation, [])
22 def index_operation do
24 tags: ["Admin", "Statuses"],
25 operationId: "AdminAPI.StatusController.index",
26 security: [%{"oAuth" => ["read:statuses"]}],
31 %Schema{type: :boolean, default: false},
32 "Allows to see private statuses"
37 %Schema{type: :boolean, default: false},
38 "Excludes remote statuses"
43 %Schema{type: :boolean, default: false},
44 "Allows to see reblogs"
49 %Schema{type: :integer, default: 1},
55 %Schema{type: :integer, default: 50},
56 "Number of statuses to return"
62 Operation.response("Array of statuses", "application/json", %Schema{
72 tags: ["Admin", "Statuses"],
73 summary: "Show Status",
74 operationId: "AdminAPI.StatusController.show",
75 parameters: [id_param() | admin_api_params()],
76 security: [%{"oAuth" => ["read:statuses"]}],
78 200 => Operation.response("Status", "application/json", status()),
79 404 => Operation.response("Not Found", "application/json", ApiError)
84 def update_operation do
86 tags: ["Admin", "Statuses"],
87 summary: "Change the scope of an individual reported status",
88 operationId: "AdminAPI.StatusController.update",
89 parameters: [id_param() | admin_api_params()],
90 security: [%{"oAuth" => ["write:statuses"]}],
91 requestBody: request_body("Parameters", update_request(), required: true),
93 200 => Operation.response("Status", "application/json", Status),
94 400 => Operation.response("Error", "application/json", ApiError)
99 def delete_operation do
101 tags: ["Admin", "Statuses"],
102 summary: "Delete an individual reported status",
103 operationId: "AdminAPI.StatusController.delete",
104 parameters: [id_param() | admin_api_params()],
105 security: [%{"oAuth" => ["write:statuses"]}],
107 200 => empty_object_response(),
108 404 => Operation.response("Not Found", "application/json", ApiError)
120 account: %Schema{allOf: [Account, admin_account()]}
132 avatar: %Schema{type: :string},
133 nickname: %Schema{type: :string},
134 display_name: %Schema{type: :string},
135 deactivated: %Schema{type: :boolean},
136 local: %Schema{type: :boolean},
140 admin: %Schema{type: :boolean},
141 moderator: %Schema{type: :boolean}
144 tags: %Schema{type: :string},
145 is_confirmed: %Schema{type: :string}
150 defp update_request do
156 description: "Mark status and attached media as sensitive?"
158 visibility: VisibilityScope
161 "visibility" => "private",
162 "sensitive" => "false"