From b76ad74cee02a34109f9758e330f4222097ea14c Mon Sep 17 00:00:00 2001 From: Aleksey Konstantinov Date: Wed, 25 Jan 2023 23:27:42 +0300 Subject: [PATCH] ULMS-2213 Added methods for reading and updating groups (Conference) --- package-lock.json | 4 ++-- package.json | 2 +- src/conference.js | 2 ++ src/http-conference.js | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index cd79055..757788b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@ulms/api-clients", - "version": "5.11.0", + "version": "5.12.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@ulms/api-clients", - "version": "5.11.0", + "version": "5.12.0", "license": "MIT", "dependencies": { "events": "3.3.0", diff --git a/package.json b/package.json index be44420..44ac041 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ulms/api-clients", - "version": "5.11.0", + "version": "5.12.0", "description": "JavaScript API clients for ULMS platform", "keywords": [], "homepage": "https://github.com/foxford/ulms-api-clients-js#readme", diff --git a/src/conference.js b/src/conference.js index 2a50755..500b0a2 100644 --- a/src/conference.js +++ b/src/conference.js @@ -24,6 +24,7 @@ class Conference extends Service { * Conference events enum * @returns {{ * AGENT_WRITER_CONFIG_UPDATE: string, + * GROUP_UPDATE: string, * ROOM_CLOSE: string, * ROOM_ENTER: string, * ROOM_LEAVE: string, @@ -35,6 +36,7 @@ class Conference extends Service { static get events() { return { AGENT_WRITER_CONFIG_UPDATE: 'agent_writer_config.update', + GROUP_UPDATE: 'group.update', ROOM_CLOSE: 'room.close', ROOM_ENTER: 'room.enter', ROOM_LEAVE: 'room.leave', diff --git a/src/http-conference.js b/src/http-conference.js index 340718e..448a654 100644 --- a/src/http-conference.js +++ b/src/http-conference.js @@ -27,6 +27,14 @@ import BasicClient from './basic-client' * @property {number} offset */ +/** + * Group configuration + * @name GroupConfig + * @type {object} + * @property {number} number + * @property {string[]} agents + */ + /** * Extended parameters to filter listing requests of rtc streams * @name RtcStreamFilterParameters @@ -36,11 +44,19 @@ import BasicClient from './basic-client' * @property {[number | null, number | null]} time */ +/** + * Filter parameters for groups read requests + * @name GroupsFilterParameters + * @type {object} + * @property {number} within_group + */ + class HTTPConference extends BasicClient { /** * Conference events enum * @returns {{ * AGENT_WRITER_CONFIG_UPDATE: string, + * GROUP_UPDATE: string, * ROOM_CLOSE: string, * ROOM_ENTER: string, * ROOM_LEAVE: string, @@ -52,6 +68,7 @@ class HTTPConference extends BasicClient { static get events() { return { AGENT_WRITER_CONFIG_UPDATE: 'agent_writer_config.update', + GROUP_UPDATE: 'group.update', ROOM_CLOSE: 'room.close', ROOM_ENTER: 'room.enter', ROOM_LEAVE: 'room.leave', @@ -252,6 +269,16 @@ class HTTPConference extends BasicClient { return this.get(this.url(`/rooms/${roomId}/configs/writer`)) } + /** + * Read Groups + * @param roomId + * @param {GroupsFilterParameters|Object} filterParameters + * @returns {Promise} + */ + readGroups(roomId, filterParameters) { + return this.get(this.url(`/rooms/${roomId}/groups`, filterParameters)) + } + /** * Update AgentReaderConfig * @param roomId @@ -275,6 +302,16 @@ class HTTPConference extends BasicClient { return this.post(this.url(`/rooms/${roomId}/configs/writer`), payload) } + + /** + * Update Groups + * @param roomId + * @param {GroupConfig[]} payload + * @returns {Promise} + */ + updateGroups(roomId, payload) { + return this.post(this.url(`/rooms/${roomId}/groups`), payload) + } } export default HTTPConference