@unboundcx/sdk 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,7 +40,11 @@ export class VerificationService {
40
40
  body: { phoneNumber, code },
41
41
  };
42
42
 
43
- const result = await this.sdk._fetch('/verification/sms/validate', 'POST', params);
43
+ const result = await this.sdk._fetch(
44
+ '/verification/sms/validate',
45
+ 'POST',
46
+ params,
47
+ );
44
48
  return result;
45
49
  }
46
50
 
@@ -81,7 +85,11 @@ export class VerificationService {
81
85
  body: { email, code },
82
86
  };
83
87
 
84
- const result = await this.sdk._fetch('/verification/email/validate', 'POST', params);
88
+ const result = await this.sdk._fetch(
89
+ '/verification/email/validate',
90
+ 'POST',
91
+ params,
92
+ );
85
93
  return result;
86
94
  }
87
- }
95
+ }
package/services/video.js CHANGED
@@ -5,7 +5,12 @@ export class VideoService {
5
5
 
6
6
  async clearToken() {
7
7
  const params = {};
8
- const result = await this.sdk._fetch(`/video/clearVideoToken`, 'POST', params, true);
8
+ const result = await this.sdk._fetch(
9
+ `/video/clearVideoToken`,
10
+ 'POST',
11
+ params,
12
+ true,
13
+ );
9
14
  return result;
10
15
  }
11
16
 
@@ -211,13 +216,19 @@ export class VideoService {
211
216
  if ('startTime' in update) validationSchema.startTime = { type: 'string' };
212
217
  if ('endTime' in update) validationSchema.endTime = { type: 'string' };
213
218
  if ('timezone' in update) validationSchema.timezone = { type: 'string' };
214
- if ('waitingRoom' in update) validationSchema.waitingRoom = { type: 'boolean' };
219
+ if ('waitingRoom' in update)
220
+ validationSchema.waitingRoom = { type: 'boolean' };
215
221
  if ('hosts' in update) validationSchema.hosts = { type: 'array' };
216
- if ('participants' in update) validationSchema.participants = { type: 'array' };
217
- if ('startCameraMuted' in update) validationSchema.startCameraMuted = { type: 'boolean' };
218
- if ('startCameraMutedAfter' in update) validationSchema.startCameraMutedAfter = { type: 'number' };
219
- if ('startMicrophoneMuted' in update) validationSchema.startMicrophoneMuted = { type: 'boolean' };
220
- if ('startMicrophoneMutedAfter' in update) validationSchema.startMicrophoneMutedAfter = { type: 'number' };
222
+ if ('participants' in update)
223
+ validationSchema.participants = { type: 'array' };
224
+ if ('startCameraMuted' in update)
225
+ validationSchema.startCameraMuted = { type: 'boolean' };
226
+ if ('startCameraMutedAfter' in update)
227
+ validationSchema.startCameraMutedAfter = { type: 'number' };
228
+ if ('startMicrophoneMuted' in update)
229
+ validationSchema.startMicrophoneMuted = { type: 'boolean' };
230
+ if ('startMicrophoneMutedAfter' in update)
231
+ validationSchema.startMicrophoneMutedAfter = { type: 'number' };
221
232
 
222
233
  if (Object.keys(validationSchema).length > 0) {
223
234
  this.sdk.validateParams(update, validationSchema);
@@ -271,7 +282,7 @@ export class VideoService {
271
282
  const params = {
272
283
  query: options,
273
284
  };
274
-
285
+
275
286
  const result = await this.sdk._fetch('/video/meetings', 'GET', params);
276
287
  return result;
277
288
  }
@@ -281,25 +292,31 @@ export class VideoService {
281
292
  { roomId },
282
293
  {
283
294
  roomId: { type: 'string', required: true },
284
- }
295
+ },
285
296
  );
286
-
297
+
287
298
  // Validate optional parameters
288
299
  const validationSchema = {};
289
- if ('participantId' in params) validationSchema.participantId = { type: 'string' };
290
- if ('startTime' in params) validationSchema.startTime = { type: 'string' };
300
+ if ('participantId' in params)
301
+ validationSchema.participantId = { type: 'string' };
302
+ if ('startTime' in params) validationSchema.startTime = { type: 'string' };
291
303
  if ('endTime' in params) validationSchema.endTime = { type: 'string' };
292
- if ('granularity' in params) validationSchema.granularity = { type: 'string' };
304
+ if ('granularity' in params)
305
+ validationSchema.granularity = { type: 'string' };
293
306
  if ('timezone' in params) validationSchema.timezone = { type: 'string' };
294
307
  if (Object.keys(validationSchema).length > 0) {
295
308
  this.sdk.validateParams(params, validationSchema);
296
309
  }
297
-
310
+
298
311
  const options = {
299
312
  query: params,
300
- }
313
+ };
301
314
 
302
- const result = await this.sdk._fetch(`/video/meetings/${roomId}/analytics`, 'GET', options);
315
+ const result = await this.sdk._fetch(
316
+ `/video/meetings/${roomId}/analytics`,
317
+ 'GET',
318
+ options,
319
+ );
303
320
  return result;
304
321
  }
