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.Chat
8 alias Pleroma.Web.ApiSpec.Schemas.ChatMessage
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", "chat"],
20 summary: "Delete an individual chat message",
21 operationId: "AdminAPI.ChatController.delete_message",
23 Operation.parameter(:id, :path, :string, "The ID of the Chat"),
24 Operation.parameter(:message_id, :path, :string, "The ID of the message")
29 "The deleted ChatMessage",
36 "oAuth" => ["write:chats"]
42 def messages_operation do
44 tags: ["admin", "chat"],
45 summary: "Get the most recent messages of the chat",
46 operationId: "AdminAPI.ChatController.messages",
48 [Operation.parameter(:id, :path, :string, "The ID of the Chat")] ++
53 "The messages in the chat",
55 Pleroma.Web.ApiSpec.ChatOperation.chat_messages_response()
60 "oAuth" => ["read:chats"]
69 summary: "Create a chat",
70 operationId: "AdminAPI.ChatController.show",