Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
js_examples: Migrate and test delete_queue example.
Kartik Srivastava57e27ff7dbd5
diff --git a/templates/zerver/api/delete-queue.md b/templates/zerver/api/delete-queue.mdindex e05ba3dd0c2..b79b6a5cca5 100644--- a/templates/zerver/api/delete-queue.md+++ b/templates/zerver/api/delete-queue.md@@ -13,29 +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) => {- // Register a queue- const queueParams = {- event_types: ['message']- };- client.queues.register(queueParams).then((res) => {- // Delete a queue- const deregisterParams = {- queue_id: res.queue_id,- };- client.queues.deregister(deregisterParams).then(console.log);- });-});--```+{generate_code_example(javascript)|/events:delete|example}{tab|curl}diff --git a/zerver/openapi/javascript_examples.js b/zerver/openapi/javascript_examples.jsindex c8410790aa3..f02adeb5f14 100644--- a/zerver/openapi/javascript_examples.js+++ b/zerver/openapi/javascript_examples.js@@ -38,6 +38,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);+ await generate_validation_data(client, examples.delete_queue);console.log(JSON.stringify(response_data));return;@@ -107,4 +108,21 @@ add_example('get_custom_emoji', '/realm/emoji:get', 200, async (client) => {// {code_example|end}});+add_example('delete_queue', '/events:delete', 200, async (client) => {+ // {code_example|start}+ // Register a queue+ const queueParams = {+ event_types: ['message'],+ };+ const res = await client.queues.register(queueParams);++ // Delete a queue+ const deregisterParams = {+ queue_id: res.queue_id,+ };++ return await client.queues.deregister(deregisterParams);+ // {code_example|end}+});+main();