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.ChatOperation do
6 alias OpenApiSpex.Operation
7 alias Pleroma.Web.ApiSpec.Schemas.ApiError
8 alias Pleroma.Web.ApiSpec.Schemas.FlakeID
10 import Pleroma.Web.ApiSpec.Helpers
12 def open_api_operation(action) do
13 operation = String.to_existing_atom("#{action}_operation")
14 apply(__MODULE__, operation, [])
17 def delete_message_operation do
19 tags: ["Admin", "Chats"],
20 summary: "Delete an individual chat message",
21 operationId: "AdminAPI.ChatController.delete",
22 parameters: [id_param(), message_id_param()] ++ admin_api_params(),
23 security: [%{"oAuth" => ["write:chats"]}],
25 200 => empty_object_response(),
26 404 => Operation.response("Not Found", "application/json", ApiError)
32 Operation.parameter(:id, :path, FlakeID, "Chat ID",
33 example: "9umDrYheeY451cQnEe",
38 def message_id_param do
39 Operation.parameter(:message_id, :path, FlakeID, "Chat message ID",
40 example: "9umDrYheeY451cQnEe",