X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpleroma%2Fweb%2Fapi_spec%2Foperations%2Fadmin%2Fmedia_proxy_cache_operation.ex;h=8f85ebf2debd5fc3cbc5f3e2e5774191b301f9f2;hb=96fe4dd4e2de5d1211e0dbe9f09be502bc46e0da;hp=0358cfbad8ae095d5583eef03161987fbec4f2c7;hpb=0883a706dc376fdfb7de9df1366803e87c8e7c98;p=akkoma
diff --git a/lib/pleroma/web/api_spec/operations/admin/media_proxy_cache_operation.ex b/lib/pleroma/web/api_spec/operations/admin/media_proxy_cache_operation.ex
index 0358cfbad..8f85ebf2d 100644
--- a/lib/pleroma/web/api_spec/operations/admin/media_proxy_cache_operation.ex
+++ b/lib/pleroma/web/api_spec/operations/admin/media_proxy_cache_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.MediaProxyCacheOperation do
@@ -16,11 +16,17 @@ defmodule Pleroma.Web.ApiSpec.Admin.MediaProxyCacheOperation do
def index_operation do
%Operation{
- tags: ["Admin", "MediaProxyCache"],
- summary: "Fetch a paginated list of all banned MediaProxy URLs in Cachex",
+ tags: ["MediaProxy cache"],
+ summary: "Retrieve a list of banned MediaProxy URLs",
operationId: "AdminAPI.MediaProxyCacheController.index",
- security: [%{"oAuth" => ["read:media_proxy_caches"]}],
+ security: [%{"oAuth" => ["admin:read:media_proxy_caches"]}],
parameters: [
+ Operation.parameter(
+ :query,
+ :query,
+ %Schema{type: :string, default: nil},
+ "Page"
+ ),
Operation.parameter(
:page,
:query,
@@ -33,19 +39,40 @@ defmodule Pleroma.Web.ApiSpec.Admin.MediaProxyCacheOperation do
%Schema{type: :integer, default: 50},
"Number of statuses to return"
)
+ | admin_api_params()
],
responses: %{
- 200 => success_response()
+ 200 =>
+ Operation.response(
+ "Array of MediaProxy URLs",
+ "application/json",
+ %Schema{
+ type: :object,
+ properties: %{
+ count: %Schema{type: :integer},
+ page_size: %Schema{type: :integer},
+ urls: %Schema{
+ type: :array,
+ items: %Schema{
+ type: :string,
+ format: :uri,
+ description: "MediaProxy URLs"
+ }
+ }
+ }
+ }
+ )
}
}
end
def delete_operation do
%Operation{
- tags: ["Admin", "MediaProxyCache"],
- summary: "Remove a banned MediaProxy URL from Cachex",
+ tags: ["MediaProxy cache"],
+ summary: "Remove a banned MediaProxy URL",
operationId: "AdminAPI.MediaProxyCacheController.delete",
- security: [%{"oAuth" => ["write:media_proxy_caches"]}],
+ security: [%{"oAuth" => ["admin:write:media_proxy_caches"]}],
+ parameters: admin_api_params(),
requestBody:
request_body(
"Parameters",
@@ -59,7 +86,7 @@ defmodule Pleroma.Web.ApiSpec.Admin.MediaProxyCacheOperation do
required: true
),
responses: %{
- 200 => success_response(),
+ 200 => empty_object_response(),
400 => Operation.response("Error", "application/json", ApiError)
}
}
@@ -67,10 +94,11 @@ defmodule Pleroma.Web.ApiSpec.Admin.MediaProxyCacheOperation do
def purge_operation do
%Operation{
- tags: ["Admin", "MediaProxyCache"],
- summary: "Purge and optionally ban a MediaProxy URL",
+ tags: ["MediaProxy cache"],
+ summary: "Purge a URL from MediaProxy cache and optionally ban it",
operationId: "AdminAPI.MediaProxyCacheController.purge",
- security: [%{"oAuth" => ["write:media_proxy_caches"]}],
+ security: [%{"oAuth" => ["admin:write:media_proxy_caches"]}],
+ parameters: admin_api_params(),
requestBody:
request_body(
"Parameters",
@@ -85,25 +113,9 @@ defmodule Pleroma.Web.ApiSpec.Admin.MediaProxyCacheOperation do
required: true
),
responses: %{
- 200 => success_response(),
+ 200 => empty_object_response(),
400 => Operation.response("Error", "application/json", ApiError)
}
}
end
-
- defp success_response do
- Operation.response("Array of banned MediaProxy URLs in Cachex", "application/json", %Schema{
- type: :object,
- properties: %{
- urls: %Schema{
- type: :array,
- items: %Schema{
- type: :string,
- format: :uri,
- description: "MediaProxy URLs"
- }
- }
- }
- })
- end
end