@unboundcx/sdk-internal 2.3.0 → 2.3.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/index.js +19 -1
- package/package.json +1 -1
- package/services/branding.js +2 -1
- package/services/email.js +4 -3
- package/services/masterAuth.js +3 -2
- package/services/phoneNumbers.js +2 -1
- package/services/programmableVoice.js +12 -11
- package/services/servers.js +6 -5
- package/services/sip.js +7 -6
- package/services/socket.js +5 -4
- package/services/video.js +22 -3
- package/services/voice.js +2 -1
- package/services/voicemail.js +2 -1
- package/utils/sdkRequest.js +10 -0
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable indent */
|
|
2
2
|
/* eslint-disable prettier/prettier */
|
|
3
3
|
|
|
4
|
+
import { internalRequest } from './utils/sdkRequest.js';
|
|
4
5
|
import { InternalSipService } from './services/sip.js';
|
|
5
6
|
import { InternalEmailService } from './services/email.js';
|
|
6
7
|
import { InternalProgrammableVoiceService } from './services/programmableVoice.js';
|
|
@@ -129,9 +130,26 @@ export class InternalSDK {
|
|
|
129
130
|
const params = { body };
|
|
130
131
|
if (timeoutMs) params.timeoutMs = timeoutMs;
|
|
131
132
|
|
|
132
|
-
const result = await this.sdk
|
|
133
|
+
const result = await internalRequest(this.sdk, path, 'POST', params);
|
|
133
134
|
return result;
|
|
134
135
|
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Compile a UOQL string via app1-api internal analyze.
|
|
139
|
+
* POST /internal/objects/uoql/analyze
|
|
140
|
+
*/
|
|
141
|
+
async analyzeUoql({ uoql, accountId }) {
|
|
142
|
+
this.sdk.validateParams(
|
|
143
|
+
{ uoql, accountId },
|
|
144
|
+
{
|
|
145
|
+
uoql: { type: 'string', required: true },
|
|
146
|
+
accountId: { type: 'string', required: true },
|
|
147
|
+
},
|
|
148
|
+
);
|
|
149
|
+
return internalRequest(this.sdk, '/internal/objects/uoql/analyze', 'POST', {
|
|
150
|
+
body: { uoql, accountId },
|
|
151
|
+
});
|
|
152
|
+
}
|
|
135
153
|
}
|
|
136
154
|
|
|
137
155
|
// Extension pattern for the main SDK
|
package/package.json
CHANGED
package/services/branding.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { internalRequest } from '../utils/sdkRequest.js';
|
|
1
2
|
export class InternalBrandingService {
|
|
2
3
|
constructor(sdk) {
|
|
3
4
|
this.sdk = sdk;
|
|
@@ -14,7 +15,7 @@ export class InternalBrandingService {
|
|
|
14
15
|
* @returns {Promise<{ trustedDomains: string[] }>}
|
|
15
16
|
*/
|
|
16
17
|
async listTrustedDomains() {
|
|
17
|
-
const result = await this.sdk
|
|
18
|
+
const result = await internalRequest(this.sdk,
|
|
18
19
|
'/internal/branding/trustedDomains',
|
|
19
20
|
'GET',
|
|
20
21
|
{},
|
package/services/email.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { internalRequest } from '../utils/sdkRequest.js';
|
|
1
2
|
export class InternalEmailService {
|
|
2
3
|
constructor(sdk) {
|
|
3
4
|
this.sdk = sdk;
|
|
@@ -11,7 +12,7 @@ export class InternalEmailService {
|
|
|
11
12
|
},
|
|
12
13
|
);
|
|
13
14
|
|
|
14
|
-
const result = await this.sdk
|
|
15
|
+
const result = await internalRequest(this.sdk,
|
|
15
16
|
`/internal/email/open/${emailId}`,
|
|
16
17
|
'POST',
|
|
17
18
|
);
|
|
@@ -31,7 +32,7 @@ export class InternalEmailService {
|
|
|
31
32
|
body: { trackingCookie },
|
|
32
33
|
};
|
|
33
34
|
|
|
34
|
-
const result = await this.sdk
|
|
35
|
+
const result = await internalRequest(this.sdk,
|
|
35
36
|
`/internal/email/click/${linkId}`,
|
|
36
37
|
'POST',
|
|
37
38
|
params,
|
|
@@ -52,7 +53,7 @@ export class InternalEmailService {
|
|
|
52
53
|
body: { to },
|
|
53
54
|
};
|
|
54
55
|
|
|
55
|
-
const result = await this.sdk
|
|
56
|
+
const result = await internalRequest(this.sdk,
|
|
56
57
|
`/internal/email/unsubscribe/${emailId}`,
|
|
57
58
|
'POST',
|
|
58
59
|
params,
|
package/services/masterAuth.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { internalRequest } from '../utils/sdkRequest.js';
|
|
1
2
|
export class InternalMasterAuthService {
|
|
2
3
|
constructor(sdk) {
|
|
3
4
|
this.sdk = sdk;
|
|
@@ -25,7 +26,7 @@ export class InternalMasterAuthService {
|
|
|
25
26
|
},
|
|
26
27
|
};
|
|
27
28
|
|
|
28
|
-
const result = await this.sdk
|
|
29
|
+
const result = await internalRequest(this.sdk,
|
|
29
30
|
'/internal/masterAuth/',
|
|
30
31
|
'POST',
|
|
31
32
|
params,
|
|
@@ -58,7 +59,7 @@ export class InternalMasterAuthService {
|
|
|
58
59
|
const body = { service };
|
|
59
60
|
if (expiresIn !== undefined) body.expiresIn = expiresIn;
|
|
60
61
|
|
|
61
|
-
const result = await this.sdk
|
|
62
|
+
const result = await internalRequest(this.sdk,
|
|
62
63
|
'/internal/masterAuth/internal-token',
|
|
63
64
|
'POST',
|
|
64
65
|
{ body },
|
package/services/phoneNumbers.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { internalRequest } from '../utils/sdkRequest.js';
|
|
1
2
|
export class InternalPhoneNumbersService {
|
|
2
3
|
constructor(sdk) {
|
|
3
4
|
this.sdk = sdk;
|
|
@@ -19,7 +20,7 @@ export class InternalPhoneNumbersService {
|
|
|
19
20
|
},
|
|
20
21
|
);
|
|
21
22
|
|
|
22
|
-
const result = await this.sdk
|
|
23
|
+
const result = await internalRequest(this.sdk,
|
|
23
24
|
'/internal/phoneNumbers/inventory',
|
|
24
25
|
'POST',
|
|
25
26
|
{
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { internalRequest } from '../utils/sdkRequest.js';
|
|
1
2
|
export class InternalProgrammableVoiceService {
|
|
2
3
|
constructor(sdk) {
|
|
3
4
|
this.sdk = sdk;
|
|
@@ -17,7 +18,7 @@ export class InternalProgrammableVoiceService {
|
|
|
17
18
|
body: streamData,
|
|
18
19
|
};
|
|
19
20
|
|
|
20
|
-
const result = await this.sdk
|
|
21
|
+
const result = await internalRequest(this.sdk,
|
|
21
22
|
'/internal/programmableVoice/streamProxy',
|
|
22
23
|
'POST',
|
|
23
24
|
params,
|
|
@@ -37,7 +38,7 @@ export class InternalProgrammableVoiceService {
|
|
|
37
38
|
body: webhookData,
|
|
38
39
|
};
|
|
39
40
|
|
|
40
|
-
const result = await this.sdk
|
|
41
|
+
const result = await internalRequest(this.sdk,
|
|
41
42
|
'/internal/programmableVoice/proxy',
|
|
42
43
|
'POST',
|
|
43
44
|
params,
|
|
@@ -69,7 +70,7 @@ export class InternalProgrammableVoiceService {
|
|
|
69
70
|
},
|
|
70
71
|
};
|
|
71
72
|
|
|
72
|
-
const result = await this.sdk
|
|
73
|
+
const result = await internalRequest(this.sdk,
|
|
73
74
|
'/internal/programmableVoice/setVariable',
|
|
74
75
|
'POST',
|
|
75
76
|
params,
|
|
@@ -99,7 +100,7 @@ export class InternalProgrammableVoiceService {
|
|
|
99
100
|
},
|
|
100
101
|
};
|
|
101
102
|
|
|
102
|
-
const result = await this.sdk
|
|
103
|
+
const result = await internalRequest(this.sdk,
|
|
103
104
|
'/internal/programmableVoice/getVariable',
|
|
104
105
|
'POST',
|
|
105
106
|
params,
|
|
@@ -151,7 +152,7 @@ export class InternalProgrammableVoiceService {
|
|
|
151
152
|
body: meetingData,
|
|
152
153
|
};
|
|
153
154
|
|
|
154
|
-
const result = await this.sdk
|
|
155
|
+
const result = await internalRequest(this.sdk,
|
|
155
156
|
'/internal/programmableVoice/joinMeetingRoom',
|
|
156
157
|
'POST',
|
|
157
158
|
params,
|
|
@@ -172,7 +173,7 @@ export class InternalProgrammableVoiceService {
|
|
|
172
173
|
body: sessionData,
|
|
173
174
|
};
|
|
174
175
|
|
|
175
|
-
const result = await this.sdk
|
|
176
|
+
const result = await internalRequest(this.sdk,
|
|
176
177
|
`/internal/programmableVoice/${location}`,
|
|
177
178
|
'POST',
|
|
178
179
|
params,
|
|
@@ -248,7 +249,7 @@ export class VoiceChannelService {
|
|
|
248
249
|
},
|
|
249
250
|
};
|
|
250
251
|
|
|
251
|
-
const result = await this.sdk
|
|
252
|
+
const result = await internalRequest(this.sdk,
|
|
252
253
|
'/internal/programmableVoice/voiceChannel',
|
|
253
254
|
'POST',
|
|
254
255
|
params,
|
|
@@ -322,7 +323,7 @@ export class VoiceChannelService {
|
|
|
322
323
|
},
|
|
323
324
|
};
|
|
324
325
|
|
|
325
|
-
const result = await this.sdk
|
|
326
|
+
const result = await internalRequest(this.sdk,
|
|
326
327
|
'/internal/programmableVoice/voiceChannel',
|
|
327
328
|
'PUT',
|
|
328
329
|
params,
|
|
@@ -375,7 +376,7 @@ export class TranscriptionService {
|
|
|
375
376
|
body: transcriptionData,
|
|
376
377
|
};
|
|
377
378
|
|
|
378
|
-
const result = await this.sdk
|
|
379
|
+
const result = await internalRequest(this.sdk,
|
|
379
380
|
'/internal/programmableVoice/transcription/',
|
|
380
381
|
'POST',
|
|
381
382
|
params,
|
|
@@ -396,7 +397,7 @@ export class TranscriptionService {
|
|
|
396
397
|
body: completionData,
|
|
397
398
|
};
|
|
398
399
|
|
|
399
|
-
const result = await this.sdk
|
|
400
|
+
const result = await internalRequest(this.sdk,
|
|
400
401
|
`/internal/programmableVoice/transcription/${id}`,
|
|
401
402
|
'PUT',
|
|
402
403
|
params,
|
|
@@ -417,7 +418,7 @@ export class TranscriptionService {
|
|
|
417
418
|
body: messageData,
|
|
418
419
|
};
|
|
419
420
|
|
|
420
|
-
const result = await this.sdk
|
|
421
|
+
const result = await internalRequest(this.sdk,
|
|
421
422
|
`/internal/programmableVoice/transcription/${id}`,
|
|
422
423
|
'POST',
|
|
423
424
|
params,
|
package/services/servers.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { internalRequest } from '../utils/sdkRequest.js';
|
|
1
2
|
export class InternalServersService {
|
|
2
3
|
constructor(sdk) {
|
|
3
4
|
this.sdk = sdk;
|
|
@@ -59,7 +60,7 @@ export class InternalServersService {
|
|
|
59
60
|
body: serverData,
|
|
60
61
|
};
|
|
61
62
|
|
|
62
|
-
const result = await this.sdk
|
|
63
|
+
const result = await internalRequest(this.sdk, '/internal/servers/', 'POST', params);
|
|
63
64
|
return result;
|
|
64
65
|
}
|
|
65
66
|
|
|
@@ -100,7 +101,7 @@ export class InternalServersService {
|
|
|
100
101
|
body: updateData,
|
|
101
102
|
};
|
|
102
103
|
|
|
103
|
-
const result = await this.sdk
|
|
104
|
+
const result = await internalRequest(this.sdk,
|
|
104
105
|
`/internal/servers/${id}`,
|
|
105
106
|
'PUT',
|
|
106
107
|
params,
|
|
@@ -116,7 +117,7 @@ export class InternalServersService {
|
|
|
116
117
|
},
|
|
117
118
|
);
|
|
118
119
|
|
|
119
|
-
const result = await this.sdk
|
|
120
|
+
const result = await internalRequest(this.sdk, `/internal/servers/${id}`, 'DELETE');
|
|
120
121
|
return result;
|
|
121
122
|
}
|
|
122
123
|
|
|
@@ -128,7 +129,7 @@ export class InternalServersService {
|
|
|
128
129
|
},
|
|
129
130
|
);
|
|
130
131
|
|
|
131
|
-
const result = await this.sdk
|
|
132
|
+
const result = await internalRequest(this.sdk,
|
|
132
133
|
`/internal/servers/${id}/shutdownCheck`,
|
|
133
134
|
'GET',
|
|
134
135
|
);
|
|
@@ -153,7 +154,7 @@ export class AwsServersService {
|
|
|
153
154
|
body: assignmentData,
|
|
154
155
|
};
|
|
155
156
|
|
|
156
|
-
const result = await this.sdk
|
|
157
|
+
const result = await internalRequest(this.sdk,
|
|
157
158
|
'/internal/servers/aws/assignElasticIp',
|
|
158
159
|
'POST',
|
|
159
160
|
params,
|
package/services/sip.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { internalRequest } from '../utils/sdkRequest.js';
|
|
1
2
|
export class InternalSipService {
|
|
2
3
|
constructor(sdk) {
|
|
3
4
|
this.sdk = sdk;
|
|
@@ -19,7 +20,7 @@ export class InternalSipService {
|
|
|
19
20
|
const options = {
|
|
20
21
|
body: { to, from, callId, auth, peerDirection, contact },
|
|
21
22
|
};
|
|
22
|
-
const result = await this.sdk
|
|
23
|
+
const result = await internalRequest(this.sdk,
|
|
23
24
|
`/internal/sip/router/${to}?from=${from}&callId=${callId}`,
|
|
24
25
|
'POST',
|
|
25
26
|
options,
|
|
@@ -39,7 +40,7 @@ export class InternalSipService {
|
|
|
39
40
|
);
|
|
40
41
|
|
|
41
42
|
const options = {};
|
|
42
|
-
const result = await this.sdk
|
|
43
|
+
const result = await internalRequest(this.sdk,
|
|
43
44
|
`/internal/sip/server/${type}?regionCode=${regionCode}&callId=${callId}`,
|
|
44
45
|
'GET',
|
|
45
46
|
options,
|
|
@@ -54,7 +55,7 @@ export class InternalSipService {
|
|
|
54
55
|
...params,
|
|
55
56
|
},
|
|
56
57
|
};
|
|
57
|
-
const result = await this.sdk
|
|
58
|
+
const result = await internalRequest(this.sdk, `/internal/sip/log`, 'POST', options);
|
|
58
59
|
return result;
|
|
59
60
|
}
|
|
60
61
|
|
|
@@ -130,7 +131,7 @@ export class InternalSipService {
|
|
|
130
131
|
},
|
|
131
132
|
};
|
|
132
133
|
|
|
133
|
-
const result = await this.sdk
|
|
134
|
+
const result = await internalRequest(this.sdk,
|
|
134
135
|
`/internal/sip/register`,
|
|
135
136
|
'POST',
|
|
136
137
|
options,
|
|
@@ -155,7 +156,7 @@ export class InternalSipService {
|
|
|
155
156
|
accountId,
|
|
156
157
|
},
|
|
157
158
|
};
|
|
158
|
-
const result = await this.sdk
|
|
159
|
+
const result = await internalRequest(this.sdk,
|
|
159
160
|
`/internal/sip/register/`,
|
|
160
161
|
'DELETE',
|
|
161
162
|
options,
|
|
@@ -232,7 +233,7 @@ export class InternalSipService {
|
|
|
232
233
|
connectionType,
|
|
233
234
|
},
|
|
234
235
|
};
|
|
235
|
-
const result = await this.sdk
|
|
236
|
+
const result = await internalRequest(this.sdk,
|
|
236
237
|
`/internal/sip/register/validate`,
|
|
237
238
|
'POST',
|
|
238
239
|
options,
|
package/services/socket.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { internalRequest } from '../utils/sdkRequest.js';
|
|
1
2
|
export class InternalSocketService {
|
|
2
3
|
constructor(sdk) {
|
|
3
4
|
this.sdk = sdk;
|
|
@@ -43,7 +44,7 @@ export class InternalSocketService {
|
|
|
43
44
|
body: connectionData,
|
|
44
45
|
};
|
|
45
46
|
|
|
46
|
-
const result = await this.sdk
|
|
47
|
+
const result = await internalRequest(this.sdk,
|
|
47
48
|
'/internal/socket/connection',
|
|
48
49
|
'POST',
|
|
49
50
|
params,
|
|
@@ -73,7 +74,7 @@ export class InternalSocketService {
|
|
|
73
74
|
body: updateData,
|
|
74
75
|
};
|
|
75
76
|
|
|
76
|
-
const result = await this.sdk
|
|
77
|
+
const result = await internalRequest(this.sdk,
|
|
77
78
|
`/internal/socket/connection/${id}`,
|
|
78
79
|
'PUT',
|
|
79
80
|
params,
|
|
@@ -89,7 +90,7 @@ export class InternalSocketService {
|
|
|
89
90
|
},
|
|
90
91
|
);
|
|
91
92
|
|
|
92
|
-
const result = await this.sdk
|
|
93
|
+
const result = await internalRequest(this.sdk,
|
|
93
94
|
`/internal/socket/connection/${id}`,
|
|
94
95
|
'DELETE',
|
|
95
96
|
);
|
|
@@ -108,7 +109,7 @@ export class InternalSocketService {
|
|
|
108
109
|
body: { serverId },
|
|
109
110
|
};
|
|
110
111
|
|
|
111
|
-
const result = await this.sdk
|
|
112
|
+
const result = await internalRequest(this.sdk,
|
|
112
113
|
'/internal/socket/connection/byServerId',
|
|
113
114
|
'DELETE',
|
|
114
115
|
params,
|
package/services/video.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { internalRequest } from '../utils/sdkRequest.js';
|
|
1
2
|
export class InternalVideoService {
|
|
2
3
|
constructor(sdk) {
|
|
3
4
|
this.sdk = sdk;
|
|
@@ -30,7 +31,7 @@ export class InternalVideoService {
|
|
|
30
31
|
body,
|
|
31
32
|
};
|
|
32
33
|
|
|
33
|
-
const result = await this.sdk
|
|
34
|
+
const result = await internalRequest(this.sdk,
|
|
34
35
|
'/internal/video/meetJoin',
|
|
35
36
|
'POST',
|
|
36
37
|
params,
|
|
@@ -59,7 +60,7 @@ export class InternalVideoService {
|
|
|
59
60
|
body: { sipCallId, accountId },
|
|
60
61
|
};
|
|
61
62
|
|
|
62
|
-
const result = await this.sdk
|
|
63
|
+
const result = await internalRequest(this.sdk,
|
|
63
64
|
'/internal/video/meetCallEnded',
|
|
64
65
|
'POST',
|
|
65
66
|
params,
|
|
@@ -101,11 +102,29 @@ export class InternalVideoService {
|
|
|
101
102
|
body: payload,
|
|
102
103
|
};
|
|
103
104
|
|
|
104
|
-
const result = await this.sdk
|
|
105
|
+
const result = await internalRequest(this.sdk,
|
|
105
106
|
'/internal/video/meetOutboundStatus',
|
|
106
107
|
'POST',
|
|
107
108
|
params,
|
|
108
109
|
);
|
|
109
110
|
return result;
|
|
110
111
|
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Notify app1-api that a video session closed.
|
|
115
|
+
* POST /internal/video/:roomId/close
|
|
116
|
+
* Body: { reason }
|
|
117
|
+
*/
|
|
118
|
+
async closeRoom(roomId, { reason } = {}) {
|
|
119
|
+
this.sdk.validateParams(
|
|
120
|
+
{ roomId },
|
|
121
|
+
{ roomId: { type: 'string', required: true } },
|
|
122
|
+
);
|
|
123
|
+
return internalRequest(
|
|
124
|
+
this.sdk,
|
|
125
|
+
`/internal/video/${roomId}/close`,
|
|
126
|
+
'POST',
|
|
127
|
+
{ body: { reason } },
|
|
128
|
+
);
|
|
129
|
+
}
|
|
111
130
|
}
|
package/services/voice.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { internalRequest } from '../utils/sdkRequest.js';
|
|
1
2
|
export class InternalVoiceService {
|
|
2
3
|
constructor(sdk) {
|
|
3
4
|
this.sdk = sdk;
|
|
@@ -29,7 +30,7 @@ export class InternalVoiceService {
|
|
|
29
30
|
body: { accountId, events },
|
|
30
31
|
};
|
|
31
32
|
|
|
32
|
-
const result = await this.sdk
|
|
33
|
+
const result = await internalRequest(this.sdk,
|
|
33
34
|
'/internal/voice/cdrEvents',
|
|
34
35
|
'POST',
|
|
35
36
|
params,
|
package/services/voicemail.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { internalRequest } from '../utils/sdkRequest.js';
|
|
1
2
|
export class InternalVoicemailService {
|
|
2
3
|
constructor(sdk) {
|
|
3
4
|
this.sdk = sdk;
|
|
@@ -37,7 +38,7 @@ export class InternalVoicemailService {
|
|
|
37
38
|
},
|
|
38
39
|
};
|
|
39
40
|
|
|
40
|
-
const result = await this.sdk
|
|
41
|
+
const result = await internalRequest(this.sdk,
|
|
41
42
|
'/internal/voicemail/transcription',
|
|
42
43
|
'POST',
|
|
43
44
|
params,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const SDK_REQUEST = Symbol.for('unbound.sdk.request');
|
|
2
|
+
|
|
3
|
+
/** Calls the public SDK instance request. Not an HTTP client. */
|
|
4
|
+
export function internalRequest(sdk, endpoint, method, params, forceFetch) {
|
|
5
|
+
const run = sdk?.[SDK_REQUEST];
|
|
6
|
+
if (typeof run !== 'function') {
|
|
7
|
+
throw new Error('SDK request is not initialized');
|
|
8
|
+
}
|
|
9
|
+
return run(endpoint, method, params, forceFetch);
|
|
10
|
+
}
|