mirror of https://github.com/zulip/zulip.git
js_examples: Migrate and test render_message example.
This commit is contained in:
parent
5a4d31825c
commit
a1f6540cec
|
@ -12,23 +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) => {
|
||||
// Render a message
|
||||
const params = {
|
||||
content: '**foo**',
|
||||
};
|
||||
|
||||
client.messages.render(params).then(console.log);
|
||||
});
|
||||
```
|
||||
{generate_code_example(javascript)|/messages/render:post|example}
|
||||
|
||||
{tab|curl}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ const ExamplesHandler = function () {
|
|||
await generate_validation_data(client, examples.get_subscriptions);
|
||||
await generate_validation_data(client, examples.get_users);
|
||||
await generate_validation_data(client, examples.register_queue);
|
||||
await generate_validation_data(client, examples.render_message);
|
||||
|
||||
console.log(JSON.stringify(response_data));
|
||||
return;
|
||||
|
@ -200,4 +201,15 @@ add_example('register_queue', '/register:post', 200, async (client) => {
|
|||
// {code_example|end}
|
||||
});
|
||||
|
||||
add_example('render_message', '/messages/render:post', 200, async (client) => {
|
||||
// {code_example|start}
|
||||
// Render a message
|
||||
const params = {
|
||||
content: '**foo**',
|
||||
};
|
||||
|
||||
return await client.messages.render(params);
|
||||
// {code_example|end}
|
||||
});
|
||||
|
||||
main();
|
||||
|
|
Loading…
Reference in New Issue