Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
js_examples: Migrate and test get_own_user example.
Kartik Srivastava63127d4990f4
diff --git a/templates/zerver/api/get-own-user.md b/templates/zerver/api/get-own-user.mdindex 7dcdd3efe74..f81096d0dec 100644--- a/templates/zerver/api/get-own-user.md+++ b/templates/zerver/api/get-own-user.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 the profile of the user/bot that requests this endpoint,- // which is `client` in this case:- client.users.me.getProfile().then(console.log);-});-```++{generate_code_example(javascript)|/users/me:get|example}{tab|curl}diff --git a/zerver/openapi/javascript_examples.js b/zerver/openapi/javascript_examples.jsindex 50765425860..1df5968c2fc 100644--- a/zerver/openapi/javascript_examples.js+++ b/zerver/openapi/javascript_examples.js@@ -40,6 +40,7 @@ const ExamplesHandler = function () {await generate_validation_data(client, examples.get_custom_emoji);await generate_validation_data(client, examples.delete_queue);await generate_validation_data(client, examples.get_messages);+ await generate_validation_data(client, examples.get_own_user);console.log(JSON.stringify(response_data));return;@@ -141,4 +142,12 @@ add_example('get_messages', '/messages:get', 200, async (client) => {// {code_example|end}});+add_example('get_own_user', '/users/me:get', 200, async (client) => {+ // {code_example|start}+ // Get the profile of the user/bot that requests this endpoint,+ // which is `client` in this case:+ return await client.users.me.getProfile();+ // {code_example|end}+});+main();