mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 05:58:25 +00:00
api: Document new get_messages oldest/newest API feature.
While we're at it, we make the examples more sensible.
This commit is contained in:
@@ -63,7 +63,7 @@ zulip(config).then((client) => {
|
|||||||
|
|
||||||
{tab|curl}
|
{tab|curl}
|
||||||
|
|
||||||
{generate_code_example(curl, exclude=["client_gravatar", "apply_markdown"])|/messages:get|example}
|
{generate_code_example(curl, exclude=["client_gravatar", "apply_markdown", "use_first_unread_anchor"])|/messages:get|example}
|
||||||
|
|
||||||
{end_tabs}
|
{end_tabs}
|
||||||
|
|
||||||
|
|||||||
@@ -799,6 +799,7 @@ markdown_docs_length_exclude = {
|
|||||||
"templates/zerver/integrations/perforce.md",
|
"templates/zerver/integrations/perforce.md",
|
||||||
# Has some example code that could perhaps be wrapped
|
# Has some example code that could perhaps be wrapped
|
||||||
"templates/zerver/api/incoming-webhooks-walkthrough.md",
|
"templates/zerver/api/incoming-webhooks-walkthrough.md",
|
||||||
|
"templates/zerver/api/get-messages.md",
|
||||||
# This macro has a long indented URL
|
# This macro has a long indented URL
|
||||||
"templates/zerver/help/include/git-webhook-url-with-branches-indented.md",
|
"templates/zerver/help/include/git-webhook-url-with-branches-indented.md",
|
||||||
"templates/zerver/api/update-notification-settings.md",
|
"templates/zerver/api/update-notification-settings.md",
|
||||||
|
|||||||
@@ -543,15 +543,13 @@ def get_messages(client):
|
|||||||
# type: (Client) -> None
|
# type: (Client) -> None
|
||||||
|
|
||||||
# {code_example|start}
|
# {code_example|start}
|
||||||
# Get the 3 last messages sent by "iago@zulip.com" to the stream "Verona"
|
# Get the 100 last messages sent by "iago@zulip.com" to the stream "Verona"
|
||||||
request = {
|
request = {
|
||||||
'use_first_unread_anchor': True,
|
'anchor': 'newest',
|
||||||
'num_before': 3,
|
'num_before': 100,
|
||||||
'num_after': 0,
|
'num_after': 0,
|
||||||
'narrow': [{'operator': 'sender', 'operand': 'iago@zulip.com'},
|
'narrow': [{'operator': 'sender', 'operand': 'iago@zulip.com'},
|
||||||
{'operator': 'stream', 'operand': 'Verona'}],
|
{'operator': 'stream', 'operand': 'Verona'}],
|
||||||
'client_gravatar': True,
|
|
||||||
'apply_markdown': True
|
|
||||||
} # type: Dict[str, Any]
|
} # type: Dict[str, Any]
|
||||||
result = client.get_messages(request)
|
result = client.get_messages(request)
|
||||||
# {code_example|end}
|
# {code_example|end}
|
||||||
|
|||||||
@@ -290,6 +290,9 @@ paths:
|
|||||||
in: query
|
in: query
|
||||||
description: The message ID to fetch messages near.
|
description: The message ID to fetch messages near.
|
||||||
Required unless `use_first_unread_anchor` is set to true.
|
Required unless `use_first_unread_anchor` is set to true.
|
||||||
|
|
||||||
|
The special values of `'newest'` and `'oldest'` are also supported
|
||||||
|
for anchoring the query at the most recent or oldest messages.
|
||||||
schema:
|
schema:
|
||||||
oneOf:
|
oneOf:
|
||||||
- type: string
|
- type: string
|
||||||
|
|||||||
Reference in New Issue
Block a user