Merge branch 'develop' of https://git.pleroma.social/pleroma/pleroma into develop
[akkoma] / lib / pleroma / web / api_spec / operations / admin / frontend_operation.ex
index 24d23a4e00fe853da5da773aed0eef56f64d55a2..566f1eeb1b0927670add4b80089fe1e4b20264ef 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.Admin.FrontendOperation do
@@ -16,10 +16,10 @@ defmodule Pleroma.Web.ApiSpec.Admin.FrontendOperation do
 
   def index_operation do
     %Operation{
-      tags: ["Admin", "Reports"],
-      summary: "Get a list of available frontends",
+      tags: ["Frontend managment"],
+      summary: "Retrieve a list of available frontends",
       operationId: "AdminAPI.FrontendController.index",
-      security: [%{"oAuth" => ["read"]}],
+      security: [%{"oAuth" => ["admin:read"]}],
       responses: %{
         200 => Operation.response("Response", "application/json", list_of_frontends()),
         403 => Operation.response("Forbidden", "application/json", ApiError)
@@ -29,14 +29,15 @@ defmodule Pleroma.Web.ApiSpec.Admin.FrontendOperation do
 
   def install_operation do
     %Operation{
-      tags: ["Admin", "Reports"],
+      tags: ["Frontend managment"],
       summary: "Install a frontend",
       operationId: "AdminAPI.FrontendController.install",
-      security: [%{"oAuth" => ["read"]}],
+      security: [%{"oAuth" => ["admin:read"]}],
       requestBody: request_body("Parameters", install_request(), required: true),
       responses: %{
         200 => Operation.response("Response", "application/json", list_of_frontends()),
-        403 => Operation.response("Forbidden", "application/json", ApiError)
+        403 => Operation.response("Forbidden", "application/json", ApiError),
+        400 => Operation.response("Error", "application/json", ApiError)
       }
     }
   end
@@ -49,7 +50,7 @@ defmodule Pleroma.Web.ApiSpec.Admin.FrontendOperation do
         properties: %{
           name: %Schema{type: :string},
           git: %Schema{type: :string, format: :uri, nullable: true},
-          build_url: %Schema{type: :string, format: :uri},
+          build_url: %Schema{type: :string, format: :uri, nullable: true},
           ref: %Schema{type: :string},
           installed: %Schema{type: :boolean}
         }
@@ -64,12 +65,19 @@ defmodule Pleroma.Web.ApiSpec.Admin.FrontendOperation do
       required: [:name],
       properties: %{
         name: %Schema{
-          type: :string,
-          nullable: false
+          type: :string
         },
         ref: %Schema{
-          type: :string,
-          nullable: false
+          type: :string
+        },
+        file: %Schema{
+          type: :string
+        },
+        build_url: %Schema{
+          type: :string
+        },
+        build_dir: %Schema{
+          type: :string
         }
       }
     }