1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ApiSpec.AnnouncementOperation do
6 alias OpenApiSpex.Operation
7 alias OpenApiSpex.Schema
8 alias Pleroma.Web.ApiSpec.Schemas.Announcement
9 alias Pleroma.Web.ApiSpec.Schemas.ApiError
11 def open_api_operation(action) do
12 operation = String.to_existing_atom("#{action}_operation")
13 apply(__MODULE__, operation, [])
16 def index_operation do
18 tags: ["Announcements"],
19 summary: "Retrieve a list of announcements",
20 operationId: "MastodonAPI.AnnouncementController.index",
21 security: [%{"oAuth" => []}],
23 200 => Operation.response("Response", "application/json", list_of_announcements()),
24 403 => Operation.response("Forbidden", "application/json", ApiError)
29 def mark_read_operation do
31 tags: ["Announcements"],
32 summary: "Mark one announcement as read",
33 operationId: "MastodonAPI.AnnouncementController.mark_read",
34 security: [%{"oAuth" => ["write:accounts"]}],
44 200 => Operation.response("Response", "application/json", %Schema{type: :object}),
45 403 => Operation.response("Forbidden", "application/json", ApiError),
46 404 => Operation.response("Not Found", "application/json", ApiError)
51 def list_of_announcements do