@unboundcx/sdk-internal 2.3.1 → 2.3.3
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 +3 -0
- package/package.json +1 -1
- package/services/taskRouter.js +38 -0
package/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import { InternalPhoneNumbersService } from './services/phoneNumbers.js';
|
|
|
13
13
|
import { InternalVideoService } from './services/video.js';
|
|
14
14
|
import { InternalVoicemailService } from './services/voicemail.js';
|
|
15
15
|
import { InternalVoiceService } from './services/voice.js';
|
|
16
|
+
import { InternalTaskRouterService } from './services/taskRouter.js';
|
|
16
17
|
import { buildObjectEventV2 } from './utils/buildObjectEventV2.js';
|
|
17
18
|
|
|
18
19
|
export class InternalSDK {
|
|
@@ -32,6 +33,7 @@ export class InternalSDK {
|
|
|
32
33
|
this.video = new InternalVideoService(sdk);
|
|
33
34
|
this.voicemail = new InternalVoicemailService(sdk);
|
|
34
35
|
this.voice = new InternalVoiceService(sdk);
|
|
36
|
+
this.taskRouter = new InternalTaskRouterService(sdk);
|
|
35
37
|
|
|
36
38
|
// Proxy all base SDK properties and methods
|
|
37
39
|
this._proxyBaseSDK();
|
|
@@ -182,4 +184,5 @@ export { InternalPhoneNumbersService } from './services/phoneNumbers.js';
|
|
|
182
184
|
export { InternalVideoService } from './services/video.js';
|
|
183
185
|
export { InternalVoicemailService } from './services/voicemail.js';
|
|
184
186
|
export { InternalVoiceService } from './services/voice.js';
|
|
187
|
+
export { InternalTaskRouterService } from './services/taskRouter.js';
|
|
185
188
|
export { buildObjectEventV2 } from './utils/buildObjectEventV2.js';
|
package/package.json
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { internalRequest } from '../utils/sdkRequest.js';
|
|
2
|
+
export class InternalTaskRouterService {
|
|
3
|
+
constructor(sdk) {
|
|
4
|
+
this.sdk = sdk;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Report that a task-linked call's caller hung up before the task ever
|
|
9
|
+
* reached 'connected' (still 'pending' in queue, or 'assigned' and
|
|
10
|
+
* ringing a worker who hasn't answered). No-ops server-side if the task
|
|
11
|
+
* already progressed past pending/assigned — safe to call unconditionally
|
|
12
|
+
* on every hangup of a task-linked call. Matches
|
|
13
|
+
* app1-api/src/services/INTERNAL/taskRouter/controllers/abandonTask.js.
|
|
14
|
+
*
|
|
15
|
+
* POST /internal/taskRouter/abandon
|
|
16
|
+
* Body: { taskId, accountId, reason? }
|
|
17
|
+
*/
|
|
18
|
+
async abandon({ taskId, accountId, reason }) {
|
|
19
|
+
this.sdk.validateParams(
|
|
20
|
+
{ taskId, accountId },
|
|
21
|
+
{
|
|
22
|
+
taskId: { type: 'string', required: true },
|
|
23
|
+
accountId: { type: 'string', required: true },
|
|
24
|
+
},
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const body = { taskId, accountId };
|
|
28
|
+
if (reason) body.reason = reason;
|
|
29
|
+
|
|
30
|
+
const result = await internalRequest(
|
|
31
|
+
this.sdk,
|
|
32
|
+
'/internal/taskRouter/abandon',
|
|
33
|
+
'POST',
|
|
34
|
+
{ body },
|
|
35
|
+
);
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
}
|