Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

js_examples: Migrate and test get_custom_emoji example.

Kartik Srivastavaf96c86ad631f
diff --git a/templates/zerver/api/get-custom-emoji.md b/templates/zerver/api/get-custom-emoji.md
index 88e3477bd37..9e79094b0fa 100644
--- a/templates/zerver/api/get-custom-emoji.md
+++ b/templates/zerver/api/get-custom-emoji.md
@@ -12,18 +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) => {
- return client.emojis.retrieve();
-}).then(console.log);
-```
+
+{generate_code_example(javascript)|/realm/emoji:get|example}
{tab|curl}
diff --git a/zerver/openapi/javascript_examples.js b/zerver/openapi/javascript_examples.js
index 04e7f593310..c8410790aa3 100644
--- a/zerver/openapi/javascript_examples.js
+++ b/zerver/openapi/javascript_examples.js
@@ -37,6 +37,7 @@ const ExamplesHandler = function () {
await generate_validation_data(client, examples.send_message);
await generate_validation_data(client, examples.create_user);
+ await generate_validation_data(client, examples.get_custom_emoji);
console.log(JSON.stringify(response_data));
return;
@@ -100,4 +101,10 @@ add_example('create_user', '/users:post', 200, async (client) => {
// {code_example|end}
});
+add_example('get_custom_emoji', '/realm/emoji:get', 200, async (client) => {
+ // {code_example|start}
+ return await client.emojis.retrieve();
+ // {code_example|end}
+});
+
main();