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.PleromaNotificationOperation do
6 alias OpenApiSpex.Operation
7 alias OpenApiSpex.Schema
8 alias Pleroma.Web.ApiSpec.NotificationOperation
9 alias Pleroma.Web.ApiSpec.Schemas.ApiError
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 mark_as_read_operation do
20 tags: ["Notifications"],
21 summary: "Mark notifications as read",
22 description: "Query parameters are mutually exclusive.",
24 request_body("Parameters", %Schema{
27 id: %Schema{type: :integer, description: "A single notification ID to read"},
28 max_id: %Schema{type: :integer, description: "Read all notifications up to this ID"}
31 security: [%{"oAuth" => ["write:notifications"]}],
32 operationId: "PleromaAPI.NotificationController.mark_as_read",
36 "A Notification or array of Notifications",
40 %Schema{type: :array, items: NotificationOperation.notification()},
41 NotificationOperation.notification()
45 400 => Operation.response("Bad Request", "application/json", ApiError)