Skip to content

Commit

Permalink
ULMS-3209 Added agent_label to some requests
Browse files Browse the repository at this point in the history
  • Loading branch information
dkvovik committed Aug 5, 2024
1 parent de7d7d7 commit 95f51da
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ulms/api-clients",
"version": "7.9.9",
"version": "7.9.10",
"description": "JavaScript API clients for ULMS platform",
"keywords": [],
"homepage": "https://github.com/foxford/ulms-api-clients-js#readme",
Expand Down
55 changes: 44 additions & 11 deletions src/ulms.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down Expand Up @@ -187,6 +193,7 @@ class ULMS extends BasicClient {
*/
createEvent(roomId, type, data, eventParameters = {}) {
const parameters = {
agent_label: this.agentLabel,
...eventParameters,
data,
type,
Expand Down Expand Up @@ -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,
})
}

/**
Expand All @@ -255,6 +264,7 @@ class ULMS extends BasicClient {
label,
) {
const payload = {
agent_label: this.agentLabel,
intent,
jsep,
label,
Expand All @@ -271,6 +281,7 @@ class ULMS extends BasicClient {
*/
createTrickleSignal(handleId, candidates) {
const payload = {
agent_label: this.agentLabel,
candidates,
handle_id: handleId,
}
Expand Down Expand Up @@ -415,7 +426,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,
}),
)
}

/**
Expand All @@ -424,7 +439,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,
}),
)
}

/**
Expand Down Expand Up @@ -520,7 +539,10 @@ class ULMS extends BasicClient {
* @returns {Promise}
*/
updateAgentReaderConfig(roomId, configs) {
const payload = { configs }
const payload = {
agent_label: this.agentLabel,
configs,
}

return this.post(
this.url(`/conference_rooms/${roomId}/configs/reader`),
Expand All @@ -535,7 +557,10 @@ class ULMS extends BasicClient {
* @returns {Promise}
*/
updateAgentWriterConfig(roomId, configs) {
const payload = { configs }
const payload = {
agent_label: this.agentLabel,
configs,
}

return this.post(
this.url(`/conference_rooms/${roomId}/configs/writer`),
Expand Down Expand Up @@ -574,9 +599,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))
}

/**
Expand All @@ -592,11 +620,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)
}

/**
Expand Down

0 comments on commit 95f51da

Please sign in to comment.