From 0c0d428370e9d66cf20f3eff23d90dff498a6899 Mon Sep 17 00:00:00 2001 From: Aleksey Konstantinov Date: Tue, 22 Aug 2023 22:56:49 +0300 Subject: [PATCH] ULMS-2551 Added fetchTokenData method for dispatcher client --- package-lock.json | 4 ++-- package.json | 2 +- src/dispatcher.js | 12 ++++++++++++ src/nats-gatekeeper.js | 4 ++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index b74523f..72ec980 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@ulms/api-clients", - "version": "5.25.0", + "version": "5.26.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@ulms/api-clients", - "version": "5.25.0", + "version": "5.26.0", "license": "MIT", "dependencies": { "debug": "4.3.4", diff --git a/package.json b/package.json index 7ee0520..0139aef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ulms/api-clients", - "version": "5.25.0", + "version": "5.26.0", "description": "JavaScript API clients for ULMS platform", "keywords": [], "homepage": "https://github.com/foxford/ulms-api-clients-js#readme", diff --git a/src/dispatcher.js b/src/dispatcher.js index 74826e1..fff140a 100644 --- a/src/dispatcher.js +++ b/src/dispatcher.js @@ -63,6 +63,18 @@ class Dispatcher extends BasicClient { ) } + /** + * Fetch token data for NATS + * @param {string} audience + * @param {string} classroomId + * @returns {Promise} + */ + fetchTokenData(audience, classroomId) { + return this.post( + `${this.baseUrl}/audiences/${audience}/classrooms/${classroomId}/tokens` + ) + } + /** * Read dispatcher scope * @param {string} kind diff --git a/src/nats-gatekeeper.js b/src/nats-gatekeeper.js index 1824303..359318e 100644 --- a/src/nats-gatekeeper.js +++ b/src/nats-gatekeeper.js @@ -1,8 +1,12 @@ import BasicClient from './basic-client' +/** + * @deprecated + */ class NatsGatekeeper extends BasicClient { /** * Fetch token data + * @deprecated * @param {string} audience * @param {string} classroomId * @returns {Promise}