2021-12-26 02:35:17 +00:00
|
|
|
# Pleroma: A lightweight social networking server
|
2023-01-02 20:38:50 +00:00
|
|
|
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
2021-12-26 02:35:17 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.Web.ApiSpec.DirectoryOperation do
|
|
|
|
alias OpenApiSpex.Operation
|
|
|
|
alias Pleroma.Web.ApiSpec.AccountOperation
|
|
|
|
alias Pleroma.Web.ApiSpec.Schemas.ApiError
|
|
|
|
alias Pleroma.Web.ApiSpec.Schemas.BooleanLike
|
|
|
|
|
|
|
|
import Pleroma.Web.ApiSpec.Helpers
|
|
|
|
|
|
|
|
def open_api_operation(action) do
|
|
|
|
operation = String.to_existing_atom("#{action}_operation")
|
|
|
|
apply(__MODULE__, operation, [])
|
|
|
|
end
|
|
|
|
|
|
|
|
def index_operation do
|
|
|
|
%Operation{
|
2023-01-15 23:31:37 +00:00
|
|
|
tags: ["Others"],
|
2021-12-26 02:35:17 +00:00
|
|
|
summary: "Profile directory",
|
|
|
|
operationId: "DirectoryController.index",
|
|
|
|
parameters:
|
|
|
|
[
|
|
|
|
Operation.parameter(
|
|
|
|
:order,
|
|
|
|
:query,
|
|
|
|
:string,
|
|
|
|
"Order by recent activity or account creation",
|
|
|
|
required: nil
|
|
|
|
),
|
2024-01-29 22:10:28 +00:00
|
|
|
Operation.parameter(:local, :query, BooleanLike.schema(), "Include local users only")
|
2021-12-26 02:35:17 +00:00
|
|
|
] ++ pagination_params(),
|
|
|
|
responses: %{
|
|
|
|
200 =>
|
|
|
|
Operation.response("Accounts", "application/json", AccountOperation.array_of_accounts()),
|
|
|
|
404 => Operation.response("Not Found", "application/json", ApiError)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|