X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fapi_spec%2Foperations%2Fadmin%2Frelay_operation.ex;h=7a17072e1624de0a142f2decdad605c5c631630b;hb=2634a16b4cefebfb2a13550bde3fd12e5acd9aaa;hp=7672cb467a4d490cc1c1c173c8a87e567e647077;hpb=68cb152a0861618035ac48a0e0b455f74d9b767c;p=akkoma
diff --git a/lib/pleroma/web/api_spec/operations/admin/relay_operation.ex b/lib/pleroma/web/api_spec/operations/admin/relay_operation.ex
index 7672cb467..7a17072e1 100644
--- a/lib/pleroma/web/api_spec/operations/admin/relay_operation.ex
+++ b/lib/pleroma/web/api_spec/operations/admin/relay_operation.ex
@@ -1,5 +1,5 @@
# 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.Admin.RelayOperation do
@@ -19,6 +19,7 @@ defmodule Pleroma.Web.ApiSpec.Admin.RelayOperation do
summary: "List Relays",
operationId: "AdminAPI.RelayController.index",
security: [%{"oAuth" => ["read"]}],
+ parameters: admin_api_params(),
responses: %{
200 =>
Operation.response("Response", "application/json", %Schema{
@@ -26,8 +27,7 @@ defmodule Pleroma.Web.ApiSpec.Admin.RelayOperation do
properties: %{
relays: %Schema{
type: :array,
- items: %Schema{type: :string},
- example: ["lain.com", "mstdn.io"]
+ items: relay()
}
}
})
@@ -41,19 +41,10 @@ defmodule Pleroma.Web.ApiSpec.Admin.RelayOperation do
summary: "Follow a Relay",
operationId: "AdminAPI.RelayController.follow",
security: [%{"oAuth" => ["write:follows"]}],
- requestBody:
- request_body("Parameters", %Schema{
- type: :object,
- properties: %{
- relay_url: %Schema{type: :string, format: :uri}
- }
- }),
+ parameters: admin_api_params(),
+ requestBody: request_body("Parameters", relay_url()),
responses: %{
- 200 =>
- Operation.response("Status", "application/json", %Schema{
- type: :string,
- example: "http://mastodon.example.org/users/admin"
- })
+ 200 => Operation.response("Status", "application/json", relay())
}
}
end
@@ -64,13 +55,8 @@ defmodule Pleroma.Web.ApiSpec.Admin.RelayOperation do
summary: "Unfollow a Relay",
operationId: "AdminAPI.RelayController.unfollow",
security: [%{"oAuth" => ["write:follows"]}],
- requestBody:
- request_body("Parameters", %Schema{
- type: :object,
- properties: %{
- relay_url: %Schema{type: :string, format: :uri}
- }
- }),
+ parameters: admin_api_params(),
+ requestBody: request_body("Parameters", relay_unfollow()),
responses: %{
200 =>
Operation.response("Status", "application/json", %Schema{
@@ -80,4 +66,39 @@ defmodule Pleroma.Web.ApiSpec.Admin.RelayOperation do
}
}
end
+
+ defp relay do
+ %Schema{
+ type: :object,
+ properties: %{
+ actor: %Schema{
+ type: :string,
+ example: "https://example.com/relay"
+ },
+ followed_back: %Schema{
+ type: :boolean,
+ description: "Is relay followed back by this actor?"
+ }
+ }
+ }
+ end
+
+ defp relay_url do
+ %Schema{
+ type: :object,
+ properties: %{
+ relay_url: %Schema{type: :string, format: :uri}
+ }
+ }
+ end
+
+ defp relay_unfollow do
+ %Schema{
+ type: :object,
+ properties: %{
+ relay_url: %Schema{type: :string, format: :uri},
+ force: %Schema{type: :boolean, default: false}
+ }
+ }
+ end
end