mirror of
https://github.com/donl/plivo-node.git
synced 2026-06-05 06:12:31 -06:00
Merge branch 'master' into list-mdr-ppk-filter
This commit is contained in:
commit
3f362d73c9
2 changed files with 137 additions and 94 deletions
|
|
@ -2,6 +2,9 @@
|
|||
## [v4.20.0](https://github.com/plivo/plivo-node/tree/v4.20.0) (2021-07-06)
|
||||
- Powerpack ID filter for list MDR
|
||||
|
||||
## [v4.19.2](https://github.com/plivo/plivo-node/tree/v4.19.2) (2021-07-08)
|
||||
- MPC SDK fixes to pass params in a user-friendly manner.
|
||||
|
||||
## [v4.19.1](https://github.com/plivo/plivo-node/tree/v4.19.1) (2021-07-05)
|
||||
- **WARNING**: Removed the total_count parameter in meta data for list MDR response
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import {
|
|||
validRange,
|
||||
validMultipleDestinationNos,
|
||||
validMultipleDestinationIntegers,
|
||||
isOneAmongStringUrl, multiValidParam
|
||||
isOneAmongStringUrl, multiValidParam, InvalidRequestError
|
||||
} from '../rest/utils.js'
|
||||
|
||||
const clientKey = Symbol();
|
||||
|
|
@ -311,8 +311,14 @@ export class MultiPartyCall extends PlivoResource{
|
|||
return super.executeAction(this.id + '/Participant/', 'POST', params)
|
||||
}
|
||||
|
||||
start(){
|
||||
return super.executeAction(this.id + '/', 'POST', {'status' : 'active', 'isVoiceRequest' : 'true'})
|
||||
start(params){
|
||||
if(params.status) {
|
||||
validParam('status', params.status.toLowerCase(), [String], true, 'active')
|
||||
}
|
||||
else{
|
||||
throw new InvalidRequestError("status is a mandatory parameter");
|
||||
}
|
||||
return super.executeAction(this.id + '/', 'POST', {'status' : params.status.toLowerCase(), 'isVoiceRequest' : 'true'})
|
||||
}
|
||||
|
||||
stop(){
|
||||
|
|
@ -509,14 +515,16 @@ export class MultiPartyCallInterface extends PlivoResourceInterface{
|
|||
return super.list(params);
|
||||
}
|
||||
|
||||
get(uuid = null, friendlyName = null){
|
||||
if(uuid){
|
||||
validParam('uuid', uuid, [String], false)
|
||||
get(params={}){
|
||||
if(params.uuid){
|
||||
validParam('uuid', params.uuid, [String], false)
|
||||
}
|
||||
if(friendlyName){
|
||||
validParam('friendlyName', friendlyName, [String], false)
|
||||
if(params.friendlyName){
|
||||
validParam('friendlyName', params.friendlyName, [String], false)
|
||||
}
|
||||
let mpcId = this.makeMpcId(uuid, friendlyName)
|
||||
let mpcId = this.makeMpcId(params.uuid, params.friendlyName)
|
||||
delete params.uuid
|
||||
delete params.friendlyName
|
||||
return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).get();
|
||||
}
|
||||
|
||||
|
|
@ -534,160 +542,192 @@ export class MultiPartyCallInterface extends PlivoResourceInterface{
|
|||
return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).addParticipant(params)
|
||||
}
|
||||
|
||||
start(uuid = null, friendlyName = null){
|
||||
if(uuid){
|
||||
validParam('uuid', uuid, [String], false)
|
||||
start(params = {}){
|
||||
if(params.uuid){
|
||||
validParam('uuid', params.uuid, [String], false)
|
||||
}
|
||||
if(friendlyName){
|
||||
validParam('friendlyName', friendlyName, [String], false)
|
||||
if(params.friendlyName){
|
||||
validParam('friendlyName', params.friendlyName, [String], false)
|
||||
}
|
||||
let mpcId = this.makeMpcId(uuid, friendlyName)
|
||||
return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).start()
|
||||
let mpcId = this.makeMpcId(params.uuid, params.friendlyName)
|
||||
delete params.uuid
|
||||
delete params.friendlyName
|
||||
return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).start(params)
|
||||
}
|
||||
|
||||
stop(uuid = null, friendlyName = null){
|
||||
if(uuid){
|
||||
validParam('uuid', uuid, [String], false)
|
||||
stop(params = {}){
|
||||
if(params.uuid){
|
||||
validParam('uuid', params.uuid, [String], false)
|
||||
}
|
||||
if(friendlyName){
|
||||
validParam('friendlyName', friendlyName, [String], false)
|
||||
if(params.friendlyName){
|
||||
validParam('friendlyName', params.friendlyName, [String], false)
|
||||
}
|
||||
let mpcId = this.makeMpcId(uuid, friendlyName)
|
||||
let mpcId = this.makeMpcId(params.uuid, params.friendlyName)
|
||||
delete params.uuid
|
||||
delete params.friendlyName
|
||||
return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).stop()
|
||||
}
|
||||
|
||||
startRecording(uuid = null, friendlyName = null, params){
|
||||
if(uuid){
|
||||
validParam('uuid', uuid, [String], false)
|
||||
startRecording(params={}){
|
||||
if(params.uuid){
|
||||
validParam('uuid', params.uuid, [String], false)
|
||||
}
|
||||
if(friendlyName){
|
||||
validParam('friendlyName', friendlyName, [String], false)
|
||||
if(params.friendlyName){
|
||||
validParam('friendlyName', params.friendlyName, [String], false)
|
||||
}
|
||||
let mpcId = this.makeMpcId(uuid, friendlyName)
|
||||
let mpcId = this.makeMpcId(params.uuid, params.friendlyName)
|
||||
delete params.uuid
|
||||
delete params.friendlyName
|
||||
return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).startRecording(params)
|
||||
}
|
||||
|
||||
stopRecording(uuid = null, friendlyName = null){
|
||||
if(uuid){
|
||||
validParam('uuid', uuid, [String], false)
|
||||
stopRecording(params={}){
|
||||
if(params.uuid){
|
||||
validParam('uuid', params.uuid, [String], false)
|
||||
}
|
||||
if(friendlyName){
|
||||
validParam('friendlyName', friendlyName, [String], false)
|
||||
if(params.friendlyName){
|
||||
validParam('friendlyName', params.friendlyName, [String], false)
|
||||
}
|
||||
let mpcId = this.makeMpcId(uuid, friendlyName)
|
||||
let mpcId = this.makeMpcId(params.uuid, params.friendlyName)
|
||||
delete params.uuid
|
||||
delete params.friendlyName
|
||||
return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).stopRecording()
|
||||
}
|
||||
|
||||
pauseRecording(uuid = null, friendlyName = null){
|
||||
if(uuid){
|
||||
validParam('uuid', uuid, [String], false)
|
||||
pauseRecording(params={}){
|
||||
if(params.uuid){
|
||||
validParam('uuid', params.uuid, [String], false)
|
||||
}
|
||||
if(friendlyName){
|
||||
validParam('friendlyName', friendlyName, [String], false)
|
||||
if(params.friendlyName){
|
||||
validParam('friendlyName', params.friendlyName, [String], false)
|
||||
}
|
||||
let mpcId = this.makeMpcId(uuid, friendlyName)
|
||||
let mpcId = this.makeMpcId(params.uuid, params.friendlyName)
|
||||
delete params.uuid
|
||||
delete params.friendlyName
|
||||
return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).pauseRecording()
|
||||
}
|
||||
|
||||
resumeRecording(uuid = null, friendlyName = null){
|
||||
if(uuid){
|
||||
validParam('uuid', uuid, [String], false)
|
||||
resumeRecording(params={}){
|
||||
if(params.uuid){
|
||||
validParam('uuid', params.uuid, [String], false)
|
||||
}
|
||||
if(friendlyName){
|
||||
validParam('friendlyName', friendlyName, [String], false)
|
||||
if(params.friendlyName){
|
||||
validParam('friendlyName', params.friendlyName, [String], false)
|
||||
}
|
||||
let mpcId = this.makeMpcId(uuid, friendlyName)
|
||||
let mpcId = this.makeMpcId(params.uuid, params.friendlyName)
|
||||
delete params.uuid
|
||||
delete params.friendlyName
|
||||
return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).resumeRecording()
|
||||
}
|
||||
|
||||
startParticipantRecording(participantId, uuid = null, friendlyName = null, params){
|
||||
if(uuid){
|
||||
validParam('uuid', uuid, [String], false)
|
||||
startParticipantRecording(participantId, params={}){
|
||||
validParam('participantId', participantId, [String, Number], true)
|
||||
if(params.uuid){
|
||||
validParam('uuid', params.uuid, [String], false)
|
||||
}
|
||||
if(friendlyName){
|
||||
validParam('friendlyName', friendlyName, [String], false)
|
||||
if(params.friendlyName){
|
||||
validParam('friendlyName', params.friendlyName, [String], false)
|
||||
}
|
||||
let mpcId = this.makeMpcId(uuid, friendlyName)
|
||||
let mpcId = this.makeMpcId(params.uuid, params.friendlyName)
|
||||
delete params.uuid
|
||||
delete params.friendlyName
|
||||
return new MultiPartyCallParticipant(this[clientKey], {id: mpcId[0] + mpcId[1], secondaryId: participantId}).startParticipantRecording(params)
|
||||
}
|
||||
|
||||
stopParticipantRecording(participantId, uuid = null, friendlyName = null){
|
||||
if(uuid){
|
||||
validParam('uuid', uuid, [String], false)
|
||||
stopParticipantRecording(participantId, params={}){
|
||||
validParam('participantId', participantId, [String, Number], true)
|
||||
if(params.uuid){
|
||||
validParam('uuid', params.uuid, [String], false)
|
||||
}
|
||||
if(friendlyName){
|
||||
validParam('friendlyName', friendlyName, [String], false)
|
||||
if(params.friendlyName){
|
||||
validParam('friendlyName', params.friendlyName, [String], false)
|
||||
}
|
||||
let mpcId = this.makeMpcId(uuid, friendlyName)
|
||||
let mpcId = this.makeMpcId(params.uuid, params.friendlyName)
|
||||
delete params.uuid
|
||||
delete params.friendlyName
|
||||
return new MultiPartyCallParticipant(this[clientKey], {id: mpcId[0] + mpcId[1], secondaryId: participantId}).stopParticipantRecording()
|
||||
}
|
||||
|
||||
pauseParticipantRecording(participantId, uuid = null, friendlyName = null){
|
||||
if(uuid){
|
||||
validParam('uuid', uuid, [String], false)
|
||||
pauseParticipantRecording(participantId, params={}){
|
||||
validParam('participantId', participantId, [String, Number], true)
|
||||
if(params.uuid){
|
||||
validParam('uuid', params.uuid, [String], false)
|
||||
}
|
||||
if(friendlyName){
|
||||
validParam('friendlyName', friendlyName, [String], false)
|
||||
if(params.friendlyName){
|
||||
validParam('friendlyName', params.friendlyName, [String], false)
|
||||
}
|
||||
let mpcId = this.makeMpcId(uuid, friendlyName)
|
||||
let mpcId = this.makeMpcId(params.uuid, params.friendlyName)
|
||||
delete params.uuid
|
||||
delete params.friendlyName
|
||||
return new MultiPartyCallParticipant(this[clientKey], {id: mpcId[0] + mpcId[1], secondaryId: participantId}).pauseParticipantRecording()
|
||||
}
|
||||
|
||||
resumeParticipantRecording(participantId, uuid = null, friendlyName = null){
|
||||
if(uuid){
|
||||
validParam('uuid', uuid, [String], false)
|
||||
resumeParticipantRecording(participantId, params={}){
|
||||
validParam('participantId', participantId, [String, Number], true)
|
||||
if(params.uuid){
|
||||
validParam('uuid', params.uuid, [String], false)
|
||||
}
|
||||
if(friendlyName){
|
||||
validParam('friendlyName', friendlyName, [String], false)
|
||||
if(params.friendlyName){
|
||||
validParam('friendlyName', params.friendlyName, [String], false)
|
||||
}
|
||||
let mpcId = this.makeMpcId(uuid, friendlyName)
|
||||
let mpcId = this.makeMpcId(params.uuid, params.friendlyName)
|
||||
delete params.uuid
|
||||
delete params.friendlyName
|
||||
return new MultiPartyCallParticipant(this[clientKey], {id: mpcId[0] + mpcId[1], secondaryId: participantId}).resumeParticipantRecording()
|
||||
}
|
||||
|
||||
listParticipants(uuid = null, friendlyName = null, params){
|
||||
if(uuid){
|
||||
validParam('uuid', uuid, [String], false)
|
||||
listParticipants(params={}){
|
||||
if(params.uuid){
|
||||
validParam('uuid', params.uuid, [String], false)
|
||||
}
|
||||
if(friendlyName){
|
||||
validParam('friendlyName', friendlyName, [String], false)
|
||||
if(params.friendlyName){
|
||||
validParam('friendlyName', params.friendlyName, [String], false)
|
||||
}
|
||||
let mpcId = this.makeMpcId(uuid, friendlyName)
|
||||
let mpcId = this.makeMpcId(params.uuid, params.friendlyName)
|
||||
delete params.uuid
|
||||
delete params.friendlyName
|
||||
return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).listParticipants(params)
|
||||
}
|
||||
|
||||
updateParticipant(participantId, uuid= null, friendlyName = null, params){
|
||||
updateParticipant(participantId, params={}){
|
||||
validParam('participantId', participantId, [String, Number], true)
|
||||
if(uuid){
|
||||
validParam('uuid', uuid, [String], false)
|
||||
if(params.uuid){
|
||||
validParam('uuid', params.uuid, [String], false)
|
||||
}
|
||||
if(friendlyName){
|
||||
validParam('friendlyName', friendlyName, [String], false)
|
||||
if(params.friendlyName){
|
||||
validParam('friendlyName', params.friendlyName, [String], false)
|
||||
}
|
||||
let mpcId = this.makeMpcId(uuid, friendlyName)
|
||||
let mpcId = this.makeMpcId(params.uuid, params.friendlyName)
|
||||
delete params.uuid
|
||||
delete params.friendlyName
|
||||
return new MultiPartyCallParticipant(this[clientKey], {id: mpcId[0] + mpcId[1], secondaryId: participantId}).updateParticipant(params)
|
||||
}
|
||||
|
||||
kickParticipant(participantId, uuid = null, friendlyName = null){
|
||||
kickParticipant(participantId, params={}){
|
||||
validParam('participantId', participantId, [String, Number], true)
|
||||
if(uuid){
|
||||
validParam('uuid', uuid, [String], false)
|
||||
if(params.uuid){
|
||||
validParam('uuid', params.uuid, [String], false)
|
||||
}
|
||||
if(friendlyName){
|
||||
validParam('friendlyName', friendlyName, [String], false)
|
||||
if(params.friendlyName){
|
||||
validParam('friendlyName', params.friendlyName, [String], false)
|
||||
}
|
||||
let mpcId = this.makeMpcId(uuid, friendlyName)
|
||||
let mpcId = this.makeMpcId(params.uuid, params.friendlyName)
|
||||
delete params.uuid
|
||||
delete params.friendlyName
|
||||
return new MultiPartyCallParticipant(this[clientKey], {id: mpcId[0] + mpcId[1], secondaryId: participantId}).kickParticipant()
|
||||
}
|
||||
|
||||
getParticipant(participantId, uuid = null, friendlyName = null){
|
||||
getParticipant(participantId, params={}){
|
||||
validParam('participantId', participantId, [String, Number], true)
|
||||
if(uuid){
|
||||
validParam('uuid', uuid, [String], false)
|
||||
if(params.uuid){
|
||||
validParam('uuid', params.uuid, [String], false)
|
||||
}
|
||||
if(friendlyName){
|
||||
validParam('friendlyName', friendlyName, [String], false)
|
||||
if(params.friendlyName){
|
||||
validParam('friendlyName', params.friendlyName, [String], false)
|
||||
}
|
||||
let mpcId = this.makeMpcId(uuid, friendlyName)
|
||||
let mpcId = this.makeMpcId(params.uuid, params.friendlyName)
|
||||
delete params.uuid
|
||||
delete params.friendlyName
|
||||
return new MultiPartyCallParticipant(this[clientKey], {id: mpcId[0] + mpcId[1], secondaryId: participantId}).getParticipant()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue