From 9385a841d7c537c7f1b5707ccf3ff10be92ea282 Mon Sep 17 00:00:00 2001 From: Vladimir Berdnikov Date: Wed, 31 Jul 2024 15:25:09 +0300 Subject: [PATCH] ULMS-3209 Added agent_label to some requests --- package-lock.json | 4 ++-- package.json | 2 +- src/ulms.js | 44 +++++++++++++++++++++++++++++++++++--------- 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 293eb0e..6549af5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@ulms/api-clients", - "version": "7.9.8", + "version": "7.9.9-dev.1-ULMS-3209", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@ulms/api-clients", - "version": "7.9.8", + "version": "7.9.9-dev.1-ULMS-3209", "license": "MIT", "dependencies": { "axios": "1.6.2", diff --git a/package.json b/package.json index 1834694..0ce31e9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ulms/api-clients", - "version": "7.9.8", + "version": "7.9.9-dev.1-ULMS-3209", "description": "JavaScript API clients for ULMS platform", "keywords": [], "homepage": "https://github.com/foxford/ulms-api-clients-js#readme", diff --git a/src/ulms.js b/src/ulms.js index 743488d..b3b23f8 100644 --- a/src/ulms.js +++ b/src/ulms.js @@ -70,6 +70,12 @@ const eventEndpoints = { */ class ULMS extends BasicClient { + agentLabel + + setAgentLabel(label) { + this.agentLabel = label + } + /** * Scope kind enum * @returns {{CHAT: string, MINIGROUP: string, P2P: string, WEBINAR: string}} @@ -187,6 +193,7 @@ class ULMS extends BasicClient { */ createEvent(roomId, type, data, eventParameters = {}) { const parameters = { + agent_label: this.agentLabel, ...eventParameters, data, type, @@ -237,7 +244,9 @@ class ULMS extends BasicClient { * @returns {Promise} */ createRtc(roomId) { - return this.post(this.url(`/conference_rooms/${roomId}/rtcs`)) + return this.post(this.url(`/conference_rooms/${roomId}/rtcs`), { + agent_label: this.agentLabel, + }) } /** @@ -255,6 +264,7 @@ class ULMS extends BasicClient { label, ) { const payload = { + agent_label: this.agentLabel, intent, jsep, label, @@ -415,7 +425,11 @@ class ULMS extends BasicClient { * @returns {Promise} */ readAgentReaderConfig(roomId) { - return this.get(this.url(`/conference_rooms/${roomId}/configs/reader`)) + return this.get( + this.url(`/conference_rooms/${roomId}/configs/reader`, { + agent_label: this.agentLabel, + }), + ) } /** @@ -424,7 +438,11 @@ class ULMS extends BasicClient { * @returns {Promise} */ readAgentWriterConfig(roomId) { - return this.get(this.url(`/conference_rooms/${roomId}/configs/writer`)) + return this.get( + this.url(`/conference_rooms/${roomId}/configs/writer`, { + agent_label: this.agentLabel, + }), + ) } /** @@ -574,9 +592,12 @@ class ULMS extends BasicClient { * @returns {Promise} */ readGroups(roomId, filterParameters) { - return this.get( - this.url(`/conference_rooms/${roomId}/groups`, filterParameters), - ) + const parameters = { + agent_label: this.agentLabel, + ...filterParameters, + } + + return this.get(this.url(`/conference_rooms/${roomId}/groups`, parameters)) } /** @@ -592,11 +613,16 @@ class ULMS extends BasicClient { /** * Update Groups * @param roomId - * @param {GroupConfig[]} payload + * @param {GroupConfig[]} groups * @returns {Promise} */ - updateGroups(roomId, payload) { - return this.post(this.url(`/conference_rooms/${roomId}/groups`), payload) + updateGroups(roomId, groups) { + const parameters = { + agent_label: this.agentLabel, + groups, + } + + return this.post(this.url(`/conference_rooms/${roomId}/groups`), parameters) } /**