2020-04-13 11:21:04 -06:00
|
|
|
# Pleroma: A lightweight social networking server
|
|
|
|
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.Web.ApiSpec.CustomEmojiOperation do
|
|
|
|
alias OpenApiSpex.Operation
|
2020-04-24 04:46:59 -06:00
|
|
|
alias OpenApiSpex.Schema
|
|
|
|
alias Pleroma.Web.ApiSpec.Schemas.CustomEmoji
|
2020-04-13 11:21:04 -06:00
|
|
|
|
|
|
|
def open_api_operation(action) do
|
|
|
|
operation = String.to_existing_atom("#{action}_operation")
|
|
|
|
apply(__MODULE__, operation, [])
|
|
|
|
end
|
|
|
|
|
|
|
|
def index_operation do
|
|
|
|
%Operation{
|
|
|
|
tags: ["custom_emojis"],
|
|
|
|
summary: "List custom custom emojis",
|
|
|
|
description: "Returns custom emojis that are available on the server.",
|
|
|
|
operationId: "CustomEmojiController.index",
|
|
|
|
responses: %{
|
2020-04-24 04:46:59 -06:00
|
|
|
200 => Operation.response("Custom Emojis", "application/json", custom_emojis_resposnse())
|
2020-04-13 11:21:04 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
2020-04-24 04:46:59 -06:00
|
|
|
|
|
|
|
defp custom_emojis_resposnse do
|
|
|
|
%Schema{
|
|
|
|
title: "CustomEmojisResponse",
|
|
|
|
description: "Response schema for custom emojis",
|
|
|
|
type: :array,
|
|
|
|
items: CustomEmoji,
|
|
|
|
example: [
|
|
|
|
%{
|
|
|
|
"category" => "Fun",
|
|
|
|
"shortcode" => "blank",
|
|
|
|
"static_url" => "https://lain.com/emoji/blank.png",
|
|
|
|
"tags" => ["Fun"],
|
|
|
|
"url" => "https://lain.com/emoji/blank.png",
|
|
|
|
"visible_in_picker" => false
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
"category" => "Gif,Fun",
|
|
|
|
"shortcode" => "firefox",
|
|
|
|
"static_url" => "https://lain.com/emoji/Firefox.gif",
|
|
|
|
"tags" => ["Gif", "Fun"],
|
|
|
|
"url" => "https://lain.com/emoji/Firefox.gif",
|
|
|
|
"visible_in_picker" => true
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
"category" => "pack:mixed",
|
|
|
|
"shortcode" => "sadcat",
|
|
|
|
"static_url" => "https://lain.com/emoji/mixed/sadcat.png",
|
|
|
|
"tags" => ["pack:mixed"],
|
|
|
|
"url" => "https://lain.com/emoji/mixed/sadcat.png",
|
|
|
|
"visible_in_picker" => true
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
end
|
2020-04-13 11:21:04 -06:00
|
|
|
end
|