1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ApiSpec.PleromaSettingsOperation do
6 alias OpenApiSpex.Operation
7 alias OpenApiSpex.Schema
9 import Pleroma.Web.ApiSpec.Helpers
11 def open_api_operation(action) do
12 operation = String.to_existing_atom("#{action}_operation")
13 apply(__MODULE__, operation, [])
19 summary: "Get settings for an application",
20 description: "Get synchronized settings for an application",
21 operationId: "SettingsController.show",
22 parameters: [app_name_param()],
23 security: [%{"oAuth" => ["read:accounts"]}],
25 200 => Operation.response("object", "application/json", object())
30 def update_operation do
33 summary: "Update settings for an application",
34 description: "Update synchronized settings for an application",
35 operationId: "SettingsController.update",
36 parameters: [app_name_param()],
37 security: [%{"oAuth" => ["write:accounts"]}],
38 requestBody: request_body("Parameters", update_request(), required: true),
40 200 => Operation.response("object", "application/json", object())
46 Operation.parameter(:app, :path, %Schema{type: :string}, "Application name",
47 example: "pleroma-fe",
54 title: "Settings object",
55 description: "The object that contains settings for the application.",
62 title: "SettingsUpdateRequest",
65 "The settings object to be merged with the current settings. To remove a field, set it to null.",
68 "config2_to_unset" => nil