2020-05-19 17:52:26 +00:00
|
|
|
# Pleroma: A lightweight social networking server
|
2023-01-02 20:38:50 +00:00
|
|
|
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
2020-05-19 17:52:26 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-05-20 11:14:11 +00:00
|
|
|
defmodule Pleroma.Web.ApiSpec.PleromaNotificationOperation do
|
2020-05-19 17:52:26 +00:00
|
|
|
alias OpenApiSpex.Operation
|
|
|
|
alias OpenApiSpex.Schema
|
2020-05-19 19:50:49 +00:00
|
|
|
alias Pleroma.Web.ApiSpec.NotificationOperation
|
2020-05-19 17:52:26 +00:00
|
|
|
alias Pleroma.Web.ApiSpec.Schemas.ApiError
|
|
|
|
|
2020-05-22 14:15:36 +00:00
|
|
|
import Pleroma.Web.ApiSpec.Helpers
|
|
|
|
|
2020-05-19 17:52:26 +00:00
|
|
|
def open_api_operation(action) do
|
|
|
|
operation = String.to_existing_atom("#{action}_operation")
|
|
|
|
apply(__MODULE__, operation, [])
|
|
|
|
end
|
|
|
|
|
2020-05-20 11:14:11 +00:00
|
|
|
def mark_as_read_operation do
|
2020-05-19 17:52:26 +00:00
|
|
|
%Operation{
|
|
|
|
tags: ["Notifications"],
|
2021-02-03 12:38:59 +00:00
|
|
|
summary: "Mark notifications as read",
|
|
|
|
description: "Query parameters are mutually exclusive.",
|
2020-05-22 14:15:36 +00:00
|
|
|
requestBody:
|
|
|
|
request_body("Parameters", %Schema{
|
|
|
|
type: :object,
|
|
|
|
properties: %{
|
Pleroma.Web.PleromaAPI.NotificationController: dialyzer errors
lib/pleroma/web/pleroma_api/controllers/user_import_controller.ex:53:call
The function call will not succeed.
Phoenix.Controller.json(
_conn :: %{
:assigns => %{:user => _, _ => _},
:body_params => %{:list => _, _ => _},
_ => _
},
<<106, 111, 98, 32, 115, 116, 97, 114, 116, 101, 100>>
)
breaks the contract
(Plug.Conn.t(), term()) :: Plug.Conn.t()
2024-01-27 21:02:26 +00:00
|
|
|
"id" => %Schema{type: :integer, description: "A single notification ID to read"},
|
|
|
|
"max_id" => %Schema{
|
|
|
|
type: :integer,
|
|
|
|
description: "Read all notifications up to this ID"
|
|
|
|
}
|
2020-05-22 14:15:36 +00:00
|
|
|
}
|
|
|
|
}),
|
2020-05-19 17:52:26 +00:00
|
|
|
security: [%{"oAuth" => ["write:notifications"]}],
|
2020-05-20 11:14:11 +00:00
|
|
|
operationId: "PleromaAPI.NotificationController.mark_as_read",
|
2020-05-19 17:52:26 +00:00
|
|
|
responses: %{
|
|
|
|
200 =>
|
|
|
|
Operation.response(
|
2021-02-03 12:38:59 +00:00
|
|
|
"A Notification or array of Notifications",
|
2020-05-19 17:52:26 +00:00
|
|
|
"application/json",
|
|
|
|
%Schema{
|
|
|
|
anyOf: [
|
|
|
|
%Schema{type: :array, items: NotificationOperation.notification()},
|
|
|
|
NotificationOperation.notification()
|
|
|
|
]
|
|
|
|
}
|
|
|
|
),
|
|
|
|
400 => Operation.response("Bad Request", "application/json", ApiError)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|