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.PleromaNotificationOperation do
6 alias OpenApiSpex.Operation
7 alias OpenApiSpex.Schema
8 alias Pleroma.Web.ApiSpec.NotificationOperation
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 mark_as_read_operation do
18 tags: ["Notifications"],
19 summary: "Mark notifications as read. Query parameters are mutually exclusive.",
21 Operation.parameter(:id, :query, :string, "A single notification ID to read"),
22 Operation.parameter(:max_id, :query, :string, "Read all notifications up to this id")
24 security: [%{"oAuth" => ["write:notifications"]}],
25 operationId: "PleromaAPI.NotificationController.mark_as_read",
29 "A Notification or array of Motifications",
33 %Schema{type: :array, items: NotificationOperation.notification()},
34 NotificationOperation.notification()
38 400 => Operation.response("Bad Request", "application/json", ApiError)