Merge branch 'develop' into activation-meta
[akkoma] / lib / pleroma / web / api_spec / helpers.ex
index ee077a3f9e79b103ed2225f8a847bedb4639ca21..a258e8421c6e6877145ba85e76bec2e0094bd629 100644 (file)
@@ -5,6 +5,7 @@
 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"]
@@ -38,6 +39,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 +54,12 @@ defmodule Pleroma.Web.ApiSpec.Helpers do
     ]
   end
 
-  def embed_relationships_param do
+  def with_relationships_param do
     Operation.parameter(
-      :embed_relationships,
+      :with_relationships,
       :query,
-      :boolean,
-      "Embed relationships into accounts (Pleroma extension)"
+      BooleanLike,
+      "Embed relationships into accounts."
     )
   end
 
@@ -63,4 +70,8 @@ defmodule Pleroma.Web.ApiSpec.Helpers do
   def empty_array_response do
     Operation.response("Empty array", "application/json", %Schema{type: :array, example: []})
   end
+
+  def no_content_response do
+    Operation.response("No Content", "application/json", %Schema{type: :string, example: ""})
+  end
 end