Add /api/v1/followed_tags
[akkoma] / lib / pleroma / web / api_spec / operations / tag_operation.ex
index e22457159653be66ebeab8efd89611f115f540b5..ce4f4ad5bb1ef2d9ef7b24092cd72515c3fdb22f 100644 (file)
@@ -44,7 +44,7 @@ defmodule Pleroma.Web.ApiSpec.TagOperation do
       tags: ["Tags"],
       summary: "Unfollow a hashtag",
       description: "Unfollow a hashtag",
-      security: [%{"oAuth" => ["write:follow"]}],
+      security: [%{"oAuth" => ["write:follows"]}],
       parameters: [id_param()],
       operationId: "TagController.unfollow",
       responses: %{
@@ -54,6 +54,26 @@ defmodule Pleroma.Web.ApiSpec.TagOperation do
     }
   end
 
+  def show_followed_operation do
+    %Operation{
+      tags: ["Tags"],
+      summary: "Followed hashtags",
+      description: "View a list of hashtags the currently authenticated user is following",
+      parameters: pagination_params(),
+      security: [%{"oAuth" => ["read:follows"]}],
+      operationId: "TagController.show_followed",
+      responses: %{
+        200 =>
+          Operation.response("Hashtags", "application/json", %Schema{
+            type: :array,
+            items: Tag
+          }),
+        403 => Operation.response("Forbidden", "application/json", ApiError),
+        404 => Operation.response("Not Found", "application/json", ApiError)
+      }
+    }
+  end
+
   defp id_param do
     Operation.parameter(
       :id,
@@ -62,4 +82,22 @@ defmodule Pleroma.Web.ApiSpec.TagOperation do
       "Name of the hashtag"
     )
   end
+
+  def pagination_params do
+    [
+      Operation.parameter(:max_id, :query, :integer, "Return items older than this ID"),
+      Operation.parameter(
+        :min_id,
+        :query,
+        :integer,
+        "Return the oldest items newer than this ID"
+      ),
+      Operation.parameter(
+        :limit,
+        :query,
+        %Schema{type: :integer, default: 20},
+        "Maximum number of items to return. Will be ignored if it's more than 40"
+      )
+    ]
+  end
 end