@sentdm/sentdm 0.45.0 → 0.47.0
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/CHANGELOG.md +19 -0
- package/client.d.mts +6 -11
- package/client.d.mts.map +1 -1
- package/client.d.ts +6 -11
- package/client.d.ts.map +1 -1
- package/client.js +3 -10
- package/client.js.map +1 -1
- package/client.mjs +3 -10
- package/client.mjs.map +1 -1
- package/core/pagination.d.mts +25 -0
- package/core/pagination.d.mts.map +1 -1
- package/core/pagination.d.ts +25 -0
- package/core/pagination.d.ts.map +1 -1
- package/core/pagination.js +28 -1
- package/core/pagination.js.map +1 -1
- package/core/pagination.mjs +26 -0
- package/core/pagination.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/channels/channels.d.mts +2 -2
- package/resources/channels/channels.d.mts.map +1 -1
- package/resources/channels/channels.d.ts +2 -2
- package/resources/channels/channels.d.ts.map +1 -1
- package/resources/channels/channels.js.map +1 -1
- package/resources/channels/channels.mjs.map +1 -1
- package/resources/channels/index.d.mts +1 -1
- package/resources/channels/index.d.mts.map +1 -1
- package/resources/channels/index.d.ts +1 -1
- package/resources/channels/index.d.ts.map +1 -1
- package/resources/channels/index.js.map +1 -1
- package/resources/channels/index.mjs.map +1 -1
- package/resources/channels/voice.d.mts +72 -115
- package/resources/channels/voice.d.mts.map +1 -1
- package/resources/channels/voice.d.ts +72 -115
- package/resources/channels/voice.d.ts.map +1 -1
- package/resources/channels/voice.js +35 -45
- package/resources/channels/voice.js.map +1 -1
- package/resources/channels/voice.mjs +35 -45
- package/resources/channels/voice.mjs.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -3
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/messages.d.mts +8 -1
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +8 -1
- package/resources/messages.d.ts.map +1 -1
- package/resources/profiles/campaigns.d.mts +3 -2
- package/resources/profiles/campaigns.d.mts.map +1 -1
- package/resources/profiles/campaigns.d.ts +3 -2
- package/resources/profiles/campaigns.d.ts.map +1 -1
- package/resources/profiles/campaigns.js +3 -2
- package/resources/profiles/campaigns.js.map +1 -1
- package/resources/profiles/campaigns.mjs +3 -2
- package/resources/profiles/campaigns.mjs.map +1 -1
- package/resources/templates.d.mts +14 -13
- package/resources/templates.d.mts.map +1 -1
- package/resources/templates.d.ts +14 -13
- package/resources/templates.d.ts.map +1 -1
- package/resources/voice/agents.d.mts +524 -0
- package/resources/voice/agents.d.mts.map +1 -0
- package/resources/voice/agents.d.ts +524 -0
- package/resources/voice/agents.d.ts.map +1 -0
- package/resources/voice/agents.js +193 -0
- package/resources/voice/agents.js.map +1 -0
- package/resources/voice/agents.mjs +189 -0
- package/resources/voice/agents.mjs.map +1 -0
- package/resources/{calls → voice/calls}/calls.d.mts +103 -26
- package/resources/voice/calls/calls.d.mts.map +1 -0
- package/resources/{calls → voice/calls}/calls.d.ts +103 -26
- package/resources/voice/calls/calls.d.ts.map +1 -0
- package/resources/{calls → voice/calls}/calls.js +35 -28
- package/resources/voice/calls/calls.js.map +1 -0
- package/resources/{calls → voice/calls}/calls.mjs +34 -27
- package/resources/voice/calls/calls.mjs.map +1 -0
- package/resources/voice/calls/index.d.mts.map +1 -0
- package/resources/voice/calls/index.d.ts.map +1 -0
- package/resources/voice/calls/index.js.map +1 -0
- package/resources/voice/calls/index.mjs.map +1 -0
- package/resources/{calls → voice/calls}/participants.d.mts +16 -14
- package/resources/voice/calls/participants.d.mts.map +1 -0
- package/resources/{calls → voice/calls}/participants.d.ts +16 -14
- package/resources/voice/calls/participants.d.ts.map +1 -0
- package/resources/{calls → voice/calls}/participants.js +19 -17
- package/resources/voice/calls/participants.js.map +1 -0
- package/resources/{calls → voice/calls}/participants.mjs +19 -17
- package/resources/voice/calls/participants.mjs.map +1 -0
- package/resources/voice/calls.d.mts.map +1 -0
- package/resources/voice/calls.d.ts.map +1 -0
- package/resources/{calls.js → voice/calls.js} +1 -1
- package/resources/voice/calls.js.map +1 -0
- package/resources/voice/calls.mjs.map +1 -0
- package/resources/voice/catalogue.d.mts +86 -0
- package/resources/voice/catalogue.d.mts.map +1 -0
- package/resources/voice/catalogue.d.ts +86 -0
- package/resources/voice/catalogue.d.ts.map +1 -0
- package/resources/voice/catalogue.js +40 -0
- package/resources/voice/catalogue.js.map +1 -0
- package/resources/voice/catalogue.mjs +36 -0
- package/resources/voice/catalogue.mjs.map +1 -0
- package/resources/voice/index.d.mts +6 -0
- package/resources/voice/index.d.mts.map +1 -0
- package/resources/voice/index.d.ts +6 -0
- package/resources/voice/index.d.ts.map +1 -0
- package/resources/voice/index.js +15 -0
- package/resources/voice/index.js.map +1 -0
- package/resources/voice/index.mjs +7 -0
- package/resources/voice/index.mjs.map +1 -0
- package/resources/voice/tokens.d.mts +111 -0
- package/resources/voice/tokens.d.mts.map +1 -0
- package/resources/voice/tokens.d.ts +111 -0
- package/resources/voice/tokens.d.ts.map +1 -0
- package/resources/voice/tokens.js +47 -0
- package/resources/voice/tokens.js.map +1 -0
- package/resources/voice/tokens.mjs +43 -0
- package/resources/voice/tokens.mjs.map +1 -0
- package/resources/voice/voice.d.mts +22 -0
- package/resources/voice/voice.d.mts.map +1 -0
- package/resources/voice/voice.d.ts +22 -0
- package/resources/voice/voice.d.ts.map +1 -0
- package/resources/voice/voice.js +29 -0
- package/resources/voice/voice.js.map +1 -0
- package/resources/voice/voice.mjs +24 -0
- package/resources/voice/voice.mjs.map +1 -0
- package/resources/voice.d.mts +2 -0
- package/resources/voice.d.mts.map +1 -0
- package/resources/voice.d.ts +2 -0
- package/resources/voice.d.ts.map +1 -0
- package/resources/voice.js +6 -0
- package/resources/voice.js.map +1 -0
- package/resources/voice.mjs +3 -0
- package/resources/voice.mjs.map +1 -0
- package/resources/webhooks.d.mts +154 -31
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +154 -31
- package/resources/webhooks.d.ts.map +1 -1
- package/resources/webhooks.js +51 -11
- package/resources/webhooks.js.map +1 -1
- package/resources/webhooks.mjs +51 -11
- package/resources/webhooks.mjs.map +1 -1
- package/src/client.ts +12 -45
- package/src/core/pagination.ts +64 -0
- package/src/resources/channels/channels.ts +0 -6
- package/src/resources/channels/index.ts +0 -3
- package/src/resources/channels/voice.ts +74 -144
- package/src/resources/index.ts +1 -18
- package/src/resources/messages.ts +8 -1
- package/src/resources/profiles/campaigns.ts +3 -2
- package/src/resources/templates.ts +14 -13
- package/src/resources/voice/agents.ts +729 -0
- package/src/resources/{calls → voice/calls}/calls.ts +122 -33
- package/src/resources/{calls → voice/calls}/participants.ts +23 -21
- package/src/resources/voice/catalogue.ts +118 -0
- package/src/resources/voice/index.ts +55 -0
- package/src/resources/voice/tokens.ts +146 -0
- package/src/resources/voice/voice.ts +134 -0
- package/src/resources/voice.ts +3 -0
- package/src/resources/webhooks.ts +162 -31
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/resources/calls/calls.d.mts.map +0 -1
- package/resources/calls/calls.d.ts.map +0 -1
- package/resources/calls/calls.js.map +0 -1
- package/resources/calls/calls.mjs.map +0 -1
- package/resources/calls/index.d.mts.map +0 -1
- package/resources/calls/index.d.ts.map +0 -1
- package/resources/calls/index.js.map +0 -1
- package/resources/calls/index.mjs.map +0 -1
- package/resources/calls/participants.d.mts.map +0 -1
- package/resources/calls/participants.d.ts.map +0 -1
- package/resources/calls/participants.js.map +0 -1
- package/resources/calls/participants.mjs.map +0 -1
- package/resources/calls.d.mts.map +0 -1
- package/resources/calls.d.ts.map +0 -1
- package/resources/calls.js.map +0 -1
- package/resources/calls.mjs.map +0 -1
- /package/resources/{calls → voice/calls}/index.d.mts +0 -0
- /package/resources/{calls → voice/calls}/index.d.ts +0 -0
- /package/resources/{calls → voice/calls}/index.js +0 -0
- /package/resources/{calls → voice/calls}/index.mjs +0 -0
- /package/resources/{calls.d.mts → voice/calls.d.mts} +0 -0
- /package/resources/{calls.d.ts → voice/calls.d.ts} +0 -0
- /package/resources/{calls.mjs → voice/calls.mjs} +0 -0
- /package/src/resources/{calls → voice/calls}/index.ts +0 -0
- /package/src/resources/{calls.ts → voice/calls.ts} +0 -0
package/resources/webhooks.mjs
CHANGED
|
@@ -12,11 +12,29 @@ import { path } from "../internal/utils/path.mjs";
|
|
|
12
12
|
*/
|
|
13
13
|
export class Webhooks extends APIResource {
|
|
14
14
|
/**
|
|
15
|
-
* Creates a new webhook endpoint for the authenticated customer.
|
|
15
|
+
* Creates a new webhook endpoint for the authenticated customer. A webhook is
|
|
16
|
+
* version 2 unless the request sets webhook_version to 1: Svix delivers it, signed
|
|
17
|
+
* with the webhook-id, webhook-timestamp and webhook-signature headers, and
|
|
18
|
+
* retries it on its own schedule, so retry_count and timeout_seconds apply to
|
|
19
|
+
* version 1 only. sender_profile applies to version 1 only and is ignored on
|
|
20
|
+
* version 2; is_inheritable applies to version 2 only. A version 1 webhook's
|
|
21
|
+
* response returns its sender_profile selection, with an empty event_types when it
|
|
22
|
+
* is not cloned onto sender profiles; a version 2 webhook's response leaves
|
|
23
|
+
* sender_profile out.
|
|
16
24
|
*
|
|
17
25
|
* @example
|
|
18
26
|
* ```ts
|
|
19
|
-
* const apiResponseWebhook = await client.webhooks.create(
|
|
27
|
+
* const apiResponseWebhook = await client.webhooks.create({
|
|
28
|
+
* display_name: 'Order Notifications',
|
|
29
|
+
* endpoint_url: 'https://example.com/webhooks/orders',
|
|
30
|
+
* event_filters: {
|
|
31
|
+
* message: ['delivered', 'failed'],
|
|
32
|
+
* templates: ['approved', 'rejected'],
|
|
33
|
+
* },
|
|
34
|
+
* event_types: ['contact', 'message', 'templates'],
|
|
35
|
+
* retry_count: 3,
|
|
36
|
+
* timeout_seconds: 30,
|
|
37
|
+
* });
|
|
20
38
|
* ```
|
|
21
39
|
*/
|
|
22
40
|
create(params, options) {
|
|
@@ -34,7 +52,8 @@ export class Webhooks extends APIResource {
|
|
|
34
52
|
});
|
|
35
53
|
}
|
|
36
54
|
/**
|
|
37
|
-
* Retrieves a single webhook by ID for the authenticated customer.
|
|
55
|
+
* Retrieves a single webhook by ID for the authenticated customer. A version 1
|
|
56
|
+
* webhook includes its sender_profile selection.
|
|
38
57
|
*
|
|
39
58
|
* @example
|
|
40
59
|
* ```ts
|
|
@@ -54,12 +73,24 @@ export class Webhooks extends APIResource {
|
|
|
54
73
|
});
|
|
55
74
|
}
|
|
56
75
|
/**
|
|
57
|
-
* Updates an existing webhook for the authenticated customer.
|
|
76
|
+
* Updates an existing webhook for the authenticated customer. Its version does not
|
|
77
|
+
* change. sender_profile applies to a version 1 webhook and is_inheritable to a
|
|
78
|
+
* version 2 one; retry_count and timeout_seconds apply to version 1 only. A
|
|
79
|
+
* version 1 webhook's response returns its sender_profile selection as saved; a
|
|
80
|
+
* version 2 webhook's response leaves sender_profile out.
|
|
58
81
|
*
|
|
59
82
|
* @example
|
|
60
83
|
* ```ts
|
|
61
84
|
* const apiResponseWebhook = await client.webhooks.update(
|
|
62
85
|
* 'd4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8',
|
|
86
|
+
* {
|
|
87
|
+
* display_name: 'Updated Order Notifications',
|
|
88
|
+
* endpoint_url: 'https://example.com/webhooks/orders-v2',
|
|
89
|
+
* event_filters: { message: ['delivered', 'failed'] },
|
|
90
|
+
* event_types: ['contact', 'message', 'templates'],
|
|
91
|
+
* retry_count: 5,
|
|
92
|
+
* timeout_seconds: 60,
|
|
93
|
+
* },
|
|
63
94
|
* );
|
|
64
95
|
* ```
|
|
65
96
|
*/
|
|
@@ -78,7 +109,8 @@ export class Webhooks extends APIResource {
|
|
|
78
109
|
});
|
|
79
110
|
}
|
|
80
111
|
/**
|
|
81
|
-
* Retrieves a paginated list of webhooks for the authenticated customer.
|
|
112
|
+
* Retrieves a paginated list of webhooks for the authenticated customer. Each
|
|
113
|
+
* version 1 webhook includes its sender_profile selection.
|
|
82
114
|
*
|
|
83
115
|
* @example
|
|
84
116
|
* ```ts
|
|
@@ -138,9 +170,11 @@ export class Webhooks extends APIResource {
|
|
|
138
170
|
});
|
|
139
171
|
}
|
|
140
172
|
/**
|
|
141
|
-
* Retrieves a paginated list of delivery events for the specified webhook
|
|
142
|
-
* webhook is cloned onto your sender profiles
|
|
143
|
-
*
|
|
173
|
+
* Retrieves a paginated list of delivery events for the specified webhook, newest
|
|
174
|
+
* first. If the webhook is cloned onto your sender profiles (version 1) or
|
|
175
|
+
* inheritable by them (version 2, is_inheritable), the list includes their events;
|
|
176
|
+
* read payload.account_id to tell whose event it is. A sender profile may read its
|
|
177
|
+
* organization's inheritable webhook too, and gets the events about itself.
|
|
144
178
|
*
|
|
145
179
|
* @example
|
|
146
180
|
* ```ts
|
|
@@ -164,8 +198,11 @@ export class Webhooks extends APIResource {
|
|
|
164
198
|
});
|
|
165
199
|
}
|
|
166
200
|
/**
|
|
167
|
-
* Generates a new signing secret for the specified webhook.
|
|
168
|
-
*
|
|
201
|
+
* Generates a new signing secret for the specified webhook. A version 1 webhook's
|
|
202
|
+
* old secret stops verifying at once. A version 2 webhook's deliveries are signed
|
|
203
|
+
* with the new secret at once, and with the old one as well for the next 24 hours,
|
|
204
|
+
* so a receiver can switch over without rejecting any; after that the old secret
|
|
205
|
+
* no longer verifies.
|
|
169
206
|
*
|
|
170
207
|
* @example
|
|
171
208
|
* ```ts
|
|
@@ -189,7 +226,10 @@ export class Webhooks extends APIResource {
|
|
|
189
226
|
});
|
|
190
227
|
}
|
|
191
228
|
/**
|
|
192
|
-
* Sends a test event to the specified webhook endpoint to verify connectivity.
|
|
229
|
+
* Sends a test event to the specified webhook endpoint to verify connectivity. A
|
|
230
|
+
* version 1 webhook is tested at once and the answer says whether it was
|
|
231
|
+
* delivered; a version 2 webhook's test is queued with Svix, which delivers it
|
|
232
|
+
* right after, and the answer says it was queued.
|
|
193
233
|
*
|
|
194
234
|
* @example
|
|
195
235
|
* ```ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.mjs","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAG/C,OAAO,EAEL,iBAAiB,EAEjB,YAAY,GAEb,+BAA2B;AAC5B,OAAO,EAAE,YAAY,EAAE,gCAA4B;AAEnD,OAAO,EAAE,IAAI,EAAE,mCAA+B;AAE9C;;;;;;GAMG;AACH,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC
|
|
1
|
+
{"version":3,"file":"webhooks.mjs","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAG/C,OAAO,EAEL,iBAAiB,EAEjB,YAAY,GAEb,+BAA2B;AAC5B,OAAO,EAAE,YAAY,EAAE,gCAA4B;AAEnD,OAAO,EAAE,IAAI,EAAE,mCAA+B;AAE9C;;;;;;GAMG;AACH,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,MAAM,CAAC,MAA2B,EAAE,OAAwB;QAC1D,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC1F,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE;YACvC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC;gBACpB;oBACE,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;oBAC/E,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,EAA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AS,CAAC;oBAC/E,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;iBACrE;gBACD,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/src/client.ts
CHANGED
|
@@ -25,6 +25,8 @@ import {
|
|
|
25
25
|
ConversationsPageResponse,
|
|
26
26
|
type TemplatesPageParams,
|
|
27
27
|
TemplatesPageResponse,
|
|
28
|
+
type VoiceAgentsPageParams,
|
|
29
|
+
VoiceAgentsPageResponse,
|
|
28
30
|
type WebhookEventsPageParams,
|
|
29
31
|
WebhookEventsPageResponse,
|
|
30
32
|
type WebhooksPageParams,
|
|
@@ -135,24 +137,6 @@ import {
|
|
|
135
137
|
WebhookUpdateParams,
|
|
136
138
|
Webhooks,
|
|
137
139
|
} from './resources/webhooks';
|
|
138
|
-
import {
|
|
139
|
-
APIResponseOfCall,
|
|
140
|
-
APIResponseOfCallRecordings,
|
|
141
|
-
APIResponseOfCallsList,
|
|
142
|
-
Call,
|
|
143
|
-
CallHangupParams,
|
|
144
|
-
CallListParams,
|
|
145
|
-
CallListRecordingsParams,
|
|
146
|
-
CallParty,
|
|
147
|
-
CallRecordParams,
|
|
148
|
-
CallRecording,
|
|
149
|
-
CallRecordings,
|
|
150
|
-
CallRetrieveParams,
|
|
151
|
-
CallTimelineEntry,
|
|
152
|
-
Calls,
|
|
153
|
-
CallsCallsPage,
|
|
154
|
-
CallsList,
|
|
155
|
-
} from './resources/calls/calls';
|
|
156
140
|
import { Channels } from './resources/channels/channels';
|
|
157
141
|
import {
|
|
158
142
|
APIResponseOfProfileDetail,
|
|
@@ -176,6 +160,7 @@ import {
|
|
|
176
160
|
TcrBrandRelationship,
|
|
177
161
|
TcrVertical,
|
|
178
162
|
} from './resources/profiles/profiles';
|
|
163
|
+
import { Voice } from './resources/voice/voice';
|
|
179
164
|
import { type Fetch } from './internal/builtin-types';
|
|
180
165
|
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
|
|
181
166
|
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
|
|
@@ -982,14 +967,7 @@ export class Sent {
|
|
|
982
967
|
* Read-only. Sending is **Messages**; a reply arrives here and through your webhooks.
|
|
983
968
|
*/
|
|
984
969
|
conversations: API.Conversations = new API.Conversations(this);
|
|
985
|
-
|
|
986
|
-
* Phone calls from the numbers you hold, driven by your own callback URL.
|
|
987
|
-
*
|
|
988
|
-
* `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to do with each call on it, and `POST /v3/channels/voice/tokens` mints a short-lived token that lets a user of your app place and receive calls as that number. When a call arrives or a caller presses a key, a signed question is POSTed to the callback URL and the answer decides the call; `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need before a real call reaches it, and `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret. The call events themselves (`call.completed` and the rest) arrive through your webhooks.
|
|
989
|
-
*
|
|
990
|
-
* Every call is a record under `/v3/calls`: read it, list its recordings once one is ready, hang it up, start or stop recording, and add, mute or remove conference participants while it is live. A leg to a phone number runs for at most what your balance affords at the destination's rate.
|
|
991
|
-
*/
|
|
992
|
-
calls: API.Calls = new API.Calls(this);
|
|
970
|
+
voice: API.Voice = new API.Voice(this);
|
|
993
971
|
channels: API.Channels = new API.Channels(this);
|
|
994
972
|
/**
|
|
995
973
|
* Who the current key is.
|
|
@@ -1007,7 +985,7 @@ Sent.Numbers = Numbers;
|
|
|
1007
985
|
Sent.Messages = Messages;
|
|
1008
986
|
Sent.Contacts = Contacts;
|
|
1009
987
|
Sent.Conversations = Conversations;
|
|
1010
|
-
Sent.
|
|
988
|
+
Sent.Voice = Voice;
|
|
1011
989
|
Sent.Channels = Channels;
|
|
1012
990
|
Sent.Me = Me;
|
|
1013
991
|
|
|
@@ -1041,6 +1019,12 @@ export declare namespace Sent {
|
|
|
1041
1019
|
export import CallsPage = Pagination.CallsPage;
|
|
1042
1020
|
export { type CallsPageParams as CallsPageParams, type CallsPageResponse as CallsPageResponse };
|
|
1043
1021
|
|
|
1022
|
+
export import VoiceAgentsPage = Pagination.VoiceAgentsPage;
|
|
1023
|
+
export {
|
|
1024
|
+
type VoiceAgentsPageParams as VoiceAgentsPageParams,
|
|
1025
|
+
type VoiceAgentsPageResponse as VoiceAgentsPageResponse,
|
|
1026
|
+
};
|
|
1027
|
+
|
|
1044
1028
|
export {
|
|
1045
1029
|
Webhooks as Webhooks,
|
|
1046
1030
|
type APIMeta as APIMeta,
|
|
@@ -1176,24 +1160,7 @@ export declare namespace Sent {
|
|
|
1176
1160
|
type ConversationListMessagesParams as ConversationListMessagesParams,
|
|
1177
1161
|
};
|
|
1178
1162
|
|
|
1179
|
-
export {
|
|
1180
|
-
Calls as Calls,
|
|
1181
|
-
type APIResponseOfCall as APIResponseOfCall,
|
|
1182
|
-
type APIResponseOfCallRecordings as APIResponseOfCallRecordings,
|
|
1183
|
-
type APIResponseOfCallsList as APIResponseOfCallsList,
|
|
1184
|
-
type Call as Call,
|
|
1185
|
-
type CallParty as CallParty,
|
|
1186
|
-
type CallRecording as CallRecording,
|
|
1187
|
-
type CallRecordings as CallRecordings,
|
|
1188
|
-
type CallTimelineEntry as CallTimelineEntry,
|
|
1189
|
-
type CallsList as CallsList,
|
|
1190
|
-
type CallsCallsPage as CallsCallsPage,
|
|
1191
|
-
type CallRetrieveParams as CallRetrieveParams,
|
|
1192
|
-
type CallListParams as CallListParams,
|
|
1193
|
-
type CallHangupParams as CallHangupParams,
|
|
1194
|
-
type CallListRecordingsParams as CallListRecordingsParams,
|
|
1195
|
-
type CallRecordParams as CallRecordParams,
|
|
1196
|
-
};
|
|
1163
|
+
export { Voice as Voice };
|
|
1197
1164
|
|
|
1198
1165
|
export { Channels as Channels };
|
|
1199
1166
|
|
package/src/core/pagination.ts
CHANGED
|
@@ -485,3 +485,67 @@ export class CallsPage<Item> extends AbstractPage<Item> implements CallsPageResp
|
|
|
485
485
|
};
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
|
+
|
|
489
|
+
export interface VoiceAgentsPageResponse<Item> {
|
|
490
|
+
data: VoiceAgentsPageResponse.Data<Item>;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
export namespace VoiceAgentsPageResponse {
|
|
494
|
+
export interface Data<Item> {
|
|
495
|
+
agents?: Array<Item>;
|
|
496
|
+
|
|
497
|
+
pagination?: Data.Pagination;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
export namespace Data {
|
|
501
|
+
export interface Pagination {
|
|
502
|
+
has_more?: boolean;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
export interface VoiceAgentsPageParams {
|
|
508
|
+
page?: number;
|
|
509
|
+
|
|
510
|
+
page_size?: number;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
export class VoiceAgentsPage<Item> extends AbstractPage<Item> implements VoiceAgentsPageResponse<Item> {
|
|
514
|
+
data: VoiceAgentsPageResponse.Data<Item>;
|
|
515
|
+
|
|
516
|
+
constructor(
|
|
517
|
+
client: Sent,
|
|
518
|
+
response: Response,
|
|
519
|
+
body: VoiceAgentsPageResponse<Item>,
|
|
520
|
+
options: FinalRequestOptions,
|
|
521
|
+
) {
|
|
522
|
+
super(client, response, body, options);
|
|
523
|
+
|
|
524
|
+
this.data = body.data || {};
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
getPaginatedItems(): Item[] {
|
|
528
|
+
return this.data?.agents ?? [];
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
override hasNextPage(): boolean {
|
|
532
|
+
if (this.data?.pagination?.has_more === false) {
|
|
533
|
+
return false;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
return super.hasNextPage();
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
nextPageRequestOptions(): PageRequestOptions | null {
|
|
540
|
+
const query = this.options.query as VoiceAgentsPageParams;
|
|
541
|
+
const currentPage = query?.page ?? 1;
|
|
542
|
+
|
|
543
|
+
return {
|
|
544
|
+
...this.options,
|
|
545
|
+
query: {
|
|
546
|
+
...maybeObj(this.options.query),
|
|
547
|
+
page: currentPage + 1,
|
|
548
|
+
},
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
}
|
|
@@ -8,14 +8,12 @@ import {
|
|
|
8
8
|
APIResponseOfVoiceNumber,
|
|
9
9
|
APIResponseOfVoiceNumberCreated,
|
|
10
10
|
APIResponseOfVoiceSecret,
|
|
11
|
-
APIResponseOfVoiceToken,
|
|
12
11
|
Voice,
|
|
13
12
|
VoiceCallbackTest,
|
|
14
13
|
VoiceCallbackTestErrorInfo,
|
|
15
14
|
VoiceCallbackTestRequestInfo,
|
|
16
15
|
VoiceCallbackTestResponseInfo,
|
|
17
16
|
VoiceCreateParams,
|
|
18
|
-
VoiceCreateTokenParams,
|
|
19
17
|
VoiceListParams,
|
|
20
18
|
VoiceNumber,
|
|
21
19
|
VoiceNumberCreated,
|
|
@@ -23,7 +21,6 @@ import {
|
|
|
23
21
|
VoiceRotateSecretParams,
|
|
24
22
|
VoiceSecret,
|
|
25
23
|
VoiceTestParams,
|
|
26
|
-
VoiceToken,
|
|
27
24
|
VoiceUpdateParams,
|
|
28
25
|
} from './voice';
|
|
29
26
|
|
|
@@ -41,7 +38,6 @@ export declare namespace Channels {
|
|
|
41
38
|
type APIResponseOfVoiceNumber as APIResponseOfVoiceNumber,
|
|
42
39
|
type APIResponseOfVoiceNumberCreated as APIResponseOfVoiceNumberCreated,
|
|
43
40
|
type APIResponseOfVoiceSecret as APIResponseOfVoiceSecret,
|
|
44
|
-
type APIResponseOfVoiceToken as APIResponseOfVoiceToken,
|
|
45
41
|
type VoiceCallbackTest as VoiceCallbackTest,
|
|
46
42
|
type VoiceCallbackTestErrorInfo as VoiceCallbackTestErrorInfo,
|
|
47
43
|
type VoiceCallbackTestRequestInfo as VoiceCallbackTestRequestInfo,
|
|
@@ -49,12 +45,10 @@ export declare namespace Channels {
|
|
|
49
45
|
type VoiceNumber as VoiceNumber,
|
|
50
46
|
type VoiceNumberCreated as VoiceNumberCreated,
|
|
51
47
|
type VoiceSecret as VoiceSecret,
|
|
52
|
-
type VoiceToken as VoiceToken,
|
|
53
48
|
type VoiceCreateParams as VoiceCreateParams,
|
|
54
49
|
type VoiceRetrieveParams as VoiceRetrieveParams,
|
|
55
50
|
type VoiceUpdateParams as VoiceUpdateParams,
|
|
56
51
|
type VoiceListParams as VoiceListParams,
|
|
57
|
-
type VoiceCreateTokenParams as VoiceCreateTokenParams,
|
|
58
52
|
type VoiceRotateSecretParams as VoiceRotateSecretParams,
|
|
59
53
|
type VoiceTestParams as VoiceTestParams,
|
|
60
54
|
};
|
|
@@ -8,7 +8,6 @@ export {
|
|
|
8
8
|
type APIResponseOfVoiceNumber,
|
|
9
9
|
type APIResponseOfVoiceNumberCreated,
|
|
10
10
|
type APIResponseOfVoiceSecret,
|
|
11
|
-
type APIResponseOfVoiceToken,
|
|
12
11
|
type VoiceCallbackTest,
|
|
13
12
|
type VoiceCallbackTestErrorInfo,
|
|
14
13
|
type VoiceCallbackTestRequestInfo,
|
|
@@ -16,12 +15,10 @@ export {
|
|
|
16
15
|
type VoiceNumber,
|
|
17
16
|
type VoiceNumberCreated,
|
|
18
17
|
type VoiceSecret,
|
|
19
|
-
type VoiceToken,
|
|
20
18
|
type VoiceCreateParams,
|
|
21
19
|
type VoiceRetrieveParams,
|
|
22
20
|
type VoiceUpdateParams,
|
|
23
21
|
type VoiceListParams,
|
|
24
|
-
type VoiceCreateTokenParams,
|
|
25
22
|
type VoiceRotateSecretParams,
|
|
26
23
|
type VoiceTestParams,
|
|
27
24
|
} from './voice';
|