Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
js_examples: Migrate and test get_subscriptions example.
Kartik Srivastava69a7d7fd3062
diff --git a/templates/zerver/api/get-subscriptions.md b/templates/zerver/api/get-subscriptions.mdindex 54b1e6c45f6..474c2d3f19d 100644--- a/templates/zerver/api/get-subscriptions.md+++ b/templates/zerver/api/get-subscriptions.md@@ -13,20 +13,7 @@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 streams that the user is subscribed to- client.streams.subscriptions.retrieve().then(console.log);-});--```+{generate_code_example(javascript)|/users/me/subscriptions:get|example}{tab|curl}diff --git a/zerver/openapi/javascript_examples.js b/zerver/openapi/javascript_examples.jsindex 6bde24bfa45..872b803071e 100644--- a/zerver/openapi/javascript_examples.js+++ b/zerver/openapi/javascript_examples.js@@ -43,6 +43,7 @@ const ExamplesHandler = function () {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);+ await generate_validation_data(client, examples.get_subscriptions);console.log(JSON.stringify(response_data));return;@@ -72,7 +73,7 @@ add_example('send_message', '/messages:post', 200, async (client) => {// {code_example|start}// Send a stream messagelet params = {- to: 'Denmark',+ to: 'social',type: 'stream',topic: 'Castle',content: 'I come not, friends, to steal away your hearts.',@@ -166,4 +167,11 @@ add_example('get_stream_topics', '/users/me/{stream_id}/topics:get', 200, async// {code_example|end}});+add_example('get_subscriptions', '/users/me/subscriptions:get', 200, async (client) => {+ // {code_example|start}+ // Get all streams that the user is subscribed to+ return await client.streams.subscriptions.retrieve();+ // {code_example|end}+});+main();