1 defmodule Pleroma.Web.ApiSpec.TranslationOperation do
2 alias OpenApiSpex.Operation
3 alias OpenApiSpex.Schema
5 @spec open_api_operation(atom) :: Operation.t()
6 def open_api_operation(action) do
7 operation = String.to_existing_atom("#{action}_operation")
8 apply(__MODULE__, operation, [])
11 @spec languages_operation() :: Operation.t()
12 def languages_operation() do
14 tags: ["Retrieve status translation"],
15 summary: "Translate status",
16 description: "View the translation of a given status",
17 operationId: "AkkomaAPI.TranslationController.languages",
18 security: [%{"oAuth" => ["read:statuses"]}],
21 Operation.response("Translation", "application/json", source_dest_languages_schema())
26 defp source_dest_languages_schema do
29 required: [:source, :target],
31 source: languages_schema(),
32 target: languages_schema()
37 defp languages_schema do