# retoor <retoor@molodetz.nl>
from .._shared import endpoint, field
GROUP = {
"slug": "lookups",
"title": "Search & Lookups",
"intro": """
# Search & Lookups
Type-ahead lookups that power mentions and the message composer. Both return JSON and accept
a single `q` query parameter. These feed [Messaging](/docs/messaging.html) (the recipient
composer) and [Profiles & Social Graph](/docs/profiles.html) (mentions and user pages).
Every endpoint follows the shared [Conventions & Errors](/docs/conventions.html) (auth, content
negotiation, pagination, status codes); see [Authentication](/docs/authentication.html) for the
four ways to sign requests.
""",
"endpoints": [
endpoint(
id="search-users",
method="GET",
path="/profile/search",
title="Search users",
summary="Find up to ten users whose username matches a query.",
auth="user",
params=[
field(
"q",
"query",
required=True,
example="al",
description="Partial username to match.",
)
],
sample_response={
"results": [{"uid": "8f14e45f-...", "username": "alice_test"}]
},
),
endpoint(
id="search-message-recipients",
method="GET",
path="/messages/search",
title="Search message recipients",
summary="Like user search, but excludes yourself; used by the message composer.",
auth="user",
params=[
field(
"q",
"query",
required=True,
example="bo",
description="Partial username to match.",
)
],
sample_response={
"results": [{"uid": "0cc175b9-...", "username": "bob_test"}]
},
),
],
}