X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpleroma%2Fweb%2Fapi_spec%2Fhelpers.ex;h=6f67339e61a021e48efef0d86ad5bfbb8c68f6b4;hb=0fb2042f2c5f8a0ad922fa565051caab129bb5cd;hp=f0b558aa533aa25ff23aa199288fcefa40112c58;hpb=39ec1af9936e96f7885a58c9d77f3711091a80b1;p=akkoma
diff --git a/lib/pleroma/web/api_spec/helpers.ex b/lib/pleroma/web/api_spec/helpers.ex
index f0b558aa5..6f67339e6 100644
--- a/lib/pleroma/web/api_spec/helpers.ex
+++ b/lib/pleroma/web/api_spec/helpers.ex
@@ -1,10 +1,11 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ApiSpec.Helpers do
alias OpenApiSpex.Operation
alias OpenApiSpex.Schema
+ alias Pleroma.Web.ApiSpec.Schemas.BooleanLike
def request_body(description, schema_ref, opts \\ []) do
media_types = ["application/json", "multipart/form-data", "application/x-www-form-urlencoded"]
@@ -28,6 +29,10 @@ defmodule Pleroma.Web.ApiSpec.Helpers do
}
end
+ def admin_api_params do
+ [Operation.parameter(:admin_token, :query, :string, "Allows authorization via admin token.")]
+ end
+
def pagination_params do
[
Operation.parameter(:max_id, :query, :string, "Return items older than this ID"),
@@ -38,6 +43,12 @@ defmodule Pleroma.Web.ApiSpec.Helpers do
:string,
"Return the newest items newer than this ID"
),
+ Operation.parameter(
+ :offset,
+ :query,
+ %Schema{type: :integer, default: 0},
+ "Return items past this number of items"
+ ),
Operation.parameter(
:limit,
:query,
@@ -47,12 +58,25 @@ defmodule Pleroma.Web.ApiSpec.Helpers do
]
end
+ def with_relationships_param do
+ Operation.parameter(
+ :with_relationships,
+ :query,
+ BooleanLike,
+ "Embed relationships into accounts. **If this parameter is not set account's `pleroma.relationship` is going to be `null`.**"
+ )
+ end
+
def empty_object_response do
Operation.response("Empty object", "application/json", %Schema{type: :object, example: %{}})
end
def empty_array_response do
- Operation.response("Empty array", "application/json", %Schema{type: :array, example: []})
+ Operation.response("Empty array", "application/json", %Schema{
+ type: :array,
+ items: %Schema{type: :object, example: %{}},
+ example: []
+ })
end
def no_content_response do