305
322
 
@@ -327,8 +344,12 @@ export class VideoService {
327
344
  const params = {
328
345
  body: participant,
329
346
  };
330
-
331
- const result = await this.sdk._fetch(`/video/${roomId}/participants`, 'POST', params);
347
+
348
+ const result = await this.sdk._fetch(
349
+ `/video/${roomId}/participants`,
350
+ 'POST',
351
+ params,
352
+ );
332
353
  return result;
333
354
  }
334
355
 
@@ -341,7 +362,11 @@ export class VideoService {
341
362
  );
342
363
 
343
364
  const params = {};
344
- const result = await this.sdk._fetch(`/video/${roomId}/close`, 'POST', params);
365
+ const result = await this.sdk._fetch(
366
+ `/video/${roomId}/close`,
367
+ 'POST',
368
+ params,
369
+ );
345
370
  return result;
346
371
  }
347
372
 
@@ -357,7 +382,11 @@ export class VideoService {
357
382
  body: { token },
358
383
  };
359
384
 
360
- const result = await this.sdk._fetch('/video/validateGuestToken', 'POST', params);
385
+ const result = await this.sdk._fetch(
386
+ '/video/validateGuestToken',
387
+ 'POST',
388
+ params,
389
+ );
361
390
  return result;
362
391
  }
363
392
 
@@ -374,7 +403,11 @@ export class VideoService {
374
403
  body: stats,
375
404
  };
376
405
 
377
- const result = await this.sdk._fetch(`/video/${roomId}/stats`, 'POST', params);
406
+ const result = await this.sdk._fetch(
407
+ `/video/${roomId}/stats`,
408
+ 'POST',
409
+ params,
410
+ );
378
411
  return result;
379
412
  }
380
- }
413
+ }
package/services/voice.js CHANGED
@@ -3,7 +3,36 @@ export class VoiceService {
3
3
  this.sdk = sdk;
4
4
  }
5
5
 
