2021-08-29 00:02:36 +00:00
|
|
|
# Pleroma: A lightweight social networking server
|
2023-01-01 11:11:47 +00:00
|
|
|
# Copyright © 2017-2023 Pleroma Authors <https://pleroma.social/>
|
2021-08-29 00:02:36 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.Web.ApiSpec.PleromaAppOperation do
|
|
|
|
alias OpenApiSpex.Operation
|
|
|
|
alias OpenApiSpex.Schema
|
|
|
|
alias Pleroma.Web.ApiSpec.Schemas.App
|
|
|
|
|
|
|
|
def open_api_operation(action) do
|
|
|
|
operation = String.to_existing_atom("#{action}_operation")
|
|
|
|
apply(__MODULE__, operation, [])
|
|
|
|
end
|
|
|
|
|
|
|
|
@spec index_operation() :: Operation.t()
|
|
|
|
def index_operation do
|
|
|
|
%Operation{
|
|
|
|
tags: ["Applications"],
|
|
|
|
summary: "List applications",
|
|
|
|
description: "List the OAuth applications for the current user",
|
|
|
|
operationId: "AppController.index",
|
|
|
|
responses: %{
|
|
|
|
200 => Operation.response("Array of App", "application/json", array_of_apps())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
defp array_of_apps do
|
|
|
|
%Schema{type: :array, items: App, example: [App.schema().example]}
|
|
|
|
end
|
2021-08-29 00:17:09 +00:00
|
|
|
end
|