projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0c491b9
)
ChatOperation: Refactor.
author
lain
<lain@soykaf.club>
Wed, 29 Apr 2020 11:34:43 +0000
(13:34 +0200)
committer
lain
<lain@soykaf.club>
Wed, 29 Apr 2020 11:34:43 +0000
(13:34 +0200)
lib/pleroma/web/api_spec/operations/chat_operation.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/web/api_spec/operations/chat_operation.ex
b/lib/pleroma/web/api_spec/operations/chat_operation.ex
index 59539e8902c94365a97aa6c4b948ca45849f4e52..88b9db048af40396e9d86d0b66f27fd18965a56e 100644
(file)
--- a/
lib/pleroma/web/api_spec/operations/chat_operation.ex
+++ b/
lib/pleroma/web/api_spec/operations/chat_operation.ex
@@
-5,11
+5,12
@@
defmodule Pleroma.Web.ApiSpec.ChatOperation do
alias OpenApiSpex.Operation
alias OpenApiSpex.Schema
defmodule Pleroma.Web.ApiSpec.ChatOperation do
alias OpenApiSpex.Operation
alias OpenApiSpex.Schema
- alias Pleroma.Web.ApiSpec.Helpers
alias Pleroma.Web.ApiSpec.Schemas.ChatMessageCreateRequest
alias Pleroma.Web.ApiSpec.Schemas.ChatMessageResponse
alias Pleroma.Web.ApiSpec.Schemas.ChatResponse
alias Pleroma.Web.ApiSpec.Schemas.ChatMessageCreateRequest
alias Pleroma.Web.ApiSpec.Schemas.ChatMessageResponse
alias Pleroma.Web.ApiSpec.Schemas.ChatResponse
+ import Pleroma.Web.ApiSpec.Helpers
+
@spec open_api_operation(atom) :: Operation.t()
def open_api_operation(action) do
operation = String.to_existing_atom("#{action}_operation")
@spec open_api_operation(atom) :: Operation.t()
def open_api_operation(action) do
operation = String.to_existing_atom("#{action}_operation")
@@
-52,11
+53,7
@@
defmodule Pleroma.Web.ApiSpec.ChatOperation do
tags: ["chat"],
summary: "Get a list of chats that you participated in",
operationId: "ChatController.index",
tags: ["chat"],
summary: "Get a list of chats that you participated in",
operationId: "ChatController.index",
- parameters: [
- Operation.parameter(:limit, :query, :integer, "How many results to return", example: 20),
- Operation.parameter(:min_id, :query, :string, "Return only chats after this id"),
- Operation.parameter(:max_id, :query, :string, "Return only chats before this id")
- ],
+ parameters: pagination_params(),
responses: %{
200 => Operation.response("The chats of the user", "application/json", chats_response())
},
responses: %{
200 => Operation.response("The chats of the user", "application/json", chats_response())
},
@@
-73,12
+70,9
@@
defmodule Pleroma.Web.ApiSpec.ChatOperation do
tags: ["chat"],
summary: "Get the most recent messages of the chat",
operationId: "ChatController.messages",
tags: ["chat"],
summary: "Get the most recent messages of the chat",
operationId: "ChatController.messages",
- parameters: [
- Operation.parameter(:id, :path, :string, "The ID of the Chat"),
- Operation.parameter(:limit, :query, :integer, "How many results to return", example: 20),
- Operation.parameter(:min_id, :query, :string, "Return only messages after this id"),
- Operation.parameter(:max_id, :query, :string, "Return only messages before this id")
- ],
+ parameters:
+ [Operation.parameter(:id, :path, :string, "The ID of the Chat")] ++
+ pagination_params(),
responses: %{
200 =>
Operation.response(
responses: %{
200 =>
Operation.response(
@@
-103,7
+97,7
@@
defmodule Pleroma.Web.ApiSpec.ChatOperation do
parameters: [
Operation.parameter(:id, :path, :string, "The ID of the Chat")
],
parameters: [
Operation.parameter(:id, :path, :string, "The ID of the Chat")
],
- requestBody:
Helpers.
request_body("Parameters", ChatMessageCreateRequest, required: true),
+ requestBody: request_body("Parameters", ChatMessageCreateRequest, required: true),
responses: %{
200 =>
Operation.response(
responses: %{
200 =>
Operation.response(