bandwidth-sdk 2.1.0 → 3.0.1

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.
Files changed (137) hide show
  1. package/.github/workflows/deploy.yml +4 -2
  2. package/.github/workflows/test-pr.yml +4 -2
  3. package/.github/workflows/{test-nightly.yml → test-smoke.yml} +6 -5
  4. package/.openapi-generator/FILES +2 -0
  5. package/README.md +22 -5
  6. package/api/transcriptions-api.ts +4 -4
  7. package/bandwidth.yml +70 -41
  8. package/coverage/clover.xml +1501 -138
  9. package/coverage/coverage-final.json +65 -47
  10. package/coverage/lcov-report/index.html +51 -21
  11. package/coverage/lcov-report/node-sdk/api/calls-api.ts.html +1702 -0
  12. package/coverage/lcov-report/node-sdk/api/conferences-api.ts.html +2725 -0
  13. package/coverage/lcov-report/node-sdk/api/index.html +236 -0
  14. package/coverage/lcov-report/node-sdk/api/media-api.ts.html +1315 -0
  15. package/coverage/lcov-report/node-sdk/api/messages-api.ts.html +1138 -0
  16. package/coverage/lcov-report/node-sdk/api/mfaapi.ts.html +1051 -0
  17. package/coverage/lcov-report/node-sdk/api/phone-number-lookup-api.ts.html +775 -0
  18. package/coverage/lcov-report/node-sdk/api/recordings-api.ts.html +2971 -0
  19. package/coverage/lcov-report/node-sdk/api/statistics-api.ts.html +496 -0
  20. package/coverage/lcov-report/node-sdk/api/transcriptions-api.ts.html +1045 -0
  21. package/coverage/lcov-report/node-sdk/api.ts.html +163 -0
  22. package/coverage/lcov-report/node-sdk/base.ts.html +1045 -0
  23. package/coverage/lcov-report/node-sdk/common.ts.html +535 -0
  24. package/coverage/lcov-report/node-sdk/configuration.ts.html +415 -0
  25. package/coverage/lcov-report/node-sdk/index.html +161 -0
  26. package/coverage/lcov-report/{models → node-sdk/models}/bxml/Bxml.ts.html +13 -13
  27. package/coverage/lcov-report/{models → node-sdk/models}/bxml/NestableVerb.ts.html +15 -15
  28. package/coverage/lcov-report/{models → node-sdk/models}/bxml/Response.ts.html +13 -13
  29. package/coverage/lcov-report/{models → node-sdk/models}/bxml/Root.ts.html +17 -17
  30. package/coverage/lcov-report/{models → node-sdk/models}/bxml/Verb.ts.html +15 -15
  31. package/coverage/lcov-report/{models → node-sdk/models}/bxml/index.html +29 -14
  32. package/coverage/lcov-report/node-sdk/models/bxml/index.ts.html +94 -0
  33. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Bridge.ts.html +13 -13
  34. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Conference.ts.html +13 -13
  35. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/CustomParam.ts.html +13 -13
  36. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Forward.ts.html +13 -13
  37. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Gather.ts.html +16 -16
  38. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Hangup.ts.html +13 -13
  39. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Pause.ts.html +13 -13
  40. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/PauseRecording.ts.html +13 -13
  41. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/PhoneNumber.ts.html +13 -13
  42. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/PlayAudio.ts.html +13 -13
  43. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Record.ts.html +13 -13
  44. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Redirect.ts.html +13 -13
  45. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/ResumeRecording.ts.html +13 -13
  46. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Ring.ts.html +13 -13
  47. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/SendDtmf.ts.html +13 -13
  48. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/SipUri.ts.html +13 -13
  49. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/SpeakSentence.ts.html +15 -15
  50. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/StartGather.ts.html +13 -13
  51. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/StartRecording.ts.html +13 -13
  52. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/StartStream.ts.html +14 -14
  53. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/StartTranscription.ts.html +14 -14
  54. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/StopGather.ts.html +13 -13
  55. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/StopRecording.ts.html +13 -13
  56. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/StopStream.ts.html +13 -13
  57. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/StopTranscription.ts.html +13 -13
  58. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/StreamParam.ts.html +13 -13
  59. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Tag.ts.html +13 -13
  60. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Transfer.ts.html +14 -14
  61. package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/index.html +27 -12
  62. package/coverage/lcov-report/node-sdk/models/bxml/verbs/index.ts.html +175 -0
  63. package/coverage/lcov-report/{models → node-sdk/models}/call-direction-enum.ts.html +11 -11
  64. package/coverage/lcov-report/{models → node-sdk/models}/call-state-enum.ts.html +11 -11
  65. package/coverage/lcov-report/node-sdk/models/call-transcription-detected-language-enum.ts.html +181 -0
  66. package/coverage/lcov-report/node-sdk/models/call-transcription-track-enum.ts.html +178 -0
  67. package/coverage/lcov-report/{models → node-sdk/models}/callback-method-enum.ts.html +11 -11
  68. package/coverage/lcov-report/{models → node-sdk/models}/conference-state-enum.ts.html +11 -11
  69. package/coverage/lcov-report/{models → node-sdk/models}/file-format-enum.ts.html +11 -11
  70. package/coverage/lcov-report/{models → node-sdk/models}/index.html +57 -12
  71. package/coverage/lcov-report/node-sdk/models/index.ts.html +367 -0
  72. package/coverage/lcov-report/{models → node-sdk/models}/list-message-direction-enum.ts.html +11 -11
  73. package/coverage/lcov-report/{models → node-sdk/models}/lookup-status-enum.ts.html +11 -11
  74. package/coverage/lcov-report/{models → node-sdk/models}/machine-detection-mode-enum.ts.html +11 -11
  75. package/coverage/lcov-report/{models → node-sdk/models}/message-direction-enum.ts.html +11 -11
  76. package/coverage/lcov-report/{models → node-sdk/models}/message-status-enum.ts.html +11 -11
  77. package/coverage/lcov-report/{models → node-sdk/models}/message-type-enum.ts.html +11 -11
  78. package/coverage/lcov-report/{models → node-sdk/models}/priority-enum.ts.html +11 -11
  79. package/coverage/lcov-report/{models → node-sdk/models}/recording-state-enum.ts.html +11 -11
  80. package/coverage/lcov-report/{models → node-sdk/models}/redirect-method-enum.ts.html +11 -11
  81. package/coverage/lcov.info +3366 -162
  82. package/custom_templates/README.mustache +22 -5
  83. package/custom_templates/package.mustache +2 -1
  84. package/custom_templates/tsconfig.mustache +2 -1
  85. package/dist/api/calls-api.js +2 -2
  86. package/dist/api/conferences-api.js +2 -2
  87. package/dist/api/media-api.js +2 -2
  88. package/dist/api/messages-api.js +2 -2
  89. package/dist/api/mfaapi.js +2 -2
  90. package/dist/api/phone-number-lookup-api.js +2 -2
  91. package/dist/api/recordings-api.js +2 -2
  92. package/dist/api/statistics-api.js +2 -2
  93. package/dist/api/transcriptions-api.d.ts +4 -4
  94. package/dist/api/transcriptions-api.js +6 -6
  95. package/dist/common.js +2 -2
  96. package/dist/models/call-recording-metadata.d.ts +6 -0
  97. package/dist/models/call-transcription-detected-language-enum.d.ts +22 -0
  98. package/dist/models/call-transcription-detected-language-enum.js +26 -0
  99. package/dist/models/call-transcription-metadata.d.ts +6 -0
  100. package/dist/models/call-transcription-track-enum.d.ts +21 -0
  101. package/dist/models/call-transcription-track-enum.js +25 -0
  102. package/dist/models/call-transcription.d.ts +7 -16
  103. package/dist/models/call-transcription.js +0 -10
  104. package/dist/models/conference-recording-metadata.d.ts +6 -0
  105. package/dist/models/index.d.ts +2 -0
  106. package/dist/models/index.js +2 -0
  107. package/jest.config.js +1 -0
  108. package/models/call-recording-metadata.ts +6 -0
  109. package/models/call-transcription-detected-language-enum.ts +32 -0
  110. package/models/call-transcription-metadata.ts +6 -0
  111. package/models/call-transcription-track-enum.ts +31 -0
  112. package/models/call-transcription.ts +11 -18
  113. package/models/conference-recording-metadata.ts +6 -0
  114. package/models/index.ts +2 -0
  115. package/package.json +3 -2
  116. package/tests/callUtils.ts +11 -11
  117. package/tests/smoke/bxml.test.ts +17 -17
  118. package/tests/smoke/calls-api.test.ts +38 -38
  119. package/tests/smoke/conferences-api.test.ts +19 -19
  120. package/tests/smoke/media-api.test.ts +11 -11
  121. package/tests/smoke/messages-api.test.ts +26 -26
  122. package/tests/smoke/mfaapi.test.ts +18 -18
  123. package/tests/smoke/phone-number-lookup-api.test.ts +16 -6
  124. package/tests/smoke/recordings-api.test.ts +31 -31
  125. package/tests/smoke/statistics-api.test.ts +7 -7
  126. package/tests/smoke/transcriptions-api.test.ts +16 -15
  127. package/tests/unit/api/calls-api.test.ts +180 -0
  128. package/tests/unit/api/conferences-api.test.ts +160 -0
  129. package/tests/unit/api/media-api.test.ts +59 -0
  130. package/tests/unit/api/messages-api.test.ts +122 -0
  131. package/tests/unit/api/mfaapi.test.ts +76 -0
  132. package/tests/unit/api/phone-number-lookup-api.test.ts +96 -0
  133. package/tests/unit/api/recordings-api.test.ts +179 -0
  134. package/tests/unit/api/statistics-api.test.ts +35 -0
  135. package/tests/unit/api/transcriptions-api.test.ts +61 -0
  136. package/tests/unit/models/call-transcription-detected-language-enum.test.ts +9 -0
  137. package/tests/unit/models/call-transcription-track-enum.test.ts +8 -0
