Merge pull request 'Remove refences to ARM OTP builds in install guide' (#432) from...
[akkoma] / lib / pleroma / web / api_spec / helpers.ex
index 859e45b57ed67fc2069e82788e863f230ebbd4c8..6f67339e61a021e48efef0d86ad5bfbb8c68f6b4 100644 (file)
@@ -1,5 +1,5 @@
 # Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Web.ApiSpec.Helpers do
@@ -29,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"),
@@ -39,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,
@@ -49,7 +59,12 @@ defmodule Pleroma.Web.ApiSpec.Helpers do
   end
 
   def with_relationships_param do
-    Operation.parameter(:with_relationships, :query, BooleanLike, "Include relationships")
+    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
@@ -57,6 +72,14 @@ defmodule Pleroma.Web.ApiSpec.Helpers do
   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
+    Operation.response("No Content", "application/json", %Schema{type: :string, example: ""})
   end
 end