logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

pleroma_app_operation.ex (949B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Web.ApiSpec.PleromaAppOperation do
  5. alias OpenApiSpex.Operation
  6. alias OpenApiSpex.Schema
  7. alias Pleroma.Web.ApiSpec.Schemas.App
  8. def open_api_operation(action) do
  9. operation = String.to_existing_atom("#{action}_operation")
  10. apply(__MODULE__, operation, [])
  11. end
  12. @spec index_operation() :: Operation.t()
  13. def index_operation do
  14. %Operation{
  15. tags: ["Applications"],
  16. summary: "List applications",
  17. description: "List the OAuth applications for the current user",
  18. operationId: "AppController.index",
  19. responses: %{
  20. 200 => Operation.response("Array of App", "application/json", array_of_apps())
  21. }
  22. }
  23. end
  24. defp array_of_apps do
  25. %Schema{type: :array, items: App, example: [App.schema().example]}
  26. end
  27. end