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.ChatOperation do
6 alias OpenApiSpex.Operation
7 alias OpenApiSpex.Schema
9 @spec open_api_operation(atom) :: Operation.t()
10 def open_api_operation(action) do
11 operation = String.to_existing_atom("#{action}_operation")
12 apply(__MODULE__, operation, [])
15 def create_operation do
18 summary: "Create a chat",
21 Operation.response("Chat", "application/json", %Schema{
23 description: "A created chat is returned",
25 id: %Schema{type: :integer}
32 def index_operation do
35 summary: "Get a list of chats that you participated in",
38 Operation.response("Chats", "application/json", %Schema{
40 description: "A list of chats",
50 def messages_operation do
53 summary: "Get the most recent messages of the chat",
56 Operation.response("Messages", "application/json", %Schema{
58 description: "A list of chat messages",
61 description: "A chat message"
68 def post_chat_message_operation do
71 summary: "Post a message to the chat",
74 Operation.response("Message", "application/json", %Schema{
76 description: "A chat message"