@unboundcx/sdk-internal 2.2.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 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';
@@ -9,6 +10,9 @@ import { InternalSocketService } from './services/socket.js';
9
10
  import { InternalMasterAuthService } from './services/masterAuth.js';
10
11
  import { InternalBrandingService } from './services/branding.js';
11
12
  import { InternalPhoneNumbersService } from './services/phoneNumbers.js';
13
+ import { InternalVideoService } from './services/video.js';
14
+ import { InternalVoicemailService } from './services/voicemail.js';
15
+ import { InternalVoiceService } from './services/voice.js';
12
16
  import { buildObjectEventV2 } from './utils/buildObjectEventV2.js';
13
17
 
14
18
  export class InternalSDK {
@@ -25,6 +29,9 @@ export class InternalSDK {
25
29
  this.masterAuth = new InternalMasterAuthService(sdk);
26
30
  this.branding = new InternalBrandingService(sdk);
27
31
  this.phoneNumbers = new InternalPhoneNumbersService(sdk);
32
+ this.video = new InternalVideoService(sdk);
33
+ this.voicemail = new InternalVoicemailService(sdk);
34
+ this.voice = new InternalVoiceService(sdk);
28
35
 
29
36
  // Proxy all base SDK properties and methods
30
37
  this._proxyBaseSDK();
@@ -98,6 +105,51 @@ export class InternalSDK {
98
105
  }
99
106
  return this.sdk.token;
100
107
  }
108
+
109
+ /**
110
+ * Governed escape hatch for internal routes reached by path-as-data
111
+ * mechanisms (e.g. a voice-app webhook command that carries its target
112
+ * `url` at runtime), where a typed per-route method isn't possible
113
+ * because the caller doesn't know the route ahead of time. This is the
114
+ * ONLY sanctioned way to hit an internal route this way — if you know
115
+ * the route at write time, add (or use) a typed method on the matching
116
+ * service instead of calling this directly.
117
+ *
118
+ * @param {string} path - Must start with '/internal/'.
119
+ * @param {object} body
120
+ * @param {object} [options]
121
+ * @param {number} [options.timeoutMs]
122
+ */
123
+ async post(path, body, { timeoutMs } = {}) {
124
+ if (typeof path !== 'string' || !path.startsWith('/internal/')) {
125
+ throw new Error(
126
+ `InternalSDK.post: path must be a string starting with '/internal/', got: ${path}`,
127
+ );
128
+ }
129
+
130
+ const params = { body };
131
+ if (timeoutMs) params.timeoutMs = timeoutMs;
132
+
133
+ const result = await internalRequest(this.sdk, path, 'POST', params);
134
+ return result;
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
+ }
101
153
  }
102
154
 
103
155
  // Extension pattern for the main SDK
@@ -127,4 +179,7 @@ export { InternalSocketService } from './services/socket.js';
127
179
  export { InternalMasterAuthService } from './services/masterAuth.js';
128
180
  export { InternalBrandingService } from './services/branding.js';
129
181
  export { InternalPhoneNumbersService } from './services/phoneNumbers.js';
182
+ export { InternalVideoService } from './services/video.js';
183
+ export { InternalVoicemailService } from './services/voicemail.js';
184
+ export { InternalVoiceService } from './services/voice.js';
130
185
  export { buildObjectEventV2 } from './utils/buildObjectEventV2.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboundcx/sdk-internal",
