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.
- package/.github/workflows/deploy.yml +4 -2
- package/.github/workflows/test-pr.yml +4 -2
- package/.github/workflows/{test-nightly.yml → test-smoke.yml} +6 -5
- package/.openapi-generator/FILES +2 -0
- package/README.md +22 -5
- package/api/transcriptions-api.ts +4 -4
- package/bandwidth.yml +70 -41
- package/coverage/clover.xml +1501 -138
- package/coverage/coverage-final.json +65 -47
- package/coverage/lcov-report/index.html +51 -21
- package/coverage/lcov-report/node-sdk/api/calls-api.ts.html +1702 -0
- package/coverage/lcov-report/node-sdk/api/conferences-api.ts.html +2725 -0
- package/coverage/lcov-report/node-sdk/api/index.html +236 -0
- package/coverage/lcov-report/node-sdk/api/media-api.ts.html +1315 -0
- package/coverage/lcov-report/node-sdk/api/messages-api.ts.html +1138 -0
- package/coverage/lcov-report/node-sdk/api/mfaapi.ts.html +1051 -0
- package/coverage/lcov-report/node-sdk/api/phone-number-lookup-api.ts.html +775 -0
- package/coverage/lcov-report/node-sdk/api/recordings-api.ts.html +2971 -0
- package/coverage/lcov-report/node-sdk/api/statistics-api.ts.html +496 -0
- package/coverage/lcov-report/node-sdk/api/transcriptions-api.ts.html +1045 -0
- package/coverage/lcov-report/node-sdk/api.ts.html +163 -0
- package/coverage/lcov-report/node-sdk/base.ts.html +1045 -0
- package/coverage/lcov-report/node-sdk/common.ts.html +535 -0
- package/coverage/lcov-report/node-sdk/configuration.ts.html +415 -0
- package/coverage/lcov-report/node-sdk/index.html +161 -0
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/Bxml.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/NestableVerb.ts.html +15 -15
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/Response.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/Root.ts.html +17 -17
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/Verb.ts.html +15 -15
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/index.html +29 -14
- package/coverage/lcov-report/node-sdk/models/bxml/index.ts.html +94 -0
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Bridge.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Conference.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/CustomParam.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Forward.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Gather.ts.html +16 -16
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Hangup.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Pause.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/PauseRecording.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/PhoneNumber.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/PlayAudio.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Record.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Redirect.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/ResumeRecording.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Ring.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/SendDtmf.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/SipUri.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/SpeakSentence.ts.html +15 -15
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/StartGather.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/StartRecording.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/StartStream.ts.html +14 -14
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/StartTranscription.ts.html +14 -14
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/StopGather.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/StopRecording.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/StopStream.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/StopTranscription.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/StreamParam.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Tag.ts.html +13 -13
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/Transfer.ts.html +14 -14
- package/coverage/lcov-report/{models → node-sdk/models}/bxml/verbs/index.html +27 -12
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/index.ts.html +175 -0
- package/coverage/lcov-report/{models → node-sdk/models}/call-direction-enum.ts.html +11 -11
- package/coverage/lcov-report/{models → node-sdk/models}/call-state-enum.ts.html +11 -11
- package/coverage/lcov-report/node-sdk/models/call-transcription-detected-language-enum.ts.html +181 -0
- package/coverage/lcov-report/node-sdk/models/call-transcription-track-enum.ts.html +178 -0
- package/coverage/lcov-report/{models → node-sdk/models}/callback-method-enum.ts.html +11 -11
- package/coverage/lcov-report/{models → node-sdk/models}/conference-state-enum.ts.html +11 -11
- package/coverage/lcov-report/{models → node-sdk/models}/file-format-enum.ts.html +11 -11
- package/coverage/lcov-report/{models → node-sdk/models}/index.html +57 -12
- package/coverage/lcov-report/node-sdk/models/index.ts.html +367 -0
- package/coverage/lcov-report/{models → node-sdk/models}/list-message-direction-enum.ts.html +11 -11
- package/coverage/lcov-report/{models → node-sdk/models}/lookup-status-enum.ts.html +11 -11
- package/coverage/lcov-report/{models → node-sdk/models}/machine-detection-mode-enum.ts.html +11 -11
- package/coverage/lcov-report/{models → node-sdk/models}/message-direction-enum.ts.html +11 -11
- package/coverage/lcov-report/{models → node-sdk/models}/message-status-enum.ts.html +11 -11
- package/coverage/lcov-report/{models → node-sdk/models}/message-type-enum.ts.html +11 -11
- package/coverage/lcov-report/{models → node-sdk/models}/priority-enum.ts.html +11 -11
- package/coverage/lcov-report/{models → node-sdk/models}/recording-state-enum.ts.html +11 -11
- package/coverage/lcov-report/{models → node-sdk/models}/redirect-method-enum.ts.html +11 -11
- package/coverage/lcov.info +3366 -162
- package/custom_templates/README.mustache +22 -5
- package/custom_templates/package.mustache +2 -1
- package/custom_templates/tsconfig.mustache +2 -1
- package/dist/api/calls-api.js +2 -2
- package/dist/api/conferences-api.js +2 -2
- package/dist/api/media-api.js +2 -2
- package/dist/api/messages-api.js +2 -2
- package/dist/api/mfaapi.js +2 -2
- package/dist/api/phone-number-lookup-api.js +2 -2
- package/dist/api/recordings-api.js +2 -2
- package/dist/api/statistics-api.js +2 -2
- package/dist/api/transcriptions-api.d.ts +4 -4
- package/dist/api/transcriptions-api.js +6 -6
- package/dist/common.js +2 -2
- package/dist/models/call-recording-metadata.d.ts +6 -0
- package/dist/models/call-transcription-detected-language-enum.d.ts +22 -0
- package/dist/models/call-transcription-detected-language-enum.js +26 -0
- package/dist/models/call-transcription-metadata.d.ts +6 -0
- package/dist/models/call-transcription-track-enum.d.ts +21 -0
- package/dist/models/call-transcription-track-enum.js +25 -0
- package/dist/models/call-transcription.d.ts +7 -16
- package/dist/models/call-transcription.js +0 -10
- package/dist/models/conference-recording-metadata.d.ts +6 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +2 -0
- package/jest.config.js +1 -0
- package/models/call-recording-metadata.ts +6 -0
- package/models/call-transcription-detected-language-enum.ts +32 -0
- package/models/call-transcription-metadata.ts +6 -0
- package/models/call-transcription-track-enum.ts +31 -0
- package/models/call-transcription.ts +11 -18
- package/models/conference-recording-metadata.ts +6 -0
- package/models/index.ts +2 -0
- package/package.json +3 -2
- package/tests/callUtils.ts +11 -11
- package/tests/smoke/bxml.test.ts +17 -17
- package/tests/smoke/calls-api.test.ts +38 -38
- package/tests/smoke/conferences-api.test.ts +19 -19
- package/tests/smoke/media-api.test.ts +11 -11
- package/tests/smoke/messages-api.test.ts +26 -26
- package/tests/smoke/mfaapi.test.ts +18 -18
- package/tests/smoke/phone-number-lookup-api.test.ts +16 -6
- package/tests/smoke/recordings-api.test.ts +31 -31
- package/tests/smoke/statistics-api.test.ts +7 -7
- package/tests/smoke/transcriptions-api.test.ts +16 -15
- package/tests/unit/api/calls-api.test.ts +180 -0
- package/tests/unit/api/conferences-api.test.ts +160 -0
- package/tests/unit/api/media-api.test.ts +59 -0
- package/tests/unit/api/messages-api.test.ts +122 -0
- package/tests/unit/api/mfaapi.test.ts +76 -0
- package/tests/unit/api/phone-number-lookup-api.test.ts +96 -0
- package/tests/unit/api/recordings-api.test.ts +179 -0
- package/tests/unit/api/statistics-api.test.ts +35 -0
- package/tests/unit/api/transcriptions-api.test.ts +61 -0
- package/tests/unit/models/call-transcription-detected-language-enum.test.ts +9 -0
- package/tests/unit/models/call-transcription-track-enum.test.ts +8 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
import { PhoneNumberLookupApi } from "../../../api";
|
|
3
|
+
import { Configuration } from "../../../configuration";
|
|
4
|
+
import { LookupRequest, LookupStatusEnum } from "../../../models";
|
|
5
|
+
|
|
6
|
+
describe('PhoneNumberLookupApi', () => {
|
|
7
|
+
const config = new Configuration({
|
|
8
|
+
username: BW_USERNAME,
|
|
9
|
+
password: BW_PASSWORD,
|
|
10
|
+
basePath: 'http://127.0.0.1:4010'
|
|
11
|
+
});
|
|
12
|
+
const phoneNumberLookupApi = new PhoneNumberLookupApi(config);
|
|
13
|
+
|
|
14
|
+
const lookupRequestId = '1234';
|
|
15
|
+
|
|
16
|
+
describe('createLookup', () => {
|
|
17
|
+
test('should lookup phone number', async () => {
|
|
18
|
+
const lookupRequest: LookupRequest = {
|
|
19
|
+
tns: [BW_NUMBER]
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const { status, data } = await phoneNumberLookupApi.createLookup(BW_ACCOUNT_ID, lookupRequest);
|
|
23
|
+
|
|
24
|
+
expect(status).toEqual(202);
|
|
25
|
+
expect(data.requestId).toHaveLength(36);
|
|
26
|
+
expect(data.status).toBeOneOf([
|
|
27
|
+
LookupStatusEnum.Complete,
|
|
28
|
+
LookupStatusEnum.InProgress,
|
|
29
|
+
LookupStatusEnum.Failed,
|
|
30
|
+
LookupStatusEnum.PartialComplete
|
|
31
|
+
]);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe('getLookupStatus', () => {
|
|
36
|
+
test('should get lookup status', async () => {
|
|
37
|
+
const { status, data } = await phoneNumberLookupApi.getLookupStatus(
|
|
38
|
+
BW_ACCOUNT_ID,
|
|
39
|
+
lookupRequestId,
|
|
40
|
+
{ headers: { Prefer: 'example=lookupMultipleNumbersPartialCompleteExample' } }
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
expect(status).toEqual(200);
|
|
44
|
+
expect(data.requestId).toHaveLength(36);
|
|
45
|
+
expect(data.status).toBeOneOf([
|
|
46
|
+
LookupStatusEnum.Complete,
|
|
47
|
+
LookupStatusEnum.InProgress,
|
|
48
|
+
LookupStatusEnum.Failed,
|
|
49
|
+
LookupStatusEnum.PartialComplete
|
|
50
|
+
]);
|
|
51
|
+
expect(data.result).toBeInstanceOf(Array);
|
|
52
|
+
expect(data.result![0]).toContainAllKeys([
|
|
53
|
+
'Response Code',
|
|
54
|
+
'Message',
|
|
55
|
+
'E.164 Format',
|
|
56
|
+
'Formatted',
|
|
57
|
+
'Country',
|
|
58
|
+
'Line Type',
|
|
59
|
+
'Line Provider',
|
|
60
|
+
'Mobile Country Code',
|
|
61
|
+
'Mobile Network Code',
|
|
62
|
+
]);
|
|
63
|
+
expect(data.result![0]['Response Code']).toBeInteger();
|
|
64
|
+
expect(data.result![0].Message).toBeString();
|
|
65
|
+
expect(data.result![0]['E.164 Format']).toHaveLength(12);
|
|
66
|
+
expect(data.result![0].Formatted).toHaveLength(14);
|
|
67
|
+
expect(data.result![0].Country).toBeString();
|
|
68
|
+
expect(data.result![0]['Line Type']).toBeString();
|
|
69
|
+
expect(data.result![0]['Line Provider']).toBeString();
|
|
70
|
+
expect(data.result![0]['Mobile Country Code']).toBeString();
|
|
71
|
+
expect(data.result![0]['Mobile Network Code']).toBeString();
|
|
72
|
+
expect(data.failedTelephoneNumbers).toBeInstanceOf(Array);
|
|
73
|
+
expect(data.failedTelephoneNumbers![0]).toBeString();
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
describe('HTTP Errors', () => {
|
|
78
|
+
test('400', async () => {
|
|
79
|
+
try {
|
|
80
|
+
await phoneNumberLookupApi.createLookup(BW_ACCOUNT_ID, {});
|
|
81
|
+
} catch (e) {
|
|
82
|
+
expect(e.response.status).toEqual(400);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test('401', async () => {
|
|
87
|
+
const unauthorizedConfig = new Configuration({ basePath: 'http://127.0.0.1:4010' });
|
|
88
|
+
const unauthorizedPhoneNumberLookupApi = new PhoneNumberLookupApi(unauthorizedConfig);
|
|
89
|
+
try {
|
|
90
|
+
await unauthorizedPhoneNumberLookupApi.getLookupStatus(BW_ACCOUNT_ID, lookupRequestId);
|
|
91
|
+
} catch (e) {
|
|
92
|
+
expect(e.response.status).toEqual(401);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
});
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
import { RecordingsApi } from "../../../api";
|
|
3
|
+
import { Configuration } from "../../../configuration";
|
|
4
|
+
import { CallDirectionEnum, FileFormatEnum, RecordingStateEnum } from "../../../models";
|
|
5
|
+
|
|
6
|
+
describe('RecordingsApi', () => {
|
|
7
|
+
const config = new Configuration({
|
|
8
|
+
username: BW_USERNAME,
|
|
9
|
+
password: BW_PASSWORD,
|
|
10
|
+
basePath: 'http://127.0.0.1:4010'
|
|
11
|
+
});
|
|
12
|
+
const recordingsApi = new RecordingsApi(config);
|
|
13
|
+
|
|
14
|
+
const callId = 'c-1234';
|
|
15
|
+
const recordingId = 'r-1234';
|
|
16
|
+
|
|
17
|
+
describe('updateCallRecordingState', () => {
|
|
18
|
+
test('should update call recording state', async () => {
|
|
19
|
+
const pauseRecording = { state: RecordingStateEnum.Paused };
|
|
20
|
+
|
|
21
|
+
const { status } =
|
|
22
|
+
await recordingsApi.updateCallRecordingState(BW_ACCOUNT_ID, callId, pauseRecording);
|
|
23
|
+
expect(status).toEqual(200);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe('listAccountCallRecordings', () => {
|
|
28
|
+
test('should list account call recordings', async () => {
|
|
29
|
+
const { status, data } = await recordingsApi.listAccountCallRecordings(BW_ACCOUNT_ID);
|
|
30
|
+
|
|
31
|
+
expect(status).toEqual(200);
|
|
32
|
+
expect(data).toBeInstanceOf(Array);
|
|
33
|
+
expect(data[0].applicationId).toHaveLength(36);
|
|
34
|
+
expect(data[0].accountId).toHaveLength(7);
|
|
35
|
+
expect(data[0].callId).toHaveLength(47);
|
|
36
|
+
expect(data[0].parentCallId).toHaveLength(47);
|
|
37
|
+
expect(data[0].recordingId).toHaveLength(47);
|
|
38
|
+
expect(data[0].to).toHaveLength(12);
|
|
39
|
+
expect(data[0].from).toHaveLength(12);
|
|
40
|
+
expect(data[0].transferCallerId).toHaveLength(12);
|
|
41
|
+
expect(data[0].transferTo).toHaveLength(12);
|
|
42
|
+
expect(data[0].duration).toStartWith('PT');
|
|
43
|
+
expect(data[0].direction).toBeOneOf([CallDirectionEnum.Inbound, CallDirectionEnum.Outbound]);
|
|
44
|
+
expect(data[0].channels).toBeNumber();
|
|
45
|
+
expect(data[0].startTime).toBeDateString();
|
|
46
|
+
expect(data[0].endTime).toBeDateString();
|
|
47
|
+
expect(data[0].fileFormat).toBeOneOf([FileFormatEnum.Wav, FileFormatEnum.Mp3]);
|
|
48
|
+
expect(data[0].status).toBeString();
|
|
49
|
+
expect(data[0].mediaUrl).toStartWith('http');
|
|
50
|
+
expect(data[0].transcription).toContainAllKeys(['id', 'status', 'completedTime', 'url']);
|
|
51
|
+
expect(data[0].transcription!.id).toHaveLength(38);
|
|
52
|
+
expect(data[0].transcription!.status).toBeString();
|
|
53
|
+
expect(data[0].transcription!.completedTime).toBeDateString();
|
|
54
|
+
expect(data[0].transcription!.url).toStartWith('http');
|
|
55
|
+
expect(data[0].recordingName).toBeString();
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
describe('listCallRecordings', () => {
|
|
60
|
+
test('should list call recordings', async () => {
|
|
61
|
+
const { status, data } = await recordingsApi.listCallRecordings(BW_ACCOUNT_ID, callId);
|
|
62
|
+
|
|
63
|
+
expect(status).toEqual(200);
|
|
64
|
+
expect(data).toBeInstanceOf(Array);
|
|
65
|
+
expect(data[0].applicationId).toHaveLength(36);
|
|
66
|
+
expect(data[0].accountId).toHaveLength(7);
|
|
67
|
+
expect(data[0].callId).toHaveLength(47);
|
|
68
|
+
expect(data[0].parentCallId).toHaveLength(47);
|
|
69
|
+
expect(data[0].recordingId).toHaveLength(47);
|
|
70
|
+
expect(data[0].to).toHaveLength(12);
|
|
71
|
+
expect(data[0].from).toHaveLength(12);
|
|
72
|
+
expect(data[0].transferCallerId).toHaveLength(12);
|
|
73
|
+
expect(data[0].transferTo).toHaveLength(12);
|
|
74
|
+
expect(data[0].duration).toStartWith('PT');
|
|
75
|
+
expect(data[0].direction).toBeOneOf([CallDirectionEnum.Inbound, CallDirectionEnum.Outbound]);
|
|
76
|
+
expect(data[0].channels).toBeNumber();
|
|
77
|
+
expect(data[0].startTime).toBeDateString();
|
|
78
|
+
expect(data[0].endTime).toBeDateString();
|
|
79
|
+
expect(data[0].fileFormat).toBeOneOf([FileFormatEnum.Wav, FileFormatEnum.Mp3]);
|
|
80
|
+
expect(data[0].status).toBeString();
|
|
81
|
+
expect(data[0].mediaUrl).toStartWith('http');
|
|
82
|
+
expect(data[0].transcription).toContainAllKeys(['id', 'status', 'completedTime', 'url']);
|
|
83
|
+
expect(data[0].transcription!.id).toHaveLength(38);
|
|
84
|
+
expect(data[0].transcription!.status).toBeString();
|
|
85
|
+
expect(data[0].transcription!.completedTime).toBeDateString();
|
|
86
|
+
expect(data[0].transcription!.url).toStartWith('http');
|
|
87
|
+
expect(data[0].recordingName).toBeString();
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
describe('getCallRecording', () => {
|
|
92
|
+
test.skip('should get call recording', async () => {
|
|
93
|
+
const { status, data } = await recordingsApi.getCallRecording(BW_ACCOUNT_ID, callId, recordingId);
|
|
94
|
+
|
|
95
|
+
expect(status).toEqual(200);
|
|
96
|
+
expect(data.applicationId).toHaveLength(36);
|
|
97
|
+
expect(data.accountId).toHaveLength(7);
|
|
98
|
+
expect(data.callId).toHaveLength(47);
|
|
99
|
+
expect(data.parentCallId).toHaveLength(47);
|
|
100
|
+
expect(data.recordingId).toHaveLength(47);
|
|
101
|
+
expect(data.to).toHaveLength(12);
|
|
102
|
+
expect(data.from).toHaveLength(12);
|
|
103
|
+
expect(data.transferCallerId).toHaveLength(12);
|
|
104
|
+
expect(data.transferTo).toHaveLength(12);
|
|
105
|
+
expect(data.duration).toStartWith('PT');
|
|
106
|
+
expect(data.direction).toBeOneOf([CallDirectionEnum.Inbound, CallDirectionEnum.Outbound]);
|
|
107
|
+
expect(data.channels).toBeNumber();
|
|
108
|
+
expect(data.startTime).toBeDateString();
|
|
109
|
+
expect(data.endTime).toBeDateString();
|
|
110
|
+
expect(data.fileFormat).toBeOneOf([FileFormatEnum.Wav, FileFormatEnum.Mp3]);
|
|
111
|
+
expect(data.status).toBeString();
|
|
112
|
+
expect(data.mediaUrl).toStartWith('http');
|
|
113
|
+
expect(data.transcription).toContainAllKeys(['id', 'status', 'completedTime', 'url']);
|
|
114
|
+
expect(data.transcription!.id).toHaveLength(38);
|
|
115
|
+
expect(data.transcription!.status).toBeString();
|
|
116
|
+
expect(data.transcription!.completedTime).toBeDateString();
|
|
117
|
+
expect(data.transcription!.url).toStartWith('http');
|
|
118
|
+
expect(data.recordingName).toBeString();
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
describe('downloadCallRecording', () => {
|
|
123
|
+
test('should download call recording', async () => {
|
|
124
|
+
const { status, data } = await recordingsApi.downloadCallRecording(BW_ACCOUNT_ID, callId, recordingId);
|
|
125
|
+
|
|
126
|
+
expect(status).toEqual(200);
|
|
127
|
+
expect(data).toBeDefined();
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
describe('transcribeCallRecording', () => {
|
|
132
|
+
test('should create a transcription request', async () => {
|
|
133
|
+
const transcribeRecording = {
|
|
134
|
+
callbackUrl: `${MANTECA_BASE_URL}/transcriptions`,
|
|
135
|
+
tag: callId
|
|
136
|
+
};
|
|
137
|
+
const { status } =
|
|
138
|
+
await recordingsApi.transcribeCallRecording(BW_ACCOUNT_ID, callId, recordingId, transcribeRecording);
|
|
139
|
+
|
|
140
|
+
expect(status).toEqual(204);
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
describe('getRecordingTranscription', () => {
|
|
145
|
+
test('should get recording transcription', async () => {
|
|
146
|
+
const { status, data } = await recordingsApi.getRecordingTranscription(BW_ACCOUNT_ID, callId, recordingId);
|
|
147
|
+
|
|
148
|
+
expect(status).toEqual(200);
|
|
149
|
+
expect(data.transcripts).toBeInstanceOf(Array);
|
|
150
|
+
expect(data.transcripts![0].text).toBeString();
|
|
151
|
+
expect(data.transcripts![0].confidence).toBeNumber();
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
describe('deleteRecordingTranscription', () => {
|
|
156
|
+
test('should delete recording transcription', async () => {
|
|
157
|
+
const { status } = await recordingsApi.deleteRecordingTranscription(BW_ACCOUNT_ID, callId, recordingId);
|
|
158
|
+
|
|
159
|
+
expect(status).toEqual(204);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
describe('deleteRecordingMedia', () => {
|
|
164
|
+
test('should delete recording media', async () => {
|
|
165
|
+
const { status } = await recordingsApi.deleteRecordingMedia(BW_ACCOUNT_ID, callId, recordingId);
|
|
166
|
+
|
|
167
|
+
expect(status).toEqual(204);
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
describe('deleteRecording', () => {
|
|
172
|
+
test('should delete recording', async () => {
|
|
173
|
+
const { status } = await recordingsApi.deleteRecording(BW_ACCOUNT_ID, callId, recordingId);
|
|
174
|
+
|
|
175
|
+
expect(status).toEqual(204);
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
import { StatisticsApi } from '../../../api';
|
|
3
|
+
import { Configuration } from '../../../configuration';
|
|
4
|
+
|
|
5
|
+
describe('StatisticsApi', () => {
|
|
6
|
+
const config = new Configuration({
|
|
7
|
+
username: BW_USERNAME,
|
|
8
|
+
password: BW_PASSWORD,
|
|
9
|
+
basePath: 'http://127.0.0.1:4010'
|
|
10
|
+
});
|
|
11
|
+
const statisticsApi = new StatisticsApi(config);
|
|
12
|
+
|
|
13
|
+
describe('getStatistics', () => {
|
|
14
|
+
test('should get statistics', async () => {
|
|
15
|
+
const { status, data } = await statisticsApi.getStatistics(BW_ACCOUNT_ID);
|
|
16
|
+
|
|
17
|
+
expect(status).toEqual(200);
|
|
18
|
+
expect(data.currentCallQueueSize).toBeInteger();
|
|
19
|
+
expect(data.maxCallQueueSize).toBeInteger();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
describe('HTTP Errors', () => {
|
|
24
|
+
test('401', async () => {
|
|
25
|
+
const unauthorizedConfig = new Configuration({ basePath: 'http://127.0.0.1:4010' });
|
|
26
|
+
const unauthorizedStatisticsApi = new StatisticsApi(unauthorizedConfig);
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
await unauthorizedStatisticsApi.getStatistics(BW_ACCOUNT_ID);
|
|
30
|
+
} catch (e) {
|
|
31
|
+
expect(e.response.status).toEqual(401);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
import { TranscriptionsApi } from "../../../api";
|
|
3
|
+
import { Configuration } from "../../../configuration";
|
|
4
|
+
import { CallTranscriptionDetectedLanguageEnum, CallTranscriptionTrackEnum } from "../../../models";
|
|
5
|
+
|
|
6
|
+
describe('TranscriptionsApi', () => {
|
|
7
|
+
const config = new Configuration({
|
|
8
|
+
username: BW_USERNAME,
|
|
9
|
+
password: BW_PASSWORD,
|
|
10
|
+
basePath: 'http://127.0.0.1:4010'
|
|
11
|
+
});
|
|
12
|
+
const transcriptionsApi = new TranscriptionsApi(config);
|
|
13
|
+
|
|
14
|
+
const callId = 'c-1234';
|
|
15
|
+
const transcriptionId = 't-1234';
|
|
16
|
+
|
|
17
|
+
describe('listRealTimeTranscriptions', () => {
|
|
18
|
+
test('should list call transcriptions', async () => {
|
|
19
|
+
const { status, data } =
|
|
20
|
+
await transcriptionsApi.listRealTimeTranscriptions(BW_ACCOUNT_ID, callId);
|
|
21
|
+
|
|
22
|
+
expect(status).toEqual(200);
|
|
23
|
+
expect(data).toBeInstanceOf(Array);
|
|
24
|
+
expect(data[0].transcriptionId).toBeString();
|
|
25
|
+
expect(data[0].transcriptionUrl).toBeString();
|
|
26
|
+
expect(data[0].transcriptionName).toBeString();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe('getRealTimeTranscription', () => {
|
|
31
|
+
test('should get call transcription', async () => {
|
|
32
|
+
const { status, data } =
|
|
33
|
+
await transcriptionsApi.getRealTimeTranscription(BW_ACCOUNT_ID, callId, transcriptionId);
|
|
34
|
+
|
|
35
|
+
expect(status).toEqual(200);
|
|
36
|
+
expect(data.accountId).toHaveLength(7);
|
|
37
|
+
expect(data.callId).toHaveLength(47);
|
|
38
|
+
expect(data.transcriptionId).toBeString();
|
|
39
|
+
expect(data.tracks).toBeInstanceOf(Array);
|
|
40
|
+
expect(data.tracks![0].detectedLanguage).toBeOneOf([
|
|
41
|
+
CallTranscriptionDetectedLanguageEnum.EnUs,
|
|
42
|
+
CallTranscriptionDetectedLanguageEnum.EsUs,
|
|
43
|
+
CallTranscriptionDetectedLanguageEnum.FrFr
|
|
44
|
+
]);
|
|
45
|
+
expect(data.tracks![0].track).toBeOneOf([
|
|
46
|
+
CallTranscriptionTrackEnum.Inbound,
|
|
47
|
+
CallTranscriptionTrackEnum.Outbound
|
|
48
|
+
]);
|
|
49
|
+
expect(data.tracks![0].transcript).toBeString();
|
|
50
|
+
expect(data.tracks![0].confidence).toBeNumber();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe('deleteRealTimeTranscription', () => {
|
|
55
|
+
test('should delete call transcription', async () => {
|
|
56
|
+
const { status } =
|
|
57
|
+
await transcriptionsApi.deleteRealTimeTranscription(BW_ACCOUNT_ID, callId, transcriptionId);
|
|
58
|
+
expect(status).toEqual(200); // This is a bug in the API, it should return 204. VAPI-1863 should fix this.
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CallTranscriptionDetectedLanguageEnum } from '../../../models/call-transcription-detected-language-enum';
|
|
2
|
+
|
|
3
|
+
describe('CallTranscriptionTrackEnum', () => {
|
|
4
|
+
test('should define the expected values', () => {
|
|
5
|
+
expect(CallTranscriptionDetectedLanguageEnum.EnUs).toBe('en-US');
|
|
6
|
+
expect(CallTranscriptionDetectedLanguageEnum.EsUs).toBe('es-US');
|
|
7
|
+
expect(CallTranscriptionDetectedLanguageEnum.FrFr).toBe('fr-FR');
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CallTranscriptionTrackEnum } from '../../../models/call-transcription-track-enum';
|
|
2
|
+
|
|
3
|
+
describe('CallTranscriptionTrackEnum', () => {
|
|
4
|
+
test('should define the expected values', () => {
|
|
5
|
+
expect(CallTranscriptionTrackEnum.Inbound).toBe('inbound');
|
|
6
|
+
expect(CallTranscriptionTrackEnum.Outbound).toBe('outbound');
|
|
7
|
+
});
|
|
8
|
+
});
|