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.PleromaConversationOperation do
6 alias OpenApiSpex.Operation
7 alias OpenApiSpex.Schema
8 alias Pleroma.Web.ApiSpec.Schemas.Conversation
9 alias Pleroma.Web.ApiSpec.Schemas.FlakeID
10 alias Pleroma.Web.ApiSpec.StatusOperation
12 import Pleroma.Web.ApiSpec.Helpers
14 def open_api_operation(action) do
15 operation = String.to_existing_atom("#{action}_operation")
16 apply(__MODULE__, operation, [])
21 tags: ["Conversations"],
22 summary: "Conversation",
24 Operation.parameter(:id, :path, :string, "Conversation ID",
29 security: [%{"oAuth" => ["read:statuses"]}],
30 operationId: "PleromaAPI.ConversationController.show",
32 200 => Operation.response("Conversation", "application/json", Conversation)
37 def statuses_operation do
39 tags: ["Conversations"],
40 summary: "Timeline for conversation",
42 Operation.parameter(:id, :path, :string, "Conversation ID",
48 security: [%{"oAuth" => ["read:statuses"]}],
49 operationId: "PleromaAPI.ConversationController.statuses",
55 StatusOperation.array_of_statuses()
61 def update_operation do
63 tags: ["Conversations"],
64 summary: "Update conversation",
65 description: "Change set of recipients for the conversation.",
67 Operation.parameter(:id, :path, :string, "Conversation ID",
74 %Schema{type: :array, items: FlakeID},
75 "A list of ids of users that should receive posts to this conversation. This will replace the current list of recipients, so submit the full list. The owner of owner of the conversation will always be part of the set of recipients, though.",
79 security: [%{"oAuth" => ["write:conversations"]}],
80 operationId: "PleromaAPI.ConversationController.update",
82 200 => Operation.response("Conversation", "application/json", Conversation)
87 def mark_as_read_operation do
89 tags: ["Conversations"],
90 summary: "Marks all conversations as read",
91 security: [%{"oAuth" => ["write:conversations"]}],
92 operationId: "PleromaAPI.ConversationController.mark_as_read",
96 "Array of Conversations that were marked as read",
101 example: [Conversation.schema().example]