mirror of https://github.com/zulip/zulip.git
js_examples: Migrate and test get_stream_topics example.
This commit is contained in:
parent
2c5815edbb
commit
cc7671e602
|
@ -12,20 +12,8 @@
|
|||
{tab|js}
|
||||
|
||||
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
||||
```js
|
||||
const zulip = require('zulip-js');
|
||||
|
||||
// Pass the path to your zuliprc file here.
|
||||
const config = {
|
||||
zuliprc: 'zuliprc',
|
||||
};
|
||||
|
||||
zulip(config).then((client) => {
|
||||
// Get all the topics in stream with ID 1
|
||||
return client.streams.topics.retrieve({ stream_id: 1 });
|
||||
}).then(console.log);
|
||||
|
||||
```
|
||||
{generate_code_example(javascript)|/users/me/{stream_id}/topics:get|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ const ExamplesHandler = function () {
|
|||
await generate_validation_data(client, examples.get_messages);
|
||||
await generate_validation_data(client, examples.get_own_user);
|
||||
await generate_validation_data(client, examples.get_stream_id);
|
||||
await generate_validation_data(client, examples.get_stream_topics);
|
||||
|
||||
console.log(JSON.stringify(response_data));
|
||||
return;
|
||||
|
@ -158,4 +159,11 @@ add_example('get_stream_id', '/get_stream_id:get', 200, async (client) => {
|
|||
// {code_example|end}
|
||||
});
|
||||
|
||||
add_example('get_stream_topics', '/users/me/{stream_id}/topics:get', 200, async (client) => {
|
||||
// {code_example|start}
|
||||
// Get all the topics in stream with ID 1
|
||||
return client.streams.topics.retrieve({ stream_id: 1 });
|
||||
// {code_example|end}
|
||||
});
|
||||
|
||||
main();
|
||||
|
|
Loading…
Reference in New Issue