3
- "version": "2.2.0",
3
+ "version": "2.3.1",
4
4
  "description": "Internal SDK extension for Unbound - Provides access to internal APIs and administrative functions",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -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._fetch(
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._fetch(
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._fetch(
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._fetch(
56
+ const result = await internalRequest(this.sdk,
56
57
  `/internal/email/unsubscribe/${emailId}`,
57
58
  'POST',
58
59
  params,
@@ -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._fetch(
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._fetch(
62
+ const result = await internalRequest(this.sdk,
62
63
  '/internal/masterAuth/internal-token',
63
64
  'POST',
64
65
  { body },
@@ -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._fetch(
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._fetch(
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._fetch(
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._fetch(
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._fetch(
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._fetch(
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._fetch(
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._fetch(
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._fetch(
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._fetch(
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._fetch(
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._fetch(
421
+ const result = await internalRequest(this.sdk,
421
422
  `/internal/programmableVoice/transcription/${id}`,
422
423
  'POST',
423
424
  params,
@@ -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._fetch('/internal/servers/', 'POST', params);
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._fetch(
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._fetch(`/internal/servers/${id}`, 'DELETE');
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._fetch(
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._fetch(
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._fetch(
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._fetch(
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._fetch(`/internal/sip/log`, 'POST', options);
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._fetch(
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._fetch(
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._fetch(
236
+ const result = await internalRequest(this.sdk,
236
237
  `/internal/sip/register/validate`,
237
238
  'POST',
238
239
  options,
@@ -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._fetch(
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._fetch(
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._fetch(
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._fetch(
112
+ const result = await internalRequest(this.sdk,
112
113
  '/internal/socket/connection/byServerId',
113
114
  'DELETE',
114
115
  params,
@@ -0,0 +1,130 @@
1
+ import { internalRequest } from '../utils/sdkRequest.js';
2
+ export class InternalVideoService {
3
+ constructor(sdk) {
4
+ this.sdk = sdk;
5
+ }
6
+
7
+ /**
8
+ * Meet PSTN bridge join (D2/D3/D10). Called by media-manager's `webhook`
9
+ * v2 command from the meetDialIn app once the caller has DTMF'd a
10
+ * meetingId + PIN. Matches
11
+ * app1-api/src/services/INTERNAL/video/controllers/meetJoin.js.
12
+ *
13
+ * POST /internal/video/meetJoin
14
+ * Body: { callId, from, variables: { meetingId, meetingPin, attempt? } }
15
+ */
16
+ async meetJoin({ callId, from, variables }) {
17
+ this.sdk.validateParams(
18
+ { callId },
19
+ {
20
+ callId: { type: 'string', required: true },
21
+ from: { type: 'string', required: false },
22
+ variables: { type: 'object', required: false },
23
+ },
24
+ );
25
+
26
+ const body = { callId };
27
+ if (from) body.from = from;
28
+ if (variables) body.variables = variables;
29
+
30
+ const params = {
31
+ body,
32
+ };
33
+
34
+ const result = await internalRequest(this.sdk,
35
+ '/internal/video/meetJoin',
36
+ 'POST',
37
+ params,
38
+ );
39
+ return result;
40
+ }
41
+
42
+ /**
43
+ * Meet PSTN bridge D9 (phone-hangs-up teardown). POST when a callId ==
44
+ * sipCallId leg observed on an active Meet participant ends. Matches
45
+ * app1-api/src/services/INTERNAL/video/controllers/meetCallEnded.js.
46
+ *
47
+ * POST /internal/video/meetCallEnded
48
+ * Body: { sipCallId, accountId }
49
+ */
50
+ async meetCallEnded({ sipCallId, accountId }) {
51
+ this.sdk.validateParams(
52
+ { sipCallId, accountId },
53
+ {
54
+ sipCallId: { type: 'string', required: true },
55
+ accountId: { type: 'string', required: true },
56
+ },
57
+ );
58
+
59
+ const params = {
60
+ body: { sipCallId, accountId },
61
+ };
62
+
63
+ const result = await internalRequest(this.sdk,
64
+ '/internal/video/meetCallEnded',
65
+ 'POST',
66
+ params,
67
+ );
68
+ return result;
69
+ }
70
+
71
+ /**
72
+ * Meet PSTN bridge dial-out status callback. media-manager's
73
+ * DialEventHandler posts here (fire-and-forget) for pre-answer progress
74
+ * ('trying' | 'ringing' | 'answered') and terminal 'failed' outcomes on a
75
+ * standalone-outbound leg placed via placeOutboundCall's statusWebhook.
76
+ * Matches
77
+ * app1-api/src/services/INTERNAL/video/controllers/meetOutboundStatus.js.
78
+ *
79
+ * The api controller is intentionally tolerant of unknown/extra fields
80
+ * (it only requires participantId, roomId, event), so this method passes
81
+ * the payload through as-is rather than enumerating every static field —
82
+ * add a typed field here if a fixed shape solidifies.
83
+ *
84
+ * POST /internal/video/meetOutboundStatus
85
+ * Body: { event, callId, requestId, participantId, roomId, reason? }
86
+ */
87
+ async meetOutboundStatus(payload) {
88
+ this.sdk.validateParams(
89
+ { payload },
90
+ {
91
+ payload: { type: 'object', required: true },
92
+ },
93
+ );
94
+ const { event, participantId, roomId } = payload || {};
95
+ if (!event || !participantId || !roomId) {
96
+ throw new Error(
97
+ 'meetOutboundStatus requires event, participantId, and roomId.',
98
+ );
99
+ }
100
+
101
+ const params = {
102
+ body: payload,
103
+ };
104
+
105
+ const result = await internalRequest(this.sdk,
106
+ '/internal/video/meetOutboundStatus',
107
+ 'POST',
108
+ params,
109
+ );
110
+ return result;
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
+ }
130
+ }
@@ -0,0 +1,40 @@
1
+ import { internalRequest } from '../utils/sdkRequest.js';
2
+ export class InternalVoiceService {
3
+ constructor(sdk) {
4
+ this.sdk = sdk;
5
+ }
6
+
7
+ /**
8
+ * Bulk write endpoint for the CDR discrete-event timeline (WP6.5).
9
+ * Emitters (sip-processor / media-manager / task-router) call this to
10
+ * report events; fire-and-forget semantics are the CALLER's job, not
11
+ * this method's. Matches
12
+ * app1-api/src/services/INTERNAL/voice/controllers/createCdrEvents.js.
13
+ *
14
+ * POST /internal/voice/cdrEvents
15
+ * Body: {
16
+ * accountId,
17
+ * events: [{ cdrId, sipCallId?, eventType, ts, actorType, actorId?, data? }]
18
+ * } -- max 50 events per request (enforced by the api).
19
+ */
20
+ async createCdrEvents({ accountId, events }) {
21
+ this.sdk.validateParams(
22
+ { accountId, events },
23
+ {
24
+ accountId: { type: 'string', required: true },
25
+ events: { type: 'array', required: true },
26
+ },
27
+ );
28
+
29
+ const params = {
30
+ body: { accountId, events },
31
+ };
32
+
33
+ const result = await internalRequest(this.sdk,
34
+ '/internal/voice/cdrEvents',
35
+ 'POST',
36
+ params,
37
+ );
38
+ return result;
39
+ }
40
+ }
@@ -0,0 +1,48 @@
1
+ import { internalRequest } from '../utils/sdkRequest.js';
2
+ export class InternalVoicemailService {
3
+ constructor(sdk) {
4
+ this.sdk = sdk;
5
+ }
6
+
7
+ /**
8
+ * app1-transcription reports the result of a batch voicemail
9
+ * transcription here after POST /transcription/voicemail finishes
10
+ * (success or failure). Matches
11
+ * app1-api/src/services/INTERNAL/voicemail/controllers/transcriptionComplete.js.
12
+ *
13
+ * POST /internal/voicemail/transcription
14
+ * Body: { accountId, voicemailMessageId, transcription, transcriptionStatus }
15
+ */
16
+ async transcriptionComplete({
17
+ accountId,
18
+ voicemailMessageId,
19
+ transcription,
20
+ transcriptionStatus,
21
+ }) {
22
+ this.sdk.validateParams(
23
+ { accountId, voicemailMessageId, transcriptionStatus },
24
+ {
25
+ accountId: { type: 'string', required: true },
26
+ voicemailMessageId: { type: 'string', required: true },
27
+ transcription: { type: 'string', required: false },
28
+ transcriptionStatus: { type: 'string', required: true },
29
+ },
30
+ );
31
+
32
+ const params = {
33
+ body: {
34
+ accountId,
35
+ voicemailMessageId,
36
+ transcription,
37
+ transcriptionStatus,
38
+ },
39
+ };
40
+
41
+ const result = await internalRequest(this.sdk,
42
+ '/internal/voicemail/transcription',
43
+ 'POST',
44
+ params,
45
+ );
46
+ return result;
47
+ }
48
+ }
@@ -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
+ }