6
- async createCall({ to, from, connectionId, callerId, timeout, machineDetection, machineDetectionTimeout, recordingChannels, record, recordingFormat, recordingTrack, recordingMaxLength, transcribe, transcribeLanguage, webhookUrl, commandId, clientState, customHeaders, sipAuthUsername, sipAuthPassword, sipTransport, sipHeaders, ringTimeout, answeringMachineDetection, detectWordOrPhrase, billingGroupId, answerUrl, answerMethod }) {
6
+ async createCall({
7
+ to,
8
+ from,
9
+ connectionId,
10
+ callerId,
11
+ timeout,
12
+ machineDetection,
13
+ machineDetectionTimeout,
14
+ recordingChannels,
15
+ record,
16
+ recordingFormat,
17
+ recordingTrack,
18
+ recordingMaxLength,
19
+ transcribe,
20
+ transcribeLanguage,
21
+ webhookUrl,
22
+ commandId,
23
+ clientState,
24
+ customHeaders,
25
+ sipAuthUsername,
26
+ sipAuthPassword,
27
+ sipTransport,
28
+ sipHeaders,
29
+ ringTimeout,
30
+ answeringMachineDetection,
31
+ detectWordOrPhrase,
32
+ billingGroupId,
33
+ answerUrl,
34
+ answerMethod,
35
+ }) {
7
36
  this.sdk.validateParams(
8
37
  { to },
9
38
  {
@@ -43,8 +72,10 @@ export class VoiceService {
43
72
  if (connectionId) callData.connectionId = connectionId;
44
73
  if (callerId) callData.callerId = callerId;
45
74
  if (timeout) callData.timeout = timeout;
46
- if (machineDetection !== undefined) callData.machineDetection = machineDetection;
47
- if (machineDetectionTimeout) callData.machineDetectionTimeout = machineDetectionTimeout;
75
+ if (machineDetection !== undefined)
76
+ callData.machineDetection = machineDetection;
77
+ if (machineDetectionTimeout)
78
+ callData.machineDetectionTimeout = machineDetectionTimeout;
48
79
  if (recordingChannels) callData.recordingChannels = recordingChannels;
49
80
  if (record !== undefined) callData.record = record;
50
81
  if (recordingFormat) callData.recordingFormat = recordingFormat;
@@ -61,7 +92,8 @@ export class VoiceService {
61
92
  if (sipTransport) callData.sipTransport = sipTransport;
62
93
  if (sipHeaders) callData.sipHeaders = sipHeaders;
63
94
  if (ringTimeout) callData.ringTimeout = ringTimeout;
64
- if (answeringMachineDetection) callData.answeringMachineDetection = answeringMachineDetection;
95
+ if (answeringMachineDetection)
96
+ callData.answeringMachineDetection = answeringMachineDetection;
65
97
  if (detectWordOrPhrase) callData.detectWordOrPhrase = detectWordOrPhrase;
66
98
  if (billingGroupId) callData.billingGroupId = billingGroupId;
67
99
  if (answerUrl) callData.answerUrl = answerUrl;
@@ -93,7 +125,11 @@ export class VoiceService {
93
125
  body: hangupData,
94
126
  };
95
127
 
96
- const result = await this.sdk._fetch(`/voice/calls/${callControlId}/actions/hangup`, 'POST', params);
128
+ const result = await this.sdk._fetch(
129
+ `/voice/calls/${callControlId}/actions/hangup`,
130
+ 'POST',
131
+ params,
132
+ );
97
133
  return result;
98
134
  }
99
135
 
@@ -117,7 +153,11 @@ export class VoiceService {
117
153
  body: holdData,
118
154
  };
119
155
 
120
- const result = await this.sdk._fetch(`/voice/calls/${callControlId}/actions/hold`, 'POST', params);
156
+ const result = await this.sdk._fetch(
157
+ `/voice/calls/${callControlId}/actions/hold`,
158
+ 'POST',
159
+ params,
160
+ );
121
161
  return result;
122
162
  }
123
163
 
@@ -139,7 +179,11 @@ export class VoiceService {
139
179
  body: unholdData,
140
180
  };
141
181
 
142
- const result = await this.sdk._fetch(`/voice/calls/${callControlId}/actions/unhold`, 'POST', params);
182
+ const result = await this.sdk._fetch(
183
+ `/voice/calls/${callControlId}/actions/unhold`,
184
+ 'POST',
185
+ params,
186
+ );
143
187
  return result;
144
188
  }
145
189
 
@@ -161,7 +205,11 @@ export class VoiceService {
161
205
  body: muteData,
162
206
  };
163
207
 
164
- const result = await this.sdk._fetch(`/voice/calls/${callControlId}/actions/mute`, 'POST', params);
208
+ const result = await this.sdk._fetch(
209
+ `/voice/calls/${callControlId}/actions/mute`,
210
+ 'POST',
211
+ params,
212
+ );
165
213
  return result;
166
214
  }
167
215
 
@@ -183,7 +231,11 @@ export class VoiceService {
183
231
  body: unmuteData,
184
232
  };
185
233
 
186
- const result = await this.sdk._fetch(`/voice/calls/${callControlId}/actions/unmute`, 'POST', params);
234
+ const result = await this.sdk._fetch(
235
+ `/voice/calls/${callControlId}/actions/unmute`,
236
+ 'POST',
237
+ params,
238
+ );
187
239
  return result;
188
240
  }
189
241
 
@@ -206,11 +258,25 @@ export class VoiceService {
206
258
  body: dtmfData,
207
259
  };
208
260
 
209
- const result = await this.sdk._fetch(`/voice/calls/${callControlId}/actions/send_dtmf`, 'POST', params);
261
+ const result = await this.sdk._fetch(
262
+ `/voice/calls/${callControlId}/actions/send_dtmf`,
263
+ 'POST',
264
+ params,
265
+ );
210
266
  return result;
211
267
  }
212
268
 