@@ -13,6 +13,12 @@
13
13
  */
14
14
 
15
15
 
16
+ // May contain unused imports in some cases
17
+ // @ts-ignore
18
+ import type { CallTranscriptionDetectedLanguageEnum } from './call-transcription-detected-language-enum';
19
+ // May contain unused imports in some cases
20
+ // @ts-ignore
21
+ import type { CallTranscriptionTrackEnum } from './call-transcription-track-enum';
16
22
 
17
23
  /**
18
24
  *
@@ -21,14 +27,14 @@
21
27
  */
22
28
  export interface CallTranscription {
23
29
  /**
24
- * The detected language for this transcription.
25
- * @type {string}
30
+ *
31
+ * @type {CallTranscriptionDetectedLanguageEnum}
26
32
  * @memberof CallTranscription
27
33
  */
28
34
  'detectedLanguage'?: CallTranscriptionDetectedLanguageEnum;
29
35
  /**
30
- * Which `track` this transcription is derived from.
31
- * @type {string}
36
+ *
37
+ * @type {CallTranscriptionTrackEnum}
32
38
  * @memberof CallTranscription
33
39
  */
34
40
  'track'?: CallTranscriptionTrackEnum;
@@ -37,7 +43,7 @@ export interface CallTranscription {
37
43
  * @type {string}
38
44
  * @memberof CallTranscription
39
45
  */
40
- 'text'?: string;
46
+ 'transcript'?: string;
41
47
  /**
42
48
  * How confident the transcription engine was in transcribing the associated audio (from `0` to `1`).
43
49
  * @type {number}
@@ -46,18 +52,5 @@ export interface CallTranscription {
46
52
  'confidence'?: number;
47
53
  }
48
54
 
49
- export const CallTranscriptionDetectedLanguageEnum = {
50
- EnUs: 'en-US',
51
- EsUs: 'es-US',
52
- FrFr: 'fr-FR'
53
- } as const;
54
-
55
- export type CallTranscriptionDetectedLanguageEnum = typeof CallTranscriptionDetectedLanguageEnum[keyof typeof CallTranscriptionDetectedLanguageEnum];
56
- export const CallTranscriptionTrackEnum = {
57
- Inbound: 'inbound',
58
- Outbound: 'outbound'
59
- } as const;
60
-
61
- export type CallTranscriptionTrackEnum = typeof CallTranscriptionTrackEnum[keyof typeof CallTranscriptionTrackEnum];
62
55
 
63
56
 
@@ -89,6 +89,12 @@ export interface ConferenceRecordingMetadata {
89
89
  * @memberof ConferenceRecordingMetadata
90
90
  */
91
91
  'mediaUrl'?: string | null;
92
+ /**
93
+ * A name to identify this recording.
94
+ * @type {string}
95
+ * @memberof ConferenceRecordingMetadata
96
+ */
97
+ 'recordingName'?: string;
92
98
  }
93
99
 
94
100
 
package/models/index.ts CHANGED
@@ -7,8 +7,10 @@ export * from './call-recording-metadata';
7
7
  export * from './call-state';
8
8
  export * from './call-state-enum';
9
9
  export * from './call-transcription';
10
+ export * from './call-transcription-detected-language-enum';
10
11
  export * from './call-transcription-metadata';
11
12
  export * from './call-transcription-response';
13
+ export * from './call-transcription-track-enum';
12
14
  export * from './callback-method-enum';
13
15
  export * from './code-request';
14
16
  export * from './conference';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bandwidth-sdk",
3
- "version": "2.1.0",
3
+ "version": "3.0.1",
4
4
  "description": "OpenAPI client for bandwidth-sdk",
5
5
  "author": "OpenAPI-Generator Contributors",
6
6
  "repository": {
@@ -29,9 +29,10 @@
29
29
  "xmlbuilder2": "^3.1.1"
30
30
  },
31
31
  "devDependencies": {
32
- "@types/node": "^12.11.5",
33
32
  "@types/jest": "^29.5.12",
33
+ "@types/node": "^12.11.5",
34
34
  "jest": "^29.7.0",
35
+ "jest-extended": "^4.0.2",
35
36
  "ts-jest": "^29.1.1",
36
37
  "typescript": "^5.0"
37
38
  }
@@ -11,12 +11,12 @@ export const sleep = (s) => {
11
11
 
12
12
  export const setupManteca = async (type: string) => {
13
13
  const mantecaBody = {
14
- os: globalThis.OPERATING_SYSTEM,
14
+ os: OPERATING_SYSTEM,
15
15
  language: 'nodejs',
16
16
  type: type
17
17
  };
18
18
 
19
- const mantecaTestUrl = `${globalThis.MANTECA_BASE_URL}/tests`;
19
+ const mantecaTestUrl = `${MANTECA_BASE_URL}/tests`;
20
20
  const mantecaHeader: AxiosRequestConfig = { headers: {'Content-Type': 'application/json' } };
21
21
 
22
22
  try {
@@ -29,19 +29,19 @@ export const setupManteca = async (type: string) => {
29
29
 
30
30
  export const createMantecaCall = async (callsApi: CallsApi, tag = 'nodejs', answerPath = '/bxml/pause') => {
31
31
  const mantecaCallBody = {
32
- applicationId: globalThis.MANTECA_APPLICATION_ID,
33
- to: globalThis.MANTECA_IDLE_NUMBER,
34
- from: globalThis.MANTECA_ACTIVE_NUMBER,
35
- answerUrl: `${globalThis.MANTECA_BASE_URL}${answerPath}`,
32
+ applicationId: MANTECA_APPLICATION_ID,
33
+ to: MANTECA_IDLE_NUMBER,
34
+ from: MANTECA_ACTIVE_NUMBER,
35
+ answerUrl: `${MANTECA_BASE_URL}${answerPath}`,
36
36
  tag: tag
37
37
  };
38
38
 
39
- const { data } = await callsApi.createCall(globalThis.BW_ACCOUNT_ID, mantecaCallBody);
39
+ const { data } = await callsApi.createCall(BW_ACCOUNT_ID, mantecaCallBody);
40
40
  return data.callId;
41
41
  };
42
42
 
43
43
  export const getMantecaTestStatus = async (testId: string) => {
44
- const mantecaStatusUrl = `${globalThis.MANTECA_BASE_URL}/tests/${testId}`;
44
+ const mantecaStatusUrl = `${MANTECA_BASE_URL}/tests/${testId}`;
45
45
  const { data } = await axios.get(mantecaStatusUrl);
46
46
  return data;
47
47
  };
@@ -53,7 +53,7 @@ export const cleanupCalls = async (calls: string[], callsApi: CallsApi) => {
53
53
  for (let i = calls.length - 1; i >= 0; i--) {
54
54
  if (await callEnded(calls[i], callsApi)) { calls.splice(i, 1); }
55
55
  }
56
- await sleep(globalThis.SLEEP_TIME_S);
56
+ await sleep(SLEEP_TIME_S);
57
57
  attempts += 1;
58
58
  }
59
59
 
@@ -65,10 +65,10 @@ export const cleanupCalls = async (calls: string[], callsApi: CallsApi) => {
65
65
 
66
66
  const callEnded = async (callId: string, callsApi: CallsApi) => {
67
67
  try {
68
- const { data } = await callsApi.getCallState(globalThis.BW_ACCOUNT_ID, callId);
68
+ const { data } = await callsApi.getCallState(BW_ACCOUNT_ID, callId);
69
69
  if (data.state != 'disconnected') {
70
70
  try {
71
- callsApi.updateCall(globalThis.BW_ACCOUNT_ID, callId, { state: 'completed' });
71
+ callsApi.updateCall(BW_ACCOUNT_ID, callId, { state: 'completed' });
72
72
  return true;
73
73
  } catch { return false; }
74
74
  } else { return true; }
@@ -25,7 +25,7 @@ import { sleep, createMantecaCall, cleanupCalls } from '../callUtils';
25
25
  describe('BXML Integration Tests', () => {
26
26
  jest.setTimeout(20000);
27
27
 
28
- const config = new Configuration({username: globalThis.BW_USERNAME, password: globalThis.BW_PASSWORD});
28
+ const config = new Configuration({username: BW_USERNAME, password: BW_PASSWORD});
29
29
  const callsApi = new CallsApi(config);
30
30
  let activeCalls: string[] = [];
31
31
 
@@ -37,7 +37,7 @@ describe('BXML Integration Tests', () => {
37
37
  const updateCallId = await createMantecaCall(callsApi);
38
38
  const bridgeCallId = await createMantecaCall(callsApi);
39
39
  activeCalls.push(updateCallId, bridgeCallId);
40
- await sleep(globalThis.SLEEP_TIME_S);
40
+ await sleep(SLEEP_TIME_S);
41
41
 
42
42
  const conferenceAttributes: ConferenceAttributes = {
43
43
  mute: true,
@@ -162,19 +162,19 @@ describe('BXML Integration Tests', () => {
162
162
  const bxml = new Bxml.Response([tag, conference, speakSentence, gather, sendDtmf, nestedGather, pause, record, playAudio, sendDtmf, ring, bridge, transfer, hangup]);
163
163
 
164
164
  const { status: updateStatus } =
165
- await callsApi.updateCallBxml(globalThis.BW_ACCOUNT_ID, updateCallId, bxml.toBxml());
165
+ await callsApi.updateCallBxml(BW_ACCOUNT_ID, updateCallId, bxml.toBxml());
166
166
  expect(updateStatus).toEqual(204);
167
- await sleep(globalThis.SLEEP_TIME_S);
167
+ await sleep(SLEEP_TIME_S);
168
168
 
169
169
  const { status: completeStatus } =
170
- await callsApi.updateCall(globalThis.BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
170
+ await callsApi.updateCall(BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
171
171
  expect(completeStatus).toEqual(200);
172
172
  });
173
173
 
174
174
  test('test start and stop verbs', async () => {
175
175
  const updateCallId = await createMantecaCall(callsApi);
176
176
  activeCalls.push(updateCallId);
177
- await sleep(globalThis.SLEEP_TIME_S);
177
+ await sleep(SLEEP_TIME_S);
178
178
 
179
179
  const startGatherAttributes: StartGatherAttributes = {
180
180
  dtmfUrl: 'https://initial.com',
@@ -243,19 +243,19 @@ describe('BXML Integration Tests', () => {
243
243
  const bxml = new Bxml.Bxml([startGather, stopGather, startRecording, pauseRecording, resumeRecording, stopRecording, startStream, stopStream, startTranscription, stopTranscription]);
244
244
 
245
245
  const { status: updateStatus } =
246
- await callsApi.updateCallBxml(globalThis.BW_ACCOUNT_ID, updateCallId, bxml.toBxml());
246
+ await callsApi.updateCallBxml(BW_ACCOUNT_ID, updateCallId, bxml.toBxml());
247
247
  expect(updateStatus).toEqual(204);
248
- await sleep(globalThis.SLEEP_TIME_S);
248
+ await sleep(SLEEP_TIME_S);
249
249
 
250
250
  const { status: completeStatus } =
251
- await callsApi.updateCall(globalThis.BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
251
+ await callsApi.updateCall(BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
252
252
  expect(completeStatus).toEqual(200);
253
253
  });
254
254
 
255
255
  test('test forward', async () => {
256
256
  const updateCallId = await createMantecaCall(callsApi);
257
257
  activeCalls.push(updateCallId);
258
- await sleep(globalThis.SLEEP_TIME_S);
258
+ await sleep(SLEEP_TIME_S);
259
259
 
260
260
  const forwardAttributes: ForwardAttributes = {
261
261
  to: '+19195551234',
@@ -271,12 +271,12 @@ describe('BXML Integration Tests', () => {
271
271
  const bxml = new Bxml.Response([forward]);
272
272
 
273
273
  const { status: updateStatus } =
274
- await callsApi.updateCallBxml(globalThis.BW_ACCOUNT_ID, updateCallId, bxml.toBxml());
274
+ await callsApi.updateCallBxml(BW_ACCOUNT_ID, updateCallId, bxml.toBxml());
275
275
  expect(updateStatus).toEqual(204);
276
- await sleep(globalThis.SLEEP_TIME_S);
276
+ await sleep(SLEEP_TIME_S);
277
277
 
278
278
  const { status: completeStatus } =
279
- await callsApi.updateCall(globalThis.BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
279
+ await callsApi.updateCall(BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
280
280
  expect(completeStatus).toEqual(200);
281
281
 
282
282
  });
@@ -284,7 +284,7 @@ describe('BXML Integration Tests', () => {
284
284
  test('test redirect', async () => {
285
285
  const updateCallId = await createMantecaCall(callsApi);
286
286
  activeCalls.push(updateCallId);
287
- await sleep(globalThis.SLEEP_TIME_S);
287
+ await sleep(SLEEP_TIME_S);
288
288
 
289
289
  const redirectAttributes: RedirectAttributes = {
290
290
  redirectUrl: 'https://initial.com',
@@ -303,12 +303,12 @@ describe('BXML Integration Tests', () => {
303
303
  const bxml = new Bxml.Response([redirect]);
304
304
 
305
305
  const { status: updateStatus } =
306
- await callsApi.updateCallBxml(globalThis.BW_ACCOUNT_ID, updateCallId, bxml.toBxml());
306
+ await callsApi.updateCallBxml(BW_ACCOUNT_ID, updateCallId, bxml.toBxml());
307
307
  expect(updateStatus).toEqual(204);
308
- await sleep(globalThis.SLEEP_TIME_S);
308
+ await sleep(SLEEP_TIME_S);
309
309
 
310
310
  const { status: completeStatus } =
311
- await callsApi.updateCall(globalThis.BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
311
+ await callsApi.updateCall(BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
312
312
  expect(completeStatus).toEqual(200);
313
313
  });
314
314
  });
@@ -13,15 +13,15 @@ import { createMantecaCall, sleep, cleanupCalls } from '../callUtils';
13
13
 
14
14
  describe('CallsApi', () => {
15
15
  jest.setTimeout(45000);
16
- const config = new Configuration({username: globalThis.BW_USERNAME, password: globalThis.BW_PASSWORD});
16
+ const config = new Configuration({username: BW_USERNAME, password: BW_PASSWORD});
17
17
  const callsApi = new CallsApi(config);
18
18
 
19
19
  const displayName = 'NodeJS SDK';
20
20
  const answerMethod = CallbackMethodEnum.Post;
21
- const answerUrl = `${globalThis.BASE_CALLBACK_URL}/callbacks/answer`;
21
+ const answerUrl = `${BASE_CALLBACK_URL}/callbacks/answer`;
22
22
  const answerFallbackMethod = CallbackMethodEnum.Post;
23
23
  const disconnectMethod = CallbackMethodEnum.Get;
24
- const disconnectUrl = `${globalThis.BASE_CALLBACK_URL}/callbacks/disconnect`;
24
+ const disconnectUrl = `${BASE_CALLBACK_URL}/callbacks/disconnect`;
25
25
  const priority = 5;
26
26
  const direction = CallDirectionEnum.Outbound;
27
27
  const callTimeout = 30.0;
@@ -43,14 +43,14 @@ describe('CallsApi', () => {
43
43
  speechThreshold: 5.0,
44
44
  speechEndThreshold: 5.0,
45
45
  delayResult: true,
46
- callbackUrl: globalThis.BASE_CALLBACK_URL + '/machineDetection',
46
+ callbackUrl: BASE_CALLBACK_URL + '/machineDetection',
47
47
  callbackMethod: CallbackMethodEnum.Post
48
48
  };
49
49
 
50
50
  const callBody: CreateCall = {
51
- applicationId: globalThis.BW_VOICE_APPLICATION_ID,
52
- to: globalThis.USER_NUMBER,
53
- from: globalThis.BW_NUMBER,
51
+ applicationId: BW_VOICE_APPLICATION_ID,
52
+ to: USER_NUMBER,
53
+ from: BW_NUMBER,
54
54
  privacy: false,
55
55
  displayName: displayName,
56
56
  answerUrl: answerUrl,
@@ -62,14 +62,14 @@ describe('CallsApi', () => {
62
62
  callbackTimeout: callbackTimeout
63
63
  };
64
64
 
65
- const { status, data } = await callsApi.createCall(globalThis.BW_ACCOUNT_ID, callBody);
65
+ const { status, data } = await callsApi.createCall(BW_ACCOUNT_ID, callBody);
66
66
 
67
67
  expect(status).toEqual(201);
68
- expect(data.applicationId).toEqual(globalThis.BW_VOICE_APPLICATION_ID);
69
- expect(data.accountId).toEqual(globalThis.BW_ACCOUNT_ID);
68
+ expect(data.applicationId).toEqual(BW_VOICE_APPLICATION_ID);
69
+ expect(data.accountId).toEqual(BW_ACCOUNT_ID);
70
70
  expect(data.callId).toHaveLength(47);
71
- expect(data.to).toEqual(globalThis.USER_NUMBER);
72
- expect(data.from).toEqual(globalThis.BW_NUMBER);
71
+ expect(data.to).toEqual(USER_NUMBER);
72
+ expect(data.from).toEqual(BW_NUMBER);
73
73
  expect(data.callTimeout).toEqual(callTimeout);
74
74
  expect(data.callbackTimeout).toEqual(callbackTimeout);
75
75
  expect(data.answerMethod).toEqual(answerMethod);
@@ -84,28 +84,28 @@ describe('CallsApi', () => {
84
84
  });
85
85
  });
86
86
 
87
- describe('getCall', () => {
87
+ describe('getCallState', () => {
88
88
  test('should return a call', async () => {
89
89
  await sleep(40); // wait 40s for voice API to update call status
90
- const { status, data } = await callsApi.getCallState(globalThis.BW_ACCOUNT_ID, callId);
90
+ const { status, data } = await callsApi.getCallState(BW_ACCOUNT_ID, callId);
91
91
 
92
92
  expect(status).toEqual(200);
93
- expect(data.accountId).toEqual(globalThis.BW_ACCOUNT_ID);
94
- expect(data.applicationId).toEqual(globalThis.BW_VOICE_APPLICATION_ID);
93
+ expect(data.accountId).toEqual(BW_ACCOUNT_ID);
94
+ expect(data.applicationId).toEqual(BW_VOICE_APPLICATION_ID);
95
95
  expect(data.callId).toHaveLength(47);
96
- expect(data.to).toEqual(globalThis.USER_NUMBER);
97
- expect(data.from).toEqual(globalThis.BW_NUMBER);
96
+ expect(data.to).toEqual(USER_NUMBER);
97
+ expect(data.from).toEqual(BW_NUMBER);
98
98
  expect(data.direction).toEqual(direction);
99
99
  });
100
100
  });
101
101
 
102
- describe('getCalls', () => {
102
+ describe('listCalls', () => {
103
103
  test('should return an array of calls', async () => {
104
- const { status, data } = await callsApi.listCalls(globalThis.BW_ACCOUNT_ID);
104
+ const { status, data } = await callsApi.listCalls(BW_ACCOUNT_ID);
105
105
 
106
106
  expect(status).toEqual(200);
107
107
  expect(data).toBeInstanceOf(Array);
108
- expect(data[0].accountId).toEqual(globalThis.BW_ACCOUNT_ID);
108
+ expect(data[0].accountId).toEqual(BW_ACCOUNT_ID);
109
109
  expect(data[0].applicationId).toHaveLength(36);
110
110
  expect(data[0].callId).toHaveLength(47);
111
111
  });
@@ -115,20 +115,20 @@ describe('CallsApi', () => {
115
115
  test('should update a call', async () => {
116
116
  const updateCallBody: UpdateCall = {
117
117
  state: CallStateEnum.Active,
118
- redirectUrl: `${globalThis.MANTECA_BASE_URL}/bxml/pause`
118
+ redirectUrl: `${MANTECA_BASE_URL}/bxml/pause`
119
119
  };
120
120
 
121
121
  const updateCallId = await createMantecaCall(callsApi);
122
122
  activeCalls.push(updateCallId);
123
- await sleep(globalThis.SLEEP_TIME_S);
123
+ await sleep(SLEEP_TIME_S);
124
124
 
125
125
  const { status: updateStatus } =
126
- await callsApi.updateCall(globalThis.BW_ACCOUNT_ID, updateCallId, updateCallBody);
126
+ await callsApi.updateCall(BW_ACCOUNT_ID, updateCallId, updateCallBody);
127
127
  expect(updateStatus).toEqual(200);
128
- await sleep(globalThis.SLEEP_TIME_S);
128
+ await sleep(SLEEP_TIME_S);
129
129
 
130
130
  const { status: completeStatus } =
131
- await callsApi.updateCall(globalThis.BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
131
+ await callsApi.updateCall(BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
132
132
  expect(completeStatus).toEqual(200);
133
133
  });
134
134
  });
@@ -139,15 +139,15 @@ describe('CallsApi', () => {
139
139
 
140
140
  const updateCallId = await createMantecaCall(callsApi);
141
141
  activeCalls.push(updateCallId);
142
- await sleep(globalThis.SLEEP_TIME_S);
142
+ await sleep(SLEEP_TIME_S);
143
143
 
144
144
  const { status: updateStatus } =
145
- await callsApi.updateCallBxml(globalThis.BW_ACCOUNT_ID, updateCallId, updateBxml);
145
+ await callsApi.updateCallBxml(BW_ACCOUNT_ID, updateCallId, updateBxml);
146
146
  expect(updateStatus).toEqual(204);
147
- await sleep(globalThis.SLEEP_TIME_S);
147
+ await sleep(SLEEP_TIME_S);
148
148
 
149
149
  const { status: completeStatus } =
150
- await callsApi.updateCall(globalThis.BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
150
+ await callsApi.updateCall(BW_ACCOUNT_ID, updateCallId, { state: CallStateEnum.Completed });
151
151
  expect(completeStatus).toEqual(200);
152
152
  });
153
153
  });
@@ -155,36 +155,36 @@ describe('CallsApi', () => {
155
155
  describe('HTTP Errors', () => {
156
156
  test('400', async () => {
157
157
  const callBodyBad: CreateCall = {
158
- applicationId: globalThis.BW_VOICE_APPLICATION_ID,
158
+ applicationId: BW_VOICE_APPLICATION_ID,
159
159
  to: '+1invalid',
160
- from: globalThis.BW_NUMBER,
160
+ from: BW_NUMBER,
161
161
  answerUrl: answerUrl
162
162
  };
163
163
 
164
164
  try {
165
- await callsApi.createCall(globalThis.BW_ACCOUNT_ID, callBodyBad);
165
+ await callsApi.createCall(BW_ACCOUNT_ID, callBodyBad);
166
166
  } catch (e) {
167
167
  expect(e.response.status).toEqual(400);
168
168
  }
169
169
  });
170
170
 
171
171
  test('401', async () => {
172
- const configBad = new Configuration({username: globalThis.UNAUTHORIZED_USERNAME, password: globalThis.UNAUTHORIZED_PASSWORD});
172
+ const configBad = new Configuration({username: UNAUTHORIZED_USERNAME, password: UNAUTHORIZED_PASSWORD});
173
173
  const callsApiBad = new CallsApi(configBad);
174
174
 
175
175
  try {
176
- await callsApiBad.getCallState(globalThis.BW_ACCOUNT_ID, callId);
176
+ await callsApiBad.getCallState(BW_ACCOUNT_ID, callId);
177
177
  } catch (e) {
178
178
  expect(e.response.status).toEqual(401);
179
179
  }
180
180
  });
181
181
 
182
182
  test('403', async () => {
183
- const configBad = new Configuration({username: globalThis.FORBIDDEN_USERNAME, password: globalThis.FORBIDDEN_PASSWORD});
183
+ const configBad = new Configuration({username: FORBIDDEN_USERNAME, password: FORBIDDEN_PASSWORD});
184
184
  const callsApiBad = new CallsApi(configBad);
185
185
 
186
186
  try {
187
- await callsApiBad.getCallState(globalThis.BW_ACCOUNT_ID, callId);
187
+ await callsApiBad.getCallState(BW_ACCOUNT_ID, callId);
188
188
  } catch (e) {
189
189
  expect(e.response.status).toEqual(403);
190
190
  }
@@ -192,7 +192,7 @@ describe('CallsApi', () => {
192
192
 
193
193
  test('404', async () => {
194
194
  try {
195
- await callsApi.getCallState(globalThis.BW_ACCOUNT_ID, 'does-not-exist');
195
+ await callsApi.getCallState(BW_ACCOUNT_ID, 'does-not-exist');
196
196
  } catch (e) {
197
197
  expect(e.response.status).toEqual(404);
198
198
  }
@@ -6,7 +6,7 @@ import { setupManteca, createMantecaCall, cleanupCalls, getMantecaTestStatus, sl
6
6
 
7
7
  describe('ConferencesApi', () => {
8
8
  jest.setTimeout(125000);
9
- const config = new Configuration({username: globalThis.BW_USERNAME, password: globalThis.BW_PASSWORD});
9
+ const config = new Configuration({username: BW_USERNAME, password: BW_PASSWORD});
10
10
  const callsApi = new CallsApi(config);
11
11
  const conferencesApi = new ConferencesApi(config);
12
12
 
@@ -25,8 +25,8 @@ describe('ConferencesApi', () => {
25
25
 
26
26
  describe('listConferences', () => {
27
27
  test('should list conferences', async () => {
28
- await sleep(globalThis.SLEEP_TIME_S);
29
- const { status, data } = await conferencesApi.listConferences(globalThis.BW_ACCOUNT_ID, mantecaTestId);
28
+ await sleep(SLEEP_TIME_S);
29
+ const { status, data } = await conferencesApi.listConferences(BW_ACCOUNT_ID, mantecaTestId);
30
30
 
31
31
  expect(status).toEqual(200);
32
32
  expect(data).toBeInstanceOf(Array);
@@ -38,7 +38,7 @@ describe('ConferencesApi', () => {
38
38
 
39
39
  describe('getConference', () => {
40
40
  test('should get a conference', async () => {
41
- const { status, data } = await conferencesApi.getConference(globalThis.BW_ACCOUNT_ID, conferenceId);
41
+ const { status, data } = await conferencesApi.getConference(BW_ACCOUNT_ID, conferenceId);
42
42
 
43
43
  expect(status).toEqual(200);
44
44
  expect(data.id).toEqual(conferenceId);
@@ -49,7 +49,7 @@ describe('ConferencesApi', () => {
49
49
 
50
50
  describe('getConferenceMember', () => {
51
51
  test('should get conference member', async () => {
52
- const { status, data } = await conferencesApi.getConferenceMember(globalThis.BW_ACCOUNT_ID, conferenceId, mantecaCallId);
52
+ const { status, data } = await conferencesApi.getConferenceMember(BW_ACCOUNT_ID, conferenceId, mantecaCallId);
53
53
 
54
54
  expect(status).toEqual(200);
55
55
  expect(data.conferenceId).toEqual(conferenceId);
@@ -62,7 +62,7 @@ describe('ConferencesApi', () => {
62
62
  const updateConferenceMember = { mute: false };
63
63
 
64
64
  const { status } =
65
- await conferencesApi.updateConferenceMember(globalThis.BW_ACCOUNT_ID, conferenceId, mantecaCallId, updateConferenceMember);
65
+ await conferencesApi.updateConferenceMember(BW_ACCOUNT_ID, conferenceId, mantecaCallId, updateConferenceMember);
66
66
 
67
67
  expect(status).toEqual(204);
68
68
  });
@@ -72,18 +72,18 @@ describe('ConferencesApi', () => {
72
72
  test('should update conference', async () => {
73
73
  const updateConferenceBody: UpdateConference = {
74
74
  status: ConferenceStateEnum.Active,
75
- redirectUrl: `${globalThis.MANTECA_BASE_URL}/bxml/pause`,
75
+ redirectUrl: `${MANTECA_BASE_URL}/bxml/pause`,
76
76
  redirectMethod: RedirectMethodEnum.Post,
77
77
  username: 'username',
78
78
  password: 'password',
79
- redirectFallbackUrl: `${globalThis.MANTECA_BASE_URL}/bxml/pause`,
79
+ redirectFallbackUrl: `${MANTECA_BASE_URL}/bxml/pause`,
80
80
  redirectFallbackMethod: RedirectMethodEnum.Post,
81
81
  fallbackUsername: 'username',
82
82
  fallbackPassword: 'password'
83
83
  };
84
84
 
85
85
  const { status } =
86
- await conferencesApi.updateConference(globalThis.BW_ACCOUNT_ID, conferenceId, updateConferenceBody);
86
+ await conferencesApi.updateConference(BW_ACCOUNT_ID, conferenceId, updateConferenceBody);
87
87
 
88
88
  expect(status).toEqual(204);
89
89
  });
@@ -94,18 +94,18 @@ describe('ConferencesApi', () => {
94
94
  const updateBxml = '<?xml version="1.0" encoding="UTF-8"?><Bxml><StartRecording/><SpeakSentence locale="en_US" gender="female" voice="susan">This should be a conference recording.</SpeakSentence><StopRecording/></Bxml>';
95
95
 
96
96
  const { status } =
97
- await conferencesApi.updateConferenceBxml(globalThis.BW_ACCOUNT_ID, conferenceId, updateBxml);
97
+ await conferencesApi.updateConferenceBxml(BW_ACCOUNT_ID, conferenceId, updateBxml);
98
98
 
99
99
  expect(status).toEqual(204);
100
100
 
101
101
  let retries = 0;
102
102
  let recordingComplete = false;
103
103
  try {
104
- while (!recordingComplete && retries < globalThis.MAX_RETRIES) {
104
+ while (!recordingComplete && retries < MAX_RETRIES) {
105
105
  const { callRecorded } = await getMantecaTestStatus(mantecaTestId);
106
106
  recordingComplete = callRecorded;
107
107
  retries++;
108
- await sleep(globalThis.SLEEP_TIME_S);
108
+ await sleep(SLEEP_TIME_S);
109
109
  }
110
110
  } catch (e) {
111
111
  console.log(e);
@@ -117,14 +117,14 @@ describe('ConferencesApi', () => {
117
117
 
118
118
  describe('listConferenceRecordings', () => {
119
119
  test('should list conference recordings', async () => {
120
- const { status, data } = await conferencesApi.listConferenceRecordings(globalThis.BW_ACCOUNT_ID, conferenceId);
120
+ const { status, data } = await conferencesApi.listConferenceRecordings(BW_ACCOUNT_ID, conferenceId);
121
121
 
122
122
  expect(status).toEqual(200);
123
123
  expect(data).toBeInstanceOf(Array);
124
124
  expect(data[0].conferenceId).toEqual(conferenceId);
125
- expect(data[0].accountId).toEqual(globalThis.BW_ACCOUNT_ID);
125
+ expect(data[0].accountId).toEqual(BW_ACCOUNT_ID);
126
126
  expect(data[0].name).toEqual(mantecaTestId);
127
- expect(['partial', 'complete']).toContain(data[0].status);
127
+ expect(data[0].status).toBeOneOf(['partial', 'complete']);
128
128
  expect(data[0].recordingId).toHaveLength(47);
129
129
  expect(data[0].fileFormat).toEqual(FileFormatEnum.Wav);
130
130
 
@@ -134,13 +134,13 @@ describe('ConferencesApi', () => {
134
134
 
135
135
  describe('getConferenceRecording', () => {
136
136
  test('should get conference recording', async () => {
137
- const { status, data } = await conferencesApi.getConferenceRecording(globalThis.BW_ACCOUNT_ID, conferenceId, recordingId);
137
+ const { status, data } = await conferencesApi.getConferenceRecording(BW_ACCOUNT_ID, conferenceId, recordingId);
138
138
 
139
139
  expect(status).toEqual(200);
140
140
  expect(data.conferenceId).toEqual(conferenceId);
141
- expect(data.accountId).toEqual(globalThis.BW_ACCOUNT_ID);
141
+ expect(data.accountId).toEqual(BW_ACCOUNT_ID);
142
142
  expect(data.name).toEqual(mantecaTestId);
143
- expect(['partial', 'complete']).toContain(data.status);
143
+ expect(data.status).toBeOneOf(['partial', 'complete']);
144
144
  expect(data.recordingId).toEqual(recordingId);
145
145
  expect(data.fileFormat).toEqual(FileFormatEnum.Wav);
146
146
  });
@@ -148,7 +148,7 @@ describe('ConferencesApi', () => {
148
148
 
149
149
  describe('downloadConferenceRecording', () => {
150
150
  test('should download conference recording', async () => {
151
- const { status, data } = await conferencesApi.downloadConferenceRecording(globalThis.BW_ACCOUNT_ID, conferenceId, recordingId);
151
+ const { status, data } = await conferencesApi.downloadConferenceRecording(BW_ACCOUNT_ID, conferenceId, recordingId);
152
152
 
153
153
  expect(status).toEqual(200);
154
154
  expect(data).toBeDefined();