mirror of https://github.com/zulip/zulip.git
api docs: Use Markdown extension for tabbed sections.
This commit is contained in:
parent
2443919a7e
commit
0817905480
|
@ -9,42 +9,16 @@ created, and configured using the `invite_only` setting specified in
|
|||
the arguments (see below).
|
||||
|
||||
## Usage examples
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="javascript">JavaScript</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/users/me/subscriptions \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d 'subscriptions=[{"name": "Verona"}]'
|
||||
```
|
||||
|
||||
To subscribe another user to a stream, you may pass in
|
||||
the `principals` argument, like so:
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/users/me/subscriptions \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d 'subscriptions=[{"name": "Verona"}]' \
|
||||
-d 'principals=["ZOE@zulip.com"]'
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
{generate_code_example(python)|add-subscriptions|example}
|
||||
|
||||
</div>
|
||||
{tab|js}
|
||||
|
||||
<div data-language="javascript" markdown="1">
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
```js
|
||||
const zulip = require('zulip-js');
|
||||
|
||||
|
@ -75,11 +49,26 @@ zulip(config).then((client) => {
|
|||
client.users.me.subscriptions.add(anotherUserParams).then(console.log);
|
||||
});
|
||||
```
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{tab|curl}
|
||||
|
||||
</div>
|
||||
```
|
||||
curl {{ api_url }}/v1/users/me/subscriptions \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d 'subscriptions=[{"name": "Verona"}]'
|
||||
```
|
||||
|
||||
To subscribe another user to a stream, you may pass in
|
||||
the `principals` argument, like so:
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/users/me/subscriptions \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d 'subscriptions=[{"name": "Verona"}]' \
|
||||
-d 'principals=["ZOE@zulip.com"]'
|
||||
```
|
||||
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -6,14 +6,12 @@ Establish patterns in the messages that should be automatically linkified.
|
|||
|
||||
## Usage examples
|
||||
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
{generate_code_example(python)|/realm/filters:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
```
|
||||
curl -X POST {{ api_url }}/v1/realm/filters \
|
||||
|
@ -22,17 +20,7 @@ curl -X POST {{ api_url }}/v1/realm/filters \
|
|||
-d "url_format_string=https://github.com/zulip/zulip/issues/%(id)s"
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
|
||||
{generate_code_example(python)|/realm/filters:post|example}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -7,35 +7,14 @@ Create a new user in a realm.
|
|||
`POST {{ api_url }}/v1/users`
|
||||
|
||||
## Usage examples
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="javascript">JavaScript</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/users \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d "email=newbie@zulip.com" \
|
||||
-d "full_name=New User" \
|
||||
-d "short_name=newbie" \
|
||||
-d "password=temp"
|
||||
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
{generate_code_example(python)|/users:post|example(admin_config=True)}
|
||||
|
||||
</div>
|
||||
{tab|js}
|
||||
|
||||
<div data-language="javascript" markdown="1">
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
```js
|
||||
const zulip = require('zulip-js');
|
||||
|
@ -56,11 +35,20 @@ zulip(config).then((client) => {
|
|||
client.users.create(params).then(console.log);
|
||||
});
|
||||
```
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{tab|curl}
|
||||
|
||||
</div>
|
||||
```
|
||||
curl {{ api_url }}/v1/users \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d "email=newbie@zulip.com" \
|
||||
-d "full_name=New User" \
|
||||
-d "short_name=newbie" \
|
||||
-d "password=temp"
|
||||
|
||||
```
|
||||
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -12,31 +12,19 @@ the Zulip Help Center.
|
|||
|
||||
## Usage examples
|
||||
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
{generate_code_example(python)|/messages/{message_id}:delete|example(admin_config=True)}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
```
|
||||
curl -X DELETE {{ api_url }}/v1/messages/{message_id} \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
|
||||
{generate_code_example(python)|/messages/{message_id}:delete|example(admin_config=True)}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -5,32 +5,16 @@ Delete a previously registered queue.
|
|||
`DELETE {{ api_url }}/v1/events`
|
||||
|
||||
## Usage examples
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="javascript">JavaScript</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
|
||||
```
|
||||
curl -X "DELETE" {{ api_url }}/v1/events \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
-d 'queue_id=1515096410:1'
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
{generate_code_example(python)|/events:delete|example}
|
||||
|
||||
</div>
|
||||
{tab|js}
|
||||
|
||||
<div data-language="javascript" markdown="1">
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
```js
|
||||
const zulip = require('zulip-js');
|
||||
|
||||
|
@ -54,11 +38,16 @@ zulip(config).then((client) => {
|
|||
});
|
||||
|
||||
```
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{tab|curl}
|
||||
|
||||
</div>
|
||||
```
|
||||
curl -X "DELETE" {{ api_url }}/v1/events \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
-d 'queue_id=1515096410:1'
|
||||
```
|
||||
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -5,37 +5,14 @@ Get all streams that the user has access to.
|
|||
`GET {{ api_url }}/v1/streams`
|
||||
|
||||
## Usage examples
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="javascript">JavaScript</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/streams -u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
```
|
||||
|
||||
You may pass in one or more of the parameters mentioned above
|
||||
as URL query parameters, like so:
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/streams?include_public=false \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
{generate_code_example(python)|/streams:get|example}
|
||||
|
||||
</div>
|
||||
{tab|js}
|
||||
|
||||
<div data-language="javascript" markdown="1">
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
```js
|
||||
const zulip = require('zulip-js');
|
||||
|
@ -51,11 +28,22 @@ zulip(config).then((client) => {
|
|||
});
|
||||
|
||||
```
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{tab|curl}
|
||||
|
||||
</div>
|
||||
```
|
||||
curl {{ api_url }}/v1/streams -u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
```
|
||||
|
||||
You may pass in one or more of the parameters mentioned above
|
||||
as URL query parameters, like so:
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/streams?include_public=false \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
```
|
||||
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -5,36 +5,14 @@ Retrieve all users in a realm.
|
|||
`GET {{ api_url }}/v1/users`
|
||||
|
||||
## Usage examples
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="javascript">JavaScript</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/users -u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
```
|
||||
|
||||
You may pass the `client_gravatar` query parameter as follows:
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/users?client_gravatar=true \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
{generate_code_example(python)|/users:get|example}
|
||||
|
||||
</div>
|
||||
{tab|js}
|
||||
|
||||
<div data-language="javascript" markdown="1">
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
```js
|
||||
const zulip = require('zulip-js');
|
||||
|
@ -52,11 +30,21 @@ zulip(config).then((client) => {
|
|||
client.users.retrieve({client_gravatar: true}).then(console.log);
|
||||
});
|
||||
```
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{tab|curl}
|
||||
|
||||
</div>
|
||||
```
|
||||
curl {{ api_url }}/v1/users -u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
```
|
||||
|
||||
You may pass the `client_gravatar` query parameter as follows:
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/users?client_gravatar=true \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
```
|
||||
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -6,26 +6,9 @@ This endpoint allows you to receive new events from
|
|||
[a registered event queue](/api/register-queue).
|
||||
|
||||
## Usage examples
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="javascript">JavaScript</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
|
||||
```
|
||||
curl -G {{ api_url }}/v1/events \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
-d "queue_id=1375801870:2942" \
|
||||
-d "last_event_id=-1"
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
```
|
||||
#!/usr/bin/env python
|
||||
|
@ -48,9 +31,8 @@ print(client.get_events(
|
|||
`call_on_each_message` and `call_on_each_event` will automatically register
|
||||
a queue for you.
|
||||
|
||||
</div>
|
||||
{tab|js}
|
||||
|
||||
<div data-language="javascript" markdown="1">
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
```js
|
||||
const zulip = require('zulip-js');
|
||||
|
@ -77,11 +59,17 @@ zulip(config).then((client) => {
|
|||
});
|
||||
});
|
||||
```
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{tab|curl}
|
||||
|
||||
</div>
|
||||
```
|
||||
curl -G {{ api_url }}/v1/events \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
-d "queue_id=1375801870:2942" \
|
||||
-d "last_event_id=-1"
|
||||
```
|
||||
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -11,31 +11,19 @@ Note that edit history may be disabled in some organizations; see the
|
|||
|
||||
## Usage examples
|
||||
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
{generate_code_example(python)|/messages/{message_id}/history:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/messages/<message_id>/history \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
|
||||
{generate_code_example(python)|/messages/{message_id}/history:get|example}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -30,36 +30,13 @@ avoid generating very large HTTP responses.
|
|||
|
||||
## Usage examples
|
||||
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="javascript">JavaScript</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/messages \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d "anchor=42" \
|
||||
-d "use_first_unread_anchor=false" \
|
||||
-d "num_before=3" \
|
||||
-d "num_after=14" \
|
||||
-d "narrow=[{\"operator\":\"stream\", \"operand\":\"party\"}]" \
|
||||
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
{generate_code_example(python)|/messages:get|example}
|
||||
|
||||
</div>
|
||||
{tab|js}
|
||||
|
||||
<div data-language="javascript" markdown="1">
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
```js
|
||||
const zulip = require('zulip-js');
|
||||
|
@ -82,11 +59,21 @@ zulip(config).then((client) => {
|
|||
return client.messages.retrieve(readParams);
|
||||
}).then(console.log);
|
||||
```
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{tab|curl}
|
||||
|
||||
</div>
|
||||
```
|
||||
curl {{ api_url }}/v1/messages \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d "anchor=42" \
|
||||
-d "use_first_unread_anchor=false" \
|
||||
-d "num_before=3" \
|
||||
-d "num_after=14" \
|
||||
-d "narrow=[{\"operator\":\"stream\", \"operand\":\"party\"}]" \
|
||||
|
||||
```
|
||||
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -16,31 +16,19 @@ for details on the data model for presence in Zulip.
|
|||
|
||||
## Usage examples
|
||||
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
{generate_code_example(python)|/users/{email}/presence:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/users/<email>/presence \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
|
||||
{generate_code_example(python)|/users/{email}/presence:get|example}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -6,30 +6,13 @@ Get the profile of the user/bot that requests this endpoint.
|
|||
|
||||
## Usage examples
|
||||
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="javascript">JavaScript</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/users/me \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
{generate_code_example(python)|get-profile|example}
|
||||
|
||||
</div>
|
||||
{tab|js}
|
||||
|
||||
<div data-language="javascript" markdown="1">
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
```js
|
||||
const zulip = require('zulip-js');
|
||||
|
@ -45,11 +28,15 @@ zulip(config).then((client) => {
|
|||
client.users.me.getProfile().then(console.log);
|
||||
});
|
||||
```
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{tab|curl}
|
||||
|
||||
</div>
|
||||
```
|
||||
curl {{ api_url }}/v1/users/me \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
```
|
||||
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -11,31 +11,19 @@ UI).
|
|||
|
||||
## Usage examples
|
||||
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
{generate_code_example(python)|/messages/{message_id}:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/messages/<msg_id> \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
|
||||
{generate_code_example(python)|/messages/{message_id}:get|example}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -6,29 +6,13 @@ Get the unique ID of a given stream.
|
|||
|
||||
## Usage examples
|
||||
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="javascript">JavaScript</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/get_stream_id?stream=Denmark \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
```
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
{generate_code_example(python)|/get_stream_id:get|example}
|
||||
|
||||
</div>
|
||||
{tab|js}
|
||||
|
||||
<div data-language="javascript" markdown="1">
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
```js
|
||||
const zulip = require('zulip-js');
|
||||
|
@ -43,11 +27,15 @@ zulip(config).then((client) => {
|
|||
client.streams.getStreamId('Denmark').then(console.log);
|
||||
});
|
||||
```
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{tab|curl}
|
||||
|
||||
</div>
|
||||
```
|
||||
curl {{ api_url }}/v1/get_stream_id?stream=Denmark \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
```
|
||||
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -5,30 +5,14 @@ Get all the topics in a specific stream
|
|||
`GET {{ api_url }}/v1/users/me/<stream_id>/topics`
|
||||
|
||||
## Usage examples
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="javascript">JavaScript</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/users/me/<stream_id>/topics \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
{generate_code_example(python)|/users/me/{stream_id}/topics:get|example}
|
||||
|
||||
</div>
|
||||
{tab|js}
|
||||
|
||||
<div data-language="javascript" markdown="1">
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
```js
|
||||
const zulip = require('zulip-js');
|
||||
|
@ -44,11 +28,15 @@ zulip(config).then((client) => {
|
|||
}).then(console.log);
|
||||
|
||||
```
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{tab|curl}
|
||||
|
||||
</div>
|
||||
```
|
||||
curl {{ api_url }}/v1/users/me/<stream_id>/topics \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
```
|
||||
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -5,30 +5,14 @@ Get all streams that the user is subscribed to.
|
|||
`GET {{ api_url }}/v1/users/me/subscriptions`
|
||||
|
||||
## Usage examples
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="javascript">JavaScript</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/users/me/subscriptions \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
{generate_code_example(python)|get-subscribed-streams|example}
|
||||
|
||||
</div>
|
||||
{tab|js}
|
||||
|
||||
<div data-language="javascript" markdown="1">
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
|
||||
```js
|
||||
|
@ -45,11 +29,15 @@ zulip(config).then((client) => {
|
|||
});
|
||||
|
||||
```
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{tab|curl}
|
||||
|
||||
</div>
|
||||
```
|
||||
curl {{ api_url }}/v1/users/me/subscriptions \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
```
|
||||
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -7,46 +7,33 @@ The Python library is the most advanced (and has tools for easily
|
|||
writing interactive bots that react to messages), so we recommend it
|
||||
if you're trying to decide.
|
||||
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="curl">curl</li>
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="zulip-send">zulip-send</li>
|
||||
<li data-language="javascript">JavaScript</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
{start_tabs}
|
||||
{tab|curl}
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
No download required!
|
||||
</div>
|
||||
|
||||
<div data-language="zulip-send" markdown="1">
|
||||
Included with the Python bindings:
|
||||
{tab|python}
|
||||
|
||||
```
|
||||
pip install zulip
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
Install the Python API with [pip](https://pypi.python.org/pypi/zulip/):
|
||||
|
||||
```
|
||||
pip install zulip
|
||||
```
|
||||
|
||||
</div>
|
||||
{tab|zulip-send}
|
||||
|
||||
Included with the Python bindings:
|
||||
|
||||
```
|
||||
pip install zulip
|
||||
```
|
||||
|
||||
{tab|js}
|
||||
|
||||
<div data-language="javascript" markdown="1">
|
||||
Install the JavaScript API with [npm](https://www.npmjs.com/package/zulip-js):
|
||||
|
||||
```
|
||||
npm install zulip-js
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{end_tabs}
|
||||
|
|
|
@ -8,14 +8,12 @@ UI, and are not included in the user's unread count totals.
|
|||
|
||||
## Usage examples
|
||||
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
{generate_code_example(python)|/users/me/subscriptions/muted_topics:patch|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
```
|
||||
curl -X PATCH {{ api_url }}/v1/users/me/subscriptions/muted_topics \
|
||||
|
@ -25,17 +23,7 @@ curl -X PATCH {{ api_url }}/v1/users/me/subscriptions/muted_topics \
|
|||
-d "op=add"
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
|
||||
{generate_code_example(python)|/users/me/subscriptions/muted_topics:patch|example}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -26,13 +26,9 @@ instead use the raw [register](/api/register-queue) and
|
|||
[events](/api/get-events-from-queue) endpoints.
|
||||
|
||||
## Usage examples
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
```
|
||||
#!/usr/bin/env python
|
||||
|
@ -52,9 +48,7 @@ client.call_on_each_message(lambda msg: sys.stdout.write(str(msg) + "\n"))
|
|||
client.call_on_each_event(lambda event: sys.stdout.write(str(event) + "\n"))
|
||||
```
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -46,31 +46,14 @@ works, avoids clients needing to worry about large classes of
|
|||
potentially messy races, etc.
|
||||
|
||||
## Usage examples
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="javascript">JavaScript</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/register \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
-d 'event_types=["message"]'
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
{generate_code_example(python)|/register:post|example}
|
||||
|
||||
</div>
|
||||
{tab|js}
|
||||
|
||||
<div data-language="javascript" markdown="1">
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
```js
|
||||
const zulip = require('zulip-js');
|
||||
|
@ -89,11 +72,16 @@ zulip(config).then((client) => {
|
|||
});
|
||||
|
||||
```
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{tab|curl}
|
||||
|
||||
</div>
|
||||
```
|
||||
curl {{ api_url }}/v1/register \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
-d 'event_types=["message"]'
|
||||
```
|
||||
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -5,42 +5,14 @@ Unsubscribe yourself or other users from one or more streams.
|
|||
`DELETE {{ api_url }}/v1/users/me/subcriptions`
|
||||
|
||||
## Usage examples
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="javascript">JavaScript</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
|
||||
```
|
||||
curl -X "DELETE" {{ api_url }}/v1/users/me/subscriptions \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d 'subscriptions=["Denmark"]'
|
||||
```
|
||||
|
||||
You may specify the `principals` argument like so:
|
||||
|
||||
```
|
||||
curl -X "DELETE" {{ api_url }}/v1/users/me/subscriptions \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d 'subscriptions=["Denmark"]' \
|
||||
-d 'principals=["ZOE@zulip.com"]'
|
||||
```
|
||||
|
||||
**Note**: Unsubscribing another user from a stream requires
|
||||
administrative privileges.
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
{generate_code_example(python)|/users/me/subscriptions:delete|example}
|
||||
|
||||
</div>
|
||||
{tab|js}
|
||||
|
||||
<div data-language="javascript" markdown="1">
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
```js
|
||||
const zulip = require('zulip-js');
|
||||
|
@ -65,11 +37,28 @@ zulip(config).then((client) => {
|
|||
client.users.me.subscriptions.remove(zoeParams).then(console.log);
|
||||
});
|
||||
```
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{tab|curl}
|
||||
|
||||
</div>
|
||||
```
|
||||
curl -X "DELETE" {{ api_url }}/v1/users/me/subscriptions \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d 'subscriptions=["Denmark"]'
|
||||
```
|
||||
|
||||
You may specify the `principals` argument like so:
|
||||
|
||||
```
|
||||
curl -X "DELETE" {{ api_url }}/v1/users/me/subscriptions \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d 'subscriptions=["Denmark"]' \
|
||||
-d 'principals=["ZOE@zulip.com"]'
|
||||
```
|
||||
|
||||
**Note**: Unsubscribing another user from a stream requires
|
||||
administrative privileges.
|
||||
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -5,31 +5,14 @@ Render a message to HTML.
|
|||
`POST {{ api_url }}/v1/messages/render`
|
||||
|
||||
## Usage examples
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="javascript">JavaScript</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/messages/render \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d "content=**foo**"
|
||||
|
||||
```
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
{generate_code_example(python)|/messages/render:post|example}
|
||||
|
||||
</div>
|
||||
{tab|js}
|
||||
|
||||
<div data-language="javascript" markdown="1">
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
```js
|
||||
const zulip = require('zulip-js');
|
||||
|
@ -48,11 +31,17 @@ zulip(config).then((client) => {
|
|||
client.messages.render(params).then(console.log);
|
||||
});
|
||||
```
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{tab|curl}
|
||||
|
||||
</div>
|
||||
```
|
||||
curl {{ api_url }}/v1/messages/render \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d "content=**foo**"
|
||||
|
||||
```
|
||||
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -6,74 +6,13 @@ Send a stream or a private message.
|
|||
|
||||
## Usage examples
|
||||
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="javascript">JavaScript</li>
|
||||
<li data-language="curl">curl</li>
|
||||
<li data-language="zulip-send">zulip-send</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
|
||||
```
|
||||
# For stream messages
|
||||
curl {{ api_url }}/v1/messages \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d "type=stream" \
|
||||
-d "to=Denmark" \
|
||||
-d "subject=Castle" \
|
||||
-d "content=Something is rotten in the state of Denmark."
|
||||
|
||||
# For private messages
|
||||
curl {{ api_url }}/v1/messages \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d "type=private" \
|
||||
-d "to=hamlet@example.com" \
|
||||
-d "content=I come not, friends, to steal away your hearts."
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
{generate_code_example(python)|/messages:post|example}
|
||||
|
||||
</div>
|
||||
{tab|js}
|
||||
|
||||
<div data-language="zulip-send" markdown="1"> You can use `zulip-send`
|
||||
(available after you `pip install zulip`) to easily send Zulips from
|
||||
the command-line, providing the message content via STDIN.
|
||||
|
||||
```bash
|
||||
# For stream messages
|
||||
zulip-send --stream Denmark --subject Castle \
|
||||
--user othello-bot@example.com --api-key a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5
|
||||
|
||||
# For private messages
|
||||
zulip-send hamlet@example.com \
|
||||
--user othello-bot@example.com --api-key a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5
|
||||
```
|
||||
|
||||
#### Passing in the message on the command-line
|
||||
|
||||
If you'd like, you can also provide the message on the command-line with the
|
||||
`-m` or `--message` flag, as follows:
|
||||
|
||||
|
||||
```bash
|
||||
zulip-send --stream Denmark --subject Castle \
|
||||
--message "Something is rotten in the state of Denmark." \
|
||||
--user othello-bot@example.com --api-key a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5
|
||||
```
|
||||
|
||||
You can omit the `user` and `api-key` arguments if you have a `~/.zuliprc`
|
||||
file.
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="javascript" markdown="1">
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
```js
|
||||
const zulip = require('zulip-js');
|
||||
|
@ -109,11 +48,58 @@ zulip(config).then((client) => {
|
|||
});
|
||||
|
||||
```
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{tab|curl}
|
||||
|
||||
</div>
|
||||
```
|
||||
# For stream messages
|
||||
curl {{ api_url }}/v1/messages \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d "type=stream" \
|
||||
-d "to=Denmark" \
|
||||
-d "subject=Castle" \
|
||||
-d "content=Something is rotten in the state of Denmark."
|
||||
|
||||
# For private messages
|
||||
curl {{ api_url }}/v1/messages \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d "type=private" \
|
||||
-d "to=hamlet@example.com" \
|
||||
-d "content=I come not, friends, to steal away your hearts."
|
||||
```
|
||||
|
||||
{tab|zulip-send}
|
||||
|
||||
You can use `zulip-send`
|
||||
(available after you `pip install zulip`) to easily send Zulips from
|
||||
the command-line, providing the message content via STDIN.
|
||||
|
||||
```bash
|
||||
# For stream messages
|
||||
zulip-send --stream Denmark --subject Castle \
|
||||
--user othello-bot@example.com --api-key a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5
|
||||
|
||||
# For private messages
|
||||
zulip-send hamlet@example.com \
|
||||
--user othello-bot@example.com --api-key a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5
|
||||
```
|
||||
|
||||
#### Passing in the message on the command-line
|
||||
|
||||
If you'd like, you can also provide the message on the command-line with the
|
||||
`-m` or `--message` flag, as follows:
|
||||
|
||||
|
||||
```bash
|
||||
zulip-send --stream Denmark --subject Castle \
|
||||
--message "Something is rotten in the state of Denmark." \
|
||||
--user othello-bot@example.com --api-key a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5
|
||||
```
|
||||
|
||||
You can omit the `user` and `api-key` arguments if you have a `~/.zuliprc`
|
||||
file.
|
||||
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -14,31 +14,19 @@ Fetch global settings for a Zulip server.
|
|||
|
||||
## Usage examples
|
||||
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
{generate_code_example(python)|/server_settings:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
```
|
||||
curl {{ api_url }}/v1/server_settings \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
|
||||
{generate_code_example(python)|/server_settings:get|example}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -9,32 +9,13 @@ for details on Zulip's typing notifications protocol.
|
|||
|
||||
## Usage examples
|
||||
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="javascript">JavaScript</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
|
||||
```
|
||||
curl -X POST {{ api_url }}/v1/typing \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d "op=start" \
|
||||
-d 'to="iago@zulip.com","polonius@zulip.com"'
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
{generate_code_example(python)|/typing:post|example}
|
||||
|
||||
</div>
|
||||
{tab|js}
|
||||
|
||||
<div data-language="javascript" markdown="1">
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
```js
|
||||
const zulip = require('zulip-js');
|
||||
|
@ -54,11 +35,17 @@ zulip(config).then((client) => {
|
|||
return client.typing.send(typingParams);
|
||||
}).then(console.log);
|
||||
```
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{tab|curl}
|
||||
|
||||
</div>
|
||||
```
|
||||
curl -X POST {{ api_url }}/v1/typing \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d "op=start" \
|
||||
-d 'to="iago@zulip.com","polonius@zulip.com"'
|
||||
```
|
||||
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -8,30 +8,14 @@ Edit/update the content or topic of a message.
|
|||
message you wish you update.
|
||||
|
||||
## Usage examples
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
<li data-language="javascript">JavaScript</li>
|
||||
<li data-language="curl">curl</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
|
||||
<div data-language="curl" markdown="1">
|
||||
|
||||
```
|
||||
curl -X "PATCH" {{ api_url }}/v1/messages/<msg_id> \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d "content=New content"
|
||||
```
|
||||
</div>
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
{generate_code_example(python)|/messages/{message_id}:patch|example}
|
||||
|
||||
</div>
|
||||
{tab|js}
|
||||
|
||||
<div data-language="javascript" markdown="1">
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
```js
|
||||
const zulip = require('zulip-js');
|
||||
|
@ -51,11 +35,16 @@ zulip(config).then((client) => {
|
|||
client.messages.update(params).then(console.log);
|
||||
});
|
||||
```
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{tab|curl}
|
||||
|
||||
</div>
|
||||
```
|
||||
curl -X "PATCH" {{ api_url }}/v1/messages/<msg_id> \
|
||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||
-d "content=New content"
|
||||
```
|
||||
|
||||
{end_tabs}
|
||||
|
||||
## Permissions
|
||||
|
||||
|
|
|
@ -5,21 +5,11 @@ Upload a single file and get the corresponding URI.
|
|||
`POST {{ api_url }}/v1/user_uploads`
|
||||
|
||||
## Usage examples
|
||||
<div class="code-section" markdown="1">
|
||||
<ul class="nav">
|
||||
<li data-language="python">Python</li>
|
||||
</ul>
|
||||
<div class="blocks">
|
||||
|
||||
<div data-language="python" markdown="1">
|
||||
|
||||
{start_tabs}
|
||||
{tab|python}
|
||||
{generate_code_example(python)|/user_uploads:post|example}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{end_tabs}
|
||||
|
||||
## Arguments
|
||||
|
||||
|
|
|
@ -43,6 +43,10 @@ TAB_DISPLAY_NAMES = {
|
|||
'mac': 'macOS',
|
||||
'windows': 'Windows',
|
||||
'linux': 'Linux',
|
||||
'python': 'Python',
|
||||
'js': 'JavaScript',
|
||||
'curl': 'curl',
|
||||
'zulip-send': 'zulip-send',
|
||||
}
|
||||
|
||||
class TabbedSectionsGenerator(Extension):
|
||||
|
|
Loading…
Reference in New Issue