Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
js_examples: Migrate and test get_stream_topics example.
Kartik Srivastavacc7671e602e1
diff --git a/templates/zerver/api/get-stream-topics.md b/templates/zerver/api/get-stream-topics.mdindex e75788dcddc..2519578de96 100644--- a/templates/zerver/api/get-stream-topics.md+++ b/templates/zerver/api/get-stream-topics.md@@ -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}diff --git a/zerver/openapi/javascript_examples.js b/zerver/openapi/javascript_examples.jsindex 60dee1480e8..6bde24bfa45 100644--- a/zerver/openapi/javascript_examples.js+++ b/zerver/openapi/javascript_examples.js@@ -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();