1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ApiSpec.PleromaMascotOperation do
6 alias OpenApiSpex.Operation
7 alias OpenApiSpex.Schema
8 alias Pleroma.Web.ApiSpec.Schemas.ApiError
10 import Pleroma.Web.ApiSpec.Helpers
12 def open_api_operation(action) do
13 operation = String.to_existing_atom("#{action}_operation")
14 apply(__MODULE__, operation, [])
20 summary: "Retrieve mascot",
21 security: [%{"oAuth" => ["read:accounts"]}],
22 operationId: "PleromaAPI.MascotController.show",
24 200 => Operation.response("Mascot", "application/json", mascot())
29 def update_operation do
32 summary: "Set or clear mascot",
34 "Behaves exactly the same as `POST /api/v1/upload`. Can only accept images - any attempt to upload non-image files will be met with `HTTP 415 Unsupported Media Type`.",
35 operationId: "PleromaAPI.MascotController.update",
42 file: %Schema{type: :string, format: :binary}
47 security: [%{"oAuth" => ["write:accounts"]}],
49 200 => Operation.response("Mascot", "application/json", mascot()),
50 415 => Operation.response("Unsupported Media Type", "application/json", ApiError)
59 id: %Schema{type: :string},
60 url: %Schema{type: :string, format: :uri},
61 type: %Schema{type: :string},
65 mime_type: %Schema{type: :string}
71 "url" => "https://pleroma.example.org/media/abcdefg.png",
74 "mime_type" => "image/png"