mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-24 00:50:29 +00:00
Rename EmojiAPIController to EmojiPackController
This commit is contained in:
parent
8bde8dfec2
commit
aef31c69df
4 changed files with 28 additions and 28 deletions
|
@ -2,7 +2,7 @@
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Web.ApiSpec.PleromaEmojiOperation do
|
defmodule Pleroma.Web.ApiSpec.PleromaEmojiPackOperation do
|
||||||
alias OpenApiSpex.Operation
|
alias OpenApiSpex.Operation
|
||||||
alias OpenApiSpex.Schema
|
alias OpenApiSpex.Schema
|
||||||
alias Pleroma.Web.ApiSpec.Schemas.ApiError
|
alias Pleroma.Web.ApiSpec.Schemas.ApiError
|
||||||
|
@ -20,7 +20,7 @@ defmodule Pleroma.Web.ApiSpec.PleromaEmojiOperation do
|
||||||
summary: "Make request to another instance for emoji packs list",
|
summary: "Make request to another instance for emoji packs list",
|
||||||
security: [%{"oAuth" => ["write"]}],
|
security: [%{"oAuth" => ["write"]}],
|
||||||
parameters: [url_param()],
|
parameters: [url_param()],
|
||||||
operationId: "PleromaAPI.EmojiAPIController.remote",
|
operationId: "PleromaAPI.EmojiPackController.remote",
|
||||||
responses: %{
|
responses: %{
|
||||||
200 => emoji_packs_response(),
|
200 => emoji_packs_response(),
|
||||||
500 => Operation.response("Error", "application/json", ApiError)
|
500 => Operation.response("Error", "application/json", ApiError)
|
||||||
|
@ -32,7 +32,7 @@ defmodule Pleroma.Web.ApiSpec.PleromaEmojiOperation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["Emoji Packs"],
|
tags: ["Emoji Packs"],
|
||||||
summary: "Lists local custom emoji packs",
|
summary: "Lists local custom emoji packs",
|
||||||
operationId: "PleromaAPI.EmojiAPIController.index",
|
operationId: "PleromaAPI.EmojiPackController.index",
|
||||||
responses: %{
|
responses: %{
|
||||||
200 => emoji_packs_response()
|
200 => emoji_packs_response()
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ defmodule Pleroma.Web.ApiSpec.PleromaEmojiOperation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["Emoji Packs"],
|
tags: ["Emoji Packs"],
|
||||||
summary: "Show emoji pack",
|
summary: "Show emoji pack",
|
||||||
operationId: "PleromaAPI.EmojiAPIController.show",
|
operationId: "PleromaAPI.EmojiPackController.show",
|
||||||
parameters: [name_param()],
|
parameters: [name_param()],
|
||||||
responses: %{
|
responses: %{
|
||||||
200 => Operation.response("Emoji Pack", "application/json", emoji_pack()),
|
200 => Operation.response("Emoji Pack", "application/json", emoji_pack()),
|
||||||
|
@ -57,7 +57,7 @@ defmodule Pleroma.Web.ApiSpec.PleromaEmojiOperation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["Emoji Packs"],
|
tags: ["Emoji Packs"],
|
||||||
summary: "Requests a local pack archive from the instance",
|
summary: "Requests a local pack archive from the instance",
|
||||||
operationId: "PleromaAPI.EmojiAPIController.archive",
|
operationId: "PleromaAPI.EmojiPackController.archive",
|
||||||
parameters: [name_param()],
|
parameters: [name_param()],
|
||||||
responses: %{
|
responses: %{
|
||||||
200 =>
|
200 =>
|
||||||
|
@ -75,7 +75,7 @@ defmodule Pleroma.Web.ApiSpec.PleromaEmojiOperation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["Emoji Packs"],
|
tags: ["Emoji Packs"],
|
||||||
summary: "Download pack from another instance",
|
summary: "Download pack from another instance",
|
||||||
operationId: "PleromaAPI.EmojiAPIController.download",
|
operationId: "PleromaAPI.EmojiPackController.download",
|
||||||
security: [%{"oAuth" => ["write"]}],
|
security: [%{"oAuth" => ["write"]}],
|
||||||
requestBody: request_body("Parameters", download_request(), required: true),
|
requestBody: request_body("Parameters", download_request(), required: true),
|
||||||
responses: %{
|
responses: %{
|
||||||
|
@ -105,7 +105,7 @@ defmodule Pleroma.Web.ApiSpec.PleromaEmojiOperation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["Emoji Packs"],
|
tags: ["Emoji Packs"],
|
||||||
summary: "Create an empty pack",
|
summary: "Create an empty pack",
|
||||||
operationId: "PleromaAPI.EmojiAPIController.create",
|
operationId: "PleromaAPI.EmojiPackController.create",
|
||||||
security: [%{"oAuth" => ["write"]}],
|
security: [%{"oAuth" => ["write"]}],
|
||||||
parameters: [name_param()],
|
parameters: [name_param()],
|
||||||
responses: %{
|
responses: %{
|
||||||
|
@ -121,7 +121,7 @@ defmodule Pleroma.Web.ApiSpec.PleromaEmojiOperation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["Emoji Packs"],
|
tags: ["Emoji Packs"],
|
||||||
summary: "Delete a custom emoji pack",
|
summary: "Delete a custom emoji pack",
|
||||||
operationId: "PleromaAPI.EmojiAPIController.delete",
|
operationId: "PleromaAPI.EmojiPackController.delete",
|
||||||
security: [%{"oAuth" => ["write"]}],
|
security: [%{"oAuth" => ["write"]}],
|
||||||
parameters: [name_param()],
|
parameters: [name_param()],
|
||||||
responses: %{
|
responses: %{
|
||||||
|
@ -136,7 +136,7 @@ defmodule Pleroma.Web.ApiSpec.PleromaEmojiOperation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["Emoji Packs"],
|
tags: ["Emoji Packs"],
|
||||||
summary: "Updates (replaces) pack metadata",
|
summary: "Updates (replaces) pack metadata",
|
||||||
operationId: "PleromaAPI.EmojiAPIController.update",
|
operationId: "PleromaAPI.EmojiPackController.update",
|
||||||
security: [%{"oAuth" => ["write"]}],
|
security: [%{"oAuth" => ["write"]}],
|
||||||
requestBody: request_body("Parameters", update_request(), required: true),
|
requestBody: request_body("Parameters", update_request(), required: true),
|
||||||
parameters: [name_param()],
|
parameters: [name_param()],
|
||||||
|
@ -151,7 +151,7 @@ defmodule Pleroma.Web.ApiSpec.PleromaEmojiOperation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["Emoji Packs"],
|
tags: ["Emoji Packs"],
|
||||||
summary: "Add new file to the pack",
|
summary: "Add new file to the pack",
|
||||||
operationId: "PleromaAPI.EmojiAPIController.add_file",
|
operationId: "PleromaAPI.EmojiPackController.add_file",
|
||||||
security: [%{"oAuth" => ["write"]}],
|
security: [%{"oAuth" => ["write"]}],
|
||||||
requestBody: request_body("Parameters", add_file_request(), required: true),
|
requestBody: request_body("Parameters", add_file_request(), required: true),
|
||||||
parameters: [name_param()],
|
parameters: [name_param()],
|
||||||
|
@ -194,7 +194,7 @@ defmodule Pleroma.Web.ApiSpec.PleromaEmojiOperation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["Emoji Packs"],
|
tags: ["Emoji Packs"],
|
||||||
summary: "Add new file to the pack",
|
summary: "Add new file to the pack",
|
||||||
operationId: "PleromaAPI.EmojiAPIController.update_file",
|
operationId: "PleromaAPI.EmojiPackController.update_file",
|
||||||
security: [%{"oAuth" => ["write"]}],
|
security: [%{"oAuth" => ["write"]}],
|
||||||
requestBody: request_body("Parameters", update_file_request(), required: true),
|
requestBody: request_body("Parameters", update_file_request(), required: true),
|
||||||
parameters: [name_param()],
|
parameters: [name_param()],
|
||||||
|
@ -236,7 +236,7 @@ defmodule Pleroma.Web.ApiSpec.PleromaEmojiOperation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["Emoji Packs"],
|
tags: ["Emoji Packs"],
|
||||||
summary: "Delete emoji file from pack",
|
summary: "Delete emoji file from pack",
|
||||||
operationId: "PleromaAPI.EmojiAPIController.delete_file",
|
operationId: "PleromaAPI.EmojiPackController.delete_file",
|
||||||
security: [%{"oAuth" => ["write"]}],
|
security: [%{"oAuth" => ["write"]}],
|
||||||
parameters: [
|
parameters: [
|
||||||
name_param(),
|
name_param(),
|
||||||
|
@ -256,7 +256,7 @@ defmodule Pleroma.Web.ApiSpec.PleromaEmojiOperation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["Emoji Packs"],
|
tags: ["Emoji Packs"],
|
||||||
summary: "Imports packs from filesystem",
|
summary: "Imports packs from filesystem",
|
||||||
operationId: "PleromaAPI.EmojiAPIController.import",
|
operationId: "PleromaAPI.EmojiPackController.import",
|
||||||
security: [%{"oAuth" => ["write"]}],
|
security: [%{"oAuth" => ["write"]}],
|
||||||
responses: %{
|
responses: %{
|
||||||
200 =>
|
200 =>
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule Pleroma.Web.PleromaAPI.EmojiAPIController do
|
defmodule Pleroma.Web.PleromaAPI.EmojiPackController do
|
||||||
use Pleroma.Web, :controller
|
use Pleroma.Web, :controller
|
||||||
|
|
||||||
alias Pleroma.Emoji.Pack
|
alias Pleroma.Emoji.Pack
|
||||||
|
@ -24,7 +24,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiAPIController do
|
||||||
@skip_plugs [Pleroma.Plugs.OAuthScopesPlug, Pleroma.Plugs.ExpectPublicOrAuthenticatedCheckPlug]
|
@skip_plugs [Pleroma.Plugs.OAuthScopesPlug, Pleroma.Plugs.ExpectPublicOrAuthenticatedCheckPlug]
|
||||||
plug(:skip_plug, @skip_plugs when action in [:archive, :show, :list])
|
plug(:skip_plug, @skip_plugs when action in [:archive, :show, :list])
|
||||||
|
|
||||||
defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.PleromaEmojiOperation
|
defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.PleromaEmojiPackOperation
|
||||||
|
|
||||||
def remote(conn, %{url: url}) do
|
def remote(conn, %{url: url}) do
|
||||||
with {:ok, packs} <- Pack.list_remote(url) do
|
with {:ok, packs} <- Pack.list_remote(url) do
|
|
@ -216,25 +216,25 @@ defmodule Pleroma.Web.Router do
|
||||||
scope "/packs" do
|
scope "/packs" do
|
||||||
pipe_through(:admin_api)
|
pipe_through(:admin_api)
|
||||||
|
|
||||||
get("/import", EmojiAPIController, :import_from_filesystem)
|
get("/import", EmojiPackController, :import_from_filesystem)
|
||||||
get("/remote", EmojiAPIController, :remote)
|
get("/remote", EmojiPackController, :remote)
|
||||||
post("/download", EmojiAPIController, :download)
|
post("/download", EmojiPackController, :download)
|
||||||
|
|
||||||
post("/:name", EmojiAPIController, :create)
|
post("/:name", EmojiPackController, :create)
|
||||||
patch("/:name", EmojiAPIController, :update)
|
patch("/:name", EmojiPackController, :update)
|
||||||
delete("/:name", EmojiAPIController, :delete)
|
delete("/:name", EmojiPackController, :delete)
|
||||||
|
|
||||||
post("/:name/files", EmojiAPIController, :add_file)
|
post("/:name/files", EmojiPackController, :add_file)
|
||||||
patch("/:name/files", EmojiAPIController, :update_file)
|
patch("/:name/files", EmojiPackController, :update_file)
|
||||||
delete("/:name/files", EmojiAPIController, :delete_file)
|
delete("/:name/files", EmojiPackController, :delete_file)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Pack info / downloading
|
# Pack info / downloading
|
||||||
scope "/packs" do
|
scope "/packs" do
|
||||||
pipe_through(:api)
|
pipe_through(:api)
|
||||||
get("/", EmojiAPIController, :index)
|
get("/", EmojiPackController, :index)
|
||||||
get("/:name", EmojiAPIController, :show)
|
get("/:name", EmojiPackController, :show)
|
||||||
get("/:name/archive", EmojiAPIController, :archive)
|
get("/:name/archive", EmojiPackController, :archive)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Web.PleromaAPI.EmojiAPIControllerTest do
|
defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do
|
||||||
use Pleroma.Web.ConnCase
|
use Pleroma.Web.ConnCase
|
||||||
|
|
||||||
import Tesla.Mock
|
import Tesla.Mock
|
Loading…
Reference in a new issue