logo

pleroma

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

directory_operation.ex (1295B)


  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.DirectoryOperation do
  5. alias OpenApiSpex.Operation
  6. alias Pleroma.Web.ApiSpec.AccountOperation
  7. alias Pleroma.Web.ApiSpec.Schemas.ApiError
  8. alias Pleroma.Web.ApiSpec.Schemas.BooleanLike
  9. import Pleroma.Web.ApiSpec.Helpers
  10. def open_api_operation(action) do
  11. operation = String.to_existing_atom("#{action}_operation")
  12. apply(__MODULE__, operation, [])
  13. end
  14. def index_operation do
  15. %Operation{
  16. tags: ["Others"],
  17. summary: "Profile directory",
  18. operationId: "DirectoryController.index",
  19. parameters:
  20. [
  21. Operation.parameter(
  22. :order,
  23. :query,
  24. :string,
  25. "Order by recent activity or account creation",
  26. required: nil
  27. ),
  28. Operation.parameter(:local, :query, BooleanLike.schema(), "Include local users only")
  29. ] ++ pagination_params(),
  30. responses: %{
  31. 200 =>
  32. Operation.response("Accounts", "application/json", AccountOperation.array_of_accounts()),
  33. 404 => Operation.response("Not Found", "application/json", ApiError)
  34. }
  35. }
  36. end
  37. end