X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=inline;f=lib%2Fpleroma%2Fweb%2Fapi_spec%2Foperations%2Fsearch_operation.ex;h=ff4fd002703e78ddb1e35057f86255275ede2e52;hb=79bc4bcc3cb89bb5860470626df5f02991b95885;hp=0dd908d7fade1ea66f9f92df6e437093723076a6;hpb=bfb48e3db6009c31e52cfe5ac4828a6143d7e549;p=akkoma
diff --git a/lib/pleroma/web/api_spec/operations/search_operation.ex b/lib/pleroma/web/api_spec/operations/search_operation.ex
index 0dd908d7f..ff4fd0027 100644
--- a/lib/pleroma/web/api_spec/operations/search_operation.ex
+++ b/lib/pleroma/web/api_spec/operations/search_operation.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ApiSpec.SearchOperation do
@@ -19,35 +19,35 @@ defmodule Pleroma.Web.ApiSpec.SearchOperation do
apply(__MODULE__, operation, [])
end
+ # Note: `with_relationships` param is not supported (PleromaFE uses this op for autocomplete)
def account_search_operation do
%Operation{
tags: ["Search"],
summary: "Search for matching accounts by username or display name",
operationId: "SearchController.account_search",
- parameters:
- [
- Operation.parameter(:q, :query, %Schema{type: :string}, "What to search for",
- required: true
- ),
- Operation.parameter(
- :limit,
- :query,
- %Schema{type: :integer, default: 40},
- "Maximum number of results"
- ),
- Operation.parameter(
- :resolve,
- :query,
- %Schema{allOf: [BooleanLike], default: false},
- "Attempt WebFinger lookup. Use this when `q` is an exact address."
- ),
- Operation.parameter(
- :following,
- :query,
- %Schema{allOf: [BooleanLike], default: false},
- "Only include accounts that the user is following"
- )
- ] ++ [embed_relationships_param()],
+ parameters: [
+ Operation.parameter(:q, :query, %Schema{type: :string}, "What to search for",
+ required: true
+ ),
+ Operation.parameter(
+ :limit,
+ :query,
+ %Schema{type: :integer, default: 40},
+ "Maximum number of results"
+ ),
+ Operation.parameter(
+ :resolve,
+ :query,
+ %Schema{allOf: [BooleanLike], default: false},
+ "Attempt WebFinger lookup. Use this when `q` is an exact address."
+ ),
+ Operation.parameter(
+ :following,
+ :query,
+ %Schema{allOf: [BooleanLike], default: false},
+ "Only include accounts that the user is following"
+ )
+ ],
responses: %{
200 =>
Operation.response(
@@ -66,42 +66,40 @@ defmodule Pleroma.Web.ApiSpec.SearchOperation do
security: [%{"oAuth" => ["read:search"]}],
operationId: "SearchController.search",
deprecated: true,
- parameters:
- [
- Operation.parameter(
- :account_id,
- :query,
- FlakeID,
- "If provided, statuses returned will be authored only by this account"
- ),
- Operation.parameter(
- :type,
- :query,
- %Schema{type: :string, enum: ["accounts", "hashtags", "statuses"]},
- "Search type"
- ),
- Operation.parameter(:q, :query, %Schema{type: :string}, "The search query",
- required: true
- ),
- Operation.parameter(
- :resolve,
- :query,
- %Schema{allOf: [BooleanLike], default: false},
- "Attempt WebFinger lookup"
- ),
- Operation.parameter(
- :following,
- :query,
- %Schema{allOf: [BooleanLike], default: false},
- "Only include accounts that the user is following"
- ),
- Operation.parameter(
- :offset,
- :query,
- %Schema{type: :integer},
- "Offset"
- )
- ] ++ pagination_params() ++ [embed_relationships_param()],
+ parameters: [
+ Operation.parameter(
+ :account_id,
+ :query,
+ FlakeID,
+ "If provided, statuses returned will be authored only by this account"
+ ),
+ Operation.parameter(
+ :type,
+ :query,
+ %Schema{type: :string, enum: ["accounts", "hashtags", "statuses"]},
+ "Search type"
+ ),
+ Operation.parameter(:q, :query, %Schema{type: :string}, "The search query", required: true),
+ Operation.parameter(
+ :resolve,
+ :query,
+ %Schema{allOf: [BooleanLike], default: false},
+ "Attempt WebFinger lookup"
+ ),
+ Operation.parameter(
+ :following,
+ :query,
+ %Schema{allOf: [BooleanLike], default: false},
+ "Only include accounts that the user is following"
+ ),
+ Operation.parameter(
+ :offset,
+ :query,
+ %Schema{type: :integer},
+ "Offset"
+ ),
+ with_relationships_param() | pagination_params()
+ ],
responses: %{
200 => Operation.response("Results", "application/json", results())
}
@@ -141,8 +139,8 @@ defmodule Pleroma.Web.ApiSpec.SearchOperation do
:query,
%Schema{allOf: [BooleanLike], default: false},
"Only include accounts that the user is following"
- )
- | pagination_params()
+ ),
+ with_relationships_param() | pagination_params()
],
responses: %{
200 => Operation.response("Results", "application/json", results2())