[#2456] OpenAPI: added embed_relationships
param definition.
This commit is contained in:
parent
63a1a82f38
commit
bfb48e3db6
@ -47,6 +47,15 @@ def pagination_params do
|
|||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def embed_relationships_param do
|
||||||
|
Operation.parameter(
|
||||||
|
:embed_relationships,
|
||||||
|
:query,
|
||||||
|
:boolean,
|
||||||
|
"Embed relationships into accounts (Pleroma extension)"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
def empty_object_response do
|
def empty_object_response do
|
||||||
Operation.response("Empty object", "application/json", %Schema{type: :object, example: %{}})
|
Operation.response("Empty object", "application/json", %Schema{type: :object, example: %{}})
|
||||||
end
|
end
|
||||||
|
@ -156,7 +156,8 @@ def followers_operation do
|
|||||||
description:
|
description:
|
||||||
"Accounts which follow the given account, if network is not hidden by the account owner.",
|
"Accounts which follow the given account, if network is not hidden by the account owner.",
|
||||||
parameters:
|
parameters:
|
||||||
[%Reference{"$ref": "#/components/parameters/accountIdOrNickname"}] ++ pagination_params(),
|
[%Reference{"$ref": "#/components/parameters/accountIdOrNickname"}] ++
|
||||||
|
pagination_params() ++ [embed_relationships_param()],
|
||||||
responses: %{
|
responses: %{
|
||||||
200 => Operation.response("Accounts", "application/json", array_of_accounts())
|
200 => Operation.response("Accounts", "application/json", array_of_accounts())
|
||||||
}
|
}
|
||||||
@ -172,7 +173,8 @@ def following_operation do
|
|||||||
description:
|
description:
|
||||||
"Accounts which the given account is following, if network is not hidden by the account owner.",
|
"Accounts which the given account is following, if network is not hidden by the account owner.",
|
||||||
parameters:
|
parameters:
|
||||||
[%Reference{"$ref": "#/components/parameters/accountIdOrNickname"}] ++ pagination_params(),
|
[%Reference{"$ref": "#/components/parameters/accountIdOrNickname"}] ++
|
||||||
|
pagination_params() ++ [embed_relationships_param()],
|
||||||
responses: %{200 => Operation.response("Accounts", "application/json", array_of_accounts())}
|
responses: %{200 => Operation.response("Accounts", "application/json", array_of_accounts())}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -24,7 +24,8 @@ def account_search_operation do
|
|||||||
tags: ["Search"],
|
tags: ["Search"],
|
||||||
summary: "Search for matching accounts by username or display name",
|
summary: "Search for matching accounts by username or display name",
|
||||||
operationId: "SearchController.account_search",
|
operationId: "SearchController.account_search",
|
||||||
parameters: [
|
parameters:
|
||||||
|
[
|
||||||
Operation.parameter(:q, :query, %Schema{type: :string}, "What to search for",
|
Operation.parameter(:q, :query, %Schema{type: :string}, "What to search for",
|
||||||
required: true
|
required: true
|
||||||
),
|
),
|
||||||
@ -46,7 +47,7 @@ def account_search_operation do
|
|||||||
%Schema{allOf: [BooleanLike], default: false},
|
%Schema{allOf: [BooleanLike], default: false},
|
||||||
"Only include accounts that the user is following"
|
"Only include accounts that the user is following"
|
||||||
)
|
)
|
||||||
],
|
] ++ [embed_relationships_param()],
|
||||||
responses: %{
|
responses: %{
|
||||||
200 =>
|
200 =>
|
||||||
Operation.response(
|
Operation.response(
|
||||||
@ -65,7 +66,8 @@ def search_operation do
|
|||||||
security: [%{"oAuth" => ["read:search"]}],
|
security: [%{"oAuth" => ["read:search"]}],
|
||||||
operationId: "SearchController.search",
|
operationId: "SearchController.search",
|
||||||
deprecated: true,
|
deprecated: true,
|
||||||
parameters: [
|
parameters:
|
||||||
|
[
|
||||||
Operation.parameter(
|
Operation.parameter(
|
||||||
:account_id,
|
:account_id,
|
||||||
:query,
|
:query,
|
||||||
@ -78,7 +80,9 @@ def search_operation do
|
|||||||
%Schema{type: :string, enum: ["accounts", "hashtags", "statuses"]},
|
%Schema{type: :string, enum: ["accounts", "hashtags", "statuses"]},
|
||||||
"Search type"
|
"Search type"
|
||||||
),
|
),
|
||||||
Operation.parameter(:q, :query, %Schema{type: :string}, "The search query", required: true),
|
Operation.parameter(:q, :query, %Schema{type: :string}, "The search query",
|
||||||
|
required: true
|
||||||
|
),
|
||||||
Operation.parameter(
|
Operation.parameter(
|
||||||
:resolve,
|
:resolve,
|
||||||
:query,
|
:query,
|
||||||
@ -97,8 +101,7 @@ def search_operation do
|
|||||||
%Schema{type: :integer},
|
%Schema{type: :integer},
|
||||||
"Offset"
|
"Offset"
|
||||||
)
|
)
|
||||||
| pagination_params()
|
] ++ pagination_params() ++ [embed_relationships_param()],
|
||||||
],
|
|
||||||
responses: %{
|
responses: %{
|
||||||
200 => Operation.response("Results", "application/json", results())
|
200 => Operation.response("Results", "application/json", results())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user