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.ConversationOperation do
6 alias OpenApiSpex.Operation
7 alias OpenApiSpex.Schema
8 alias Pleroma.Web.ApiSpec.Schemas.Conversation
9 alias Pleroma.Web.ApiSpec.Schemas.FlakeID
11 import Pleroma.Web.ApiSpec.Helpers
13 def open_api_operation(action) do
14 operation = String.to_existing_atom("#{action}_operation")
15 apply(__MODULE__, operation, [])
18 def index_operation do
20 tags: ["Conversations"],
21 summary: "Show conversation",
22 security: [%{"oAuth" => ["read:statuses"]}],
23 operationId: "ConversationController.index",
28 %Schema{type: :array, items: FlakeID},
29 "Only return conversations with the given recipients (a list of user ids)"
35 Operation.response("Array of Conversation", "application/json", %Schema{
38 example: [Conversation.schema().example]
44 def mark_as_read_operation do
46 tags: ["Conversations"],
47 summary: "Mark as read",
48 operationId: "ConversationController.mark_as_read",
50 Operation.parameter(:id, :path, :string, "Conversation ID",
55 security: [%{"oAuth" => ["write:conversations"]}],
57 200 => Operation.response("Conversation", "application/json", Conversation)