diff options
author | Sean King <seanking2919@protonmail.com> | 2021-08-28 18:02:36 -0600 |
---|---|---|
committer | Sean King <seanking2919@protonmail.com> | 2021-08-28 18:02:36 -0600 |
commit | a14e1c0003285adce3c995f1b19a02179a556fd0 (patch) | |
tree | df4b9ef72af57e58411dd37b1cc78787d75d7a82 /lib/pleroma/web/api_spec | |
parent | eab6291094314846425339ec51fffbc94cab5501 (diff) | |
download | pleroma-a14e1c0003285adce3c995f1b19a02179a556fd0.tar.gz |
Move GET /api/v1/apps to GET /api/v1/pleroma/apps
Diffstat (limited to 'lib/pleroma/web/api_spec')
-rw-r--r-- | lib/pleroma/web/api_spec/operations/app_operation.ex | 17 | ||||
-rw-r--r-- | lib/pleroma/web/api_spec/operations/pleroma_app_operation.ex | 31 |
2 files changed, 31 insertions, 17 deletions
diff --git a/lib/pleroma/web/api_spec/operations/app_operation.ex b/lib/pleroma/web/api_spec/operations/app_operation.ex index 217609b01..5e72c4824 100644 --- a/lib/pleroma/web/api_spec/operations/app_operation.ex +++ b/lib/pleroma/web/api_spec/operations/app_operation.ex @@ -14,19 +14,6 @@ defmodule Pleroma.Web.ApiSpec.AppOperation do 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 - @spec create_operation() :: Operation.t() def create_operation do %Operation{ @@ -137,8 +124,4 @@ defmodule Pleroma.Web.ApiSpec.AppOperation do defp create_response do Operation.response("App", "application/json", App) end - - defp array_of_apps do - %Schema{type: :array, items: App, example: [App.schema().example]} - end end diff --git a/lib/pleroma/web/api_spec/operations/pleroma_app_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_app_operation.ex new file mode 100644 index 000000000..efaf81af0 --- /dev/null +++ b/lib/pleroma/web/api_spec/operations/pleroma_app_operation.ex @@ -0,0 +1,31 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/> +# 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 +end
\ No newline at end of file |