213
- async record(callControlId, recordingChannels, recordingFormat, recordingMaxLength, recordingTerminators, recordingBeep, recordingPlayBeep, clientState, commandId) {
269
+ async record(
270
+ callControlId,
271
+ recordingChannels,
272
+ recordingFormat,
273
+ recordingMaxLength,
274
+ recordingTerminators,
275
+ recordingBeep,
276
+ recordingPlayBeep,
277
+ clientState,
278
+ commandId,
279
+ ) {
214
280
  this.sdk.validateParams(
215
281
  { callControlId },
216
282
  {
@@ -230,9 +296,11 @@ export class VoiceService {
230
296
  if (recordingChannels) recordData.recordingChannels = recordingChannels;
231
297
  if (recordingFormat) recordData.recordingFormat = recordingFormat;
232
298
  if (recordingMaxLength) recordData.recordingMaxLength = recordingMaxLength;
233
- if (recordingTerminators) recordData.recordingTerminators = recordingTerminators;
299
+ if (recordingTerminators)
300
+ recordData.recordingTerminators = recordingTerminators;
234
301
  if (recordingBeep !== undefined) recordData.recordingBeep = recordingBeep;
235
- if (recordingPlayBeep !== undefined) recordData.recordingPlayBeep = recordingPlayBeep;
302
+ if (recordingPlayBeep !== undefined)
303
+ recordData.recordingPlayBeep = recordingPlayBeep;
236
304
  if (clientState) recordData.clientState = clientState;
237
305
  if (commandId) recordData.commandId = commandId;
238
306
 
@@ -240,7 +308,11 @@ export class VoiceService {
240
308
  body: recordData,
241
309
  };
242
310
 
243
- const result = await this.sdk._fetch(`/voice/calls/${callControlId}/actions/record_start`, 'POST', params);
311
+ const result = await this.sdk._fetch(
312
+ `/voice/calls/${callControlId}/actions/record_start`,
313
+ 'POST',
314
+ params,
315
+ );
244
316
  return result;
245
317
  }
246
318
 
@@ -262,11 +334,22 @@ export class VoiceService {
262
334
  body: stopData,
263
335
  };
264
336
 
265
- const result = await this.sdk._fetch(`/voice/calls/${callControlId}/actions/record_stop`, 'POST', params);
337
+ const result = await this.sdk._fetch(
338
+ `/voice/calls/${callControlId}/actions/record_stop`,
339
+ 'POST',
340
+ params,
341
+ );
266
342
  return result;
267
343
  }
268
344
 
269
- async transcribe(callControlId, transcriptionEngine, transcriptionLanguage, transcriptionFormat, clientState, commandId) {
345
+ async transcribe(
346
+ callControlId,
347
+ transcriptionEngine,
348
+ transcriptionLanguage,
349
+ transcriptionFormat,
350
+ clientState,
351
+ commandId,
352
+ ) {
270
353
  this.sdk.validateParams(
271
354
  { callControlId },
272
355
  {
@@ -280,9 +363,12 @@ export class VoiceService {
280
363
  );
281
364
 
282
365
  const transcribeData = {};
283
- if (transcriptionEngine) transcribeData.transcriptionEngine = transcriptionEngine;
284
- if (transcriptionLanguage) transcribeData.transcriptionLanguage = transcriptionLanguage;
285
- if (transcriptionFormat) transcribeData.transcriptionFormat = transcriptionFormat;
366
+ if (transcriptionEngine)
367
+ transcribeData.transcriptionEngine = transcriptionEngine;
368
+ if (transcriptionLanguage)
369
+ transcribeData.transcriptionLanguage = transcriptionLanguage;
370
+ if (transcriptionFormat)
371
+ transcribeData.transcriptionFormat = transcriptionFormat;
286
372
  if (clientState) transcribeData.clientState = clientState;
287
373
  if (commandId) transcribeData.commandId = commandId;
288
374
 
@@ -290,7 +376,11 @@ export class VoiceService {
290
376
  body: transcribeData,
291
377
  };
292
378
 
293
- const result = await this.sdk._fetch(`/voice/calls/${callControlId}/actions/transcription_start`, 'POST', params);
379
+ const result = await this.sdk._fetch(
380
+ `/voice/calls/${callControlId}/actions/transcription_start`,
381
+ 'POST',
382
+ params,
383
+ );
294
384
  return result;
295
385
  }
296
386
 
@@ -312,11 +402,23 @@ export class VoiceService {
312
402
  body: stopData,
313
403
  };
314
404
 
315
- const result = await this.sdk._fetch(`/voice/calls/${callControlId}/actions/transcription_stop`, 'POST', params);
405
+ const result = await this.sdk._fetch(
406
+ `/voice/calls/${callControlId}/actions/transcription_stop`,
407
+ 'POST',
408
+ params,
409
+ );
316
410
  return result;
317
411
  }
318
412
 
319
- async transfer(callControlId, to, from, answerUrl, answerMethod, clientState, commandId) {
413
+ async transfer(
414
+ callControlId,
415
+ to,
416
+ from,
417
+ answerUrl,
418
+ answerMethod,
419
+ clientState,
420
+ commandId,
421
+ ) {
320
422
  this.sdk.validateParams(
321
423
  { callControlId, to },
322
424
  {
@@ -341,11 +443,24 @@ export class VoiceService {
341
443
  body: transferData,
342
444
  };
343
445
 
344
- const result = await this.sdk._fetch(`/voice/calls/${callControlId}/actions/transfer`, 'POST', params);
446
+ const result = await this.sdk._fetch(
447
+ `/voice/calls/${callControlId}/actions/transfer`,
448
+ 'POST',
449
+ params,
450
+ );
345
451
  return result;
346
452
  }
347
453
 
348
- async createConference({ name, recordingChannels, recordingFormat, recordingMaxLength, recordingTerminators, webhookUrl, commandId, clientState }) {
454
+ async createConference({
455
+ name,
456
+ recordingChannels,
457
+ recordingFormat,
458
+ recordingMaxLength,
459
+ recordingTerminators,
460
+ webhookUrl,
461
+ commandId,
462
+ clientState,
463
+ }) {
349
464
  this.sdk.validateParams(
350
465
  { name },
351
466
  {
@@ -363,8 +478,10 @@ export class VoiceService {
363
478
  const conferenceData = { name };
364
479
  if (recordingChannels) conferenceData.recordingChannels = recordingChannels;
365
480
  if (recordingFormat) conferenceData.recordingFormat = recordingFormat;
366
- if (recordingMaxLength) conferenceData.recordingMaxLength = recordingMaxLength;
367
- if (recordingTerminators) conferenceData.recordingTerminators = recordingTerminators;
481
+ if (recordingMaxLength)
482
+ conferenceData.recordingMaxLength = recordingMaxLength;
483
+ if (recordingTerminators)
484
+ conferenceData.recordingTerminators = recordingTerminators;
368
485
  if (webhookUrl) conferenceData.webhookUrl = webhookUrl;
369
486
  if (commandId) conferenceData.commandId = commandId;
370
487
  if (clientState) conferenceData.clientState = clientState;
@@ -377,7 +494,17 @@ export class VoiceService {
377
494
  return result;
378
495
  }
379
496
 
380
- async joinConference(callControlId, conferenceId, startConferenceOnEnter, endConferenceOnExit, muted, hold, holdAudioUrl, clientState, commandId) {
497
+ async joinConference(
498
+ callControlId,
499
+ conferenceId,
500
+ startConferenceOnEnter,
501
+ endConferenceOnExit,
502
+ muted,
503
+ hold,
504
+ holdAudioUrl,
505
+ clientState,
506
+ commandId,
507
+ ) {
381
508
  this.sdk.validateParams(
382
509
  { callControlId, conferenceId },
383
510
  {
@@ -394,8 +521,10 @@ export class VoiceService {
394
521
  );
395
522
 
396
523
  const joinData = { conferenceId };
397
- if (startConferenceOnEnter !== undefined) joinData.startConferenceOnEnter = startConferenceOnEnter;
398
- if (endConferenceOnExit !== undefined) joinData.endConferenceOnExit = endConferenceOnExit;
524
+ if (startConferenceOnEnter !== undefined)
525
+ joinData.startConferenceOnEnter = startConferenceOnEnter;
526
+ if (endConferenceOnExit !== undefined)
527
+ joinData.endConferenceOnExit = endConferenceOnExit;
399
528
  if (muted !== undefined) joinData.muted = muted;
400
529
  if (hold !== undefined) joinData.hold = hold;
401
530
  if (holdAudioUrl) joinData.holdAudioUrl = holdAudioUrl;
@@ -406,7 +535,11 @@ export class VoiceService {
406
535
  body: joinData,
407
536
  };
408
537
 
409
- const result = await this.sdk._fetch(`/voice/calls/${callControlId}/actions/conference_join`, 'POST', params);
538
+ const result = await this.sdk._fetch(
539
+ `/voice/calls/${callControlId}/actions/conference_join`,
540
+ 'POST',
541
+ params,
542
+ );
410
543
  return result;
411
544
  }
412
545
 
@@ -428,7 +561,11 @@ export class VoiceService {
428
561
  body: leaveData,
429
562
  };
430
563
 
431
- const result = await this.sdk._fetch(`/voice/calls/${callControlId}/actions/conference_leave`, 'POST', params);
564
+ const result = await this.sdk._fetch(
565
+ `/voice/calls/${callControlId}/actions/conference_leave`,
566
+ 'POST',
567
+ params,
568
+ );
432
569
  return result;
433
570
  }
434
- }
571
+ }