@vuevox/sdk 0.3.0 → 0.5.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/README.md +389 -49
- package/dist/client.d.ts +83 -3
- package/dist/client.js +121 -39
- package/dist/errors.d.ts +4 -1
- package/dist/errors.js +7 -1
- package/dist/generated/schema.d.ts +531 -2
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,12 @@ TypeScript SDK for the VueVox Developer API.
|
|
|
8
8
|
npm install @vuevox/sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
Requirements:
|
|
12
|
+
|
|
13
|
+
- Node.js 18 or newer.
|
|
14
|
+
- A VueVox Developer API client ID and secret.
|
|
15
|
+
- Server-side usage only. Do not expose `clientSecret` in browser code.
|
|
16
|
+
|
|
11
17
|
## Create API Credentials
|
|
12
18
|
|
|
13
19
|
In VueVox, open:
|
|
@@ -23,9 +29,14 @@ Available scopes:
|
|
|
23
29
|
```text
|
|
24
30
|
hello:read
|
|
25
31
|
spaces:read
|
|
32
|
+
agents:read
|
|
33
|
+
calls:read
|
|
34
|
+
leads:read
|
|
26
35
|
```
|
|
27
36
|
|
|
28
|
-
|
|
37
|
+
The token request can only request scopes that were granted to that API client.
|
|
38
|
+
|
|
39
|
+
## Quickstart
|
|
29
40
|
|
|
30
41
|
```ts
|
|
31
42
|
import { createVueVoxClient } from "@vuevox/sdk";
|
|
@@ -33,59 +44,353 @@ import { createVueVoxClient } from "@vuevox/sdk";
|
|
|
33
44
|
const vuevox = createVueVoxClient({
|
|
34
45
|
clientId: process.env.VUEVOX_CLIENT_ID!,
|
|
35
46
|
clientSecret: process.env.VUEVOX_CLIENT_SECRET!,
|
|
36
|
-
scope: ["hello:read", "spaces:read"],
|
|
47
|
+
scope: ["hello:read", "spaces:read", "agents:read", "calls:read", "leads:read"],
|
|
37
48
|
});
|
|
38
49
|
|
|
39
|
-
const hello = await vuevox.hello();
|
|
40
|
-
console.log(hello.data.message);
|
|
41
|
-
console.log(hello.requestId);
|
|
50
|
+
const hello = await vuevox.hello.get();
|
|
51
|
+
console.log(hello.data.message, hello.requestId);
|
|
42
52
|
|
|
43
|
-
const
|
|
44
|
-
console.log(
|
|
45
|
-
console.log(spaces.requestId);
|
|
53
|
+
const calls = await vuevox.calls.list({ limit: 50 });
|
|
54
|
+
console.log(calls.data.data, calls.requestId);
|
|
46
55
|
```
|
|
47
56
|
|
|
48
57
|
The SDK requests and caches a short-lived access token using client credentials, then sends it as a bearer token for API calls.
|
|
49
58
|
|
|
50
|
-
##
|
|
51
|
-
|
|
52
|
-
Every Developer API response includes an `X-Request-Id` header. SDK endpoint methods return response metadata with the response body so you can log that ID for support requests.
|
|
53
|
-
|
|
54
|
-
```ts
|
|
55
|
-
const spaces = await vuevox.listSpaces({ limit: 50 });
|
|
59
|
+
## Client Reference
|
|
56
60
|
|
|
57
|
-
|
|
58
|
-
console.log(spaces.data.data);
|
|
59
|
-
```
|
|
61
|
+
### `createVueVoxClient(options)`
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
Creates a VueVox API client.
|
|
62
64
|
|
|
63
65
|
```ts
|
|
64
66
|
const vuevox = createVueVoxClient({
|
|
67
|
+
baseUrl: "https://api.vuevox.com",
|
|
65
68
|
clientId: process.env.VUEVOX_CLIENT_ID!,
|
|
66
69
|
clientSecret: process.env.VUEVOX_CLIENT_SECRET!,
|
|
67
|
-
scope: ["
|
|
70
|
+
scope: ["calls:read"],
|
|
71
|
+
retries: 2,
|
|
72
|
+
retryBaseDelayMs: 250,
|
|
73
|
+
retryMaxDelayMs: 2000,
|
|
68
74
|
onResponse: ({ method, path, status, requestId }) => {
|
|
69
75
|
console.log({ method, path, status, requestId });
|
|
70
76
|
},
|
|
71
77
|
});
|
|
72
78
|
```
|
|
73
79
|
|
|
74
|
-
|
|
80
|
+
Options:
|
|
81
|
+
|
|
82
|
+
| Option | Type | Required | Description |
|
|
83
|
+
| --- | --- | --- | --- |
|
|
84
|
+
| `clientId` | `string` | Yes | Developer API client ID. |
|
|
85
|
+
| `clientSecret` | `string` | Yes | Developer API client secret. Keep this server-side. |
|
|
86
|
+
| `baseUrl` | `string` | No | API base URL. Defaults to `https://api.vuevox.com`. |
|
|
87
|
+
| `scope` | `string \| string[]` | No | Space-separated string or array of requested token scopes. If omitted, the token request uses all scopes granted to the client. |
|
|
88
|
+
| `fetch` | `typeof fetch` | No | Custom fetch implementation. Defaults to global `fetch`. |
|
|
89
|
+
| `onResponse` | `(event: VueVoxResponseEvent) => void` | No | Called for every SDK-managed HTTP response, including token requests. |
|
|
90
|
+
| `retries` | `number` | No | Retry count for token requests and GET endpoints. Defaults to `0`. |
|
|
91
|
+
| `retryBaseDelayMs` | `number` | No | Initial retry delay. Defaults to `250`. |
|
|
92
|
+
| `retryMaxDelayMs` | `number` | No | Maximum retry delay. Defaults to `2000`. |
|
|
75
93
|
|
|
76
|
-
|
|
94
|
+
Returns a namespaced client:
|
|
77
95
|
|
|
78
96
|
```ts
|
|
79
|
-
|
|
97
|
+
vuevox.getAccessToken();
|
|
98
|
+
vuevox.hello.get();
|
|
99
|
+
vuevox.spaces.list();
|
|
100
|
+
vuevox.spaces.paginate();
|
|
101
|
+
vuevox.agents.list();
|
|
102
|
+
vuevox.agents.paginate();
|
|
103
|
+
vuevox.calls.list();
|
|
104
|
+
vuevox.calls.get("call-id");
|
|
105
|
+
vuevox.calls.paginate();
|
|
106
|
+
vuevox.leads.list();
|
|
107
|
+
vuevox.leads.get("lead-id");
|
|
108
|
+
vuevox.leads.paginate();
|
|
109
|
+
vuevox.raw.GET("/v1/hello", { headers: { Authorization: `Bearer ${await vuevox.getAccessToken()}` } });
|
|
110
|
+
```
|
|
80
111
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
112
|
+
## Response Envelope
|
|
113
|
+
|
|
114
|
+
All SDK endpoint methods return a response envelope:
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
type VueVoxApiResponse<T> = {
|
|
118
|
+
data: T;
|
|
119
|
+
status: number;
|
|
120
|
+
requestId?: string;
|
|
121
|
+
};
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Use `requestId` in logs and support requests. It maps to the API `X-Request-Id` response header.
|
|
125
|
+
|
|
126
|
+
## Pagination
|
|
127
|
+
|
|
128
|
+
List endpoints use cursor pagination.
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
const firstPage = await vuevox.calls.list({ limit: 50 });
|
|
132
|
+
|
|
133
|
+
if (firstPage.data.pagination.nextCursor) {
|
|
134
|
+
const secondPage = await vuevox.calls.list({
|
|
135
|
+
limit: 50,
|
|
136
|
+
cursor: firstPage.data.pagination.nextCursor,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
List option fields shared by paginated endpoints:
|
|
142
|
+
|
|
143
|
+
| Option | Type | Description |
|
|
144
|
+
| --- | --- | --- |
|
|
145
|
+
| `limit` | `number` | Number of items to return. Defaults to `50`; maximum is `100`. |
|
|
146
|
+
| `cursor` | `string` | Cursor from the previous response's `pagination.nextCursor`. |
|
|
147
|
+
|
|
148
|
+
The SDK also includes async iterable helpers:
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
for await (const call of vuevox.calls.paginate({ limit: 50 })) {
|
|
152
|
+
console.log(call.id);
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Pagination helpers are available for `spaces`, `agents`, `calls`, and `leads`.
|
|
157
|
+
|
|
158
|
+
## Methods
|
|
159
|
+
|
|
160
|
+
### `vuevox.getAccessToken()`
|
|
161
|
+
|
|
162
|
+
Requests or returns a cached bearer token.
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
const token = await vuevox.getAccessToken();
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Returns: `Promise<string>`.
|
|
169
|
+
|
|
170
|
+
### `vuevox.hello.get()`
|
|
171
|
+
|
|
172
|
+
Checks credentials and connectivity.
|
|
173
|
+
|
|
174
|
+
Required scope: `hello:read`.
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
const response = await vuevox.hello.get();
|
|
178
|
+
console.log(response.data.message);
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Returns: `Promise<VueVoxApiResponse<HelloResponse>>`.
|
|
182
|
+
|
|
183
|
+
### `vuevox.spaces.list(options?)`
|
|
184
|
+
|
|
185
|
+
Lists organization spaces.
|
|
186
|
+
|
|
187
|
+
Required scope: `spaces:read`.
|
|
188
|
+
|
|
189
|
+
Options: `ListSpacesOptions`
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
const response = await vuevox.spaces.list({ limit: 50 });
|
|
193
|
+
|
|
194
|
+
for (const space of response.data.data) {
|
|
195
|
+
console.log(space.id, space.name);
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Returns: `Promise<VueVoxApiResponse<SpacesListResponse>>`.
|
|
200
|
+
|
|
201
|
+
### `vuevox.spaces.paginate(options?)`
|
|
202
|
+
|
|
203
|
+
Iterates organization spaces across all pages.
|
|
204
|
+
|
|
205
|
+
Required scope: `spaces:read`.
|
|
206
|
+
|
|
207
|
+
Options: `ListSpacesOptions`
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
for await (const space of vuevox.spaces.paginate({ limit: 100 })) {
|
|
211
|
+
console.log(space.id, space.name);
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Returns: `AsyncGenerator<Space>`.
|
|
216
|
+
|
|
217
|
+
### `vuevox.agents.list(options?)`
|
|
218
|
+
|
|
219
|
+
Lists organization agents.
|
|
220
|
+
|
|
221
|
+
Required scope: `agents:read`.
|
|
222
|
+
|
|
223
|
+
Options: `ListAgentsOptions`
|
|
224
|
+
|
|
225
|
+
| Option | Type | Description |
|
|
226
|
+
| --- | --- | --- |
|
|
227
|
+
| `limit` | `number` | Number of agents to return. Defaults to `50`; maximum is `100`. |
|
|
228
|
+
| `cursor` | `string` | Cursor from the previous response. |
|
|
229
|
+
| `spaceId` | `string` | Optional space ID filter. |
|
|
230
|
+
|
|
231
|
+
```ts
|
|
232
|
+
const response = await vuevox.agents.list({ limit: 50, spaceId: "space-id" });
|
|
233
|
+
|
|
234
|
+
for (const agent of response.data.data) {
|
|
235
|
+
console.log(agent.id, agent.name);
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Returns: `Promise<VueVoxApiResponse<AgentsListResponse>>`.
|
|
240
|
+
|
|
241
|
+
### `vuevox.agents.paginate(options?)`
|
|
242
|
+
|
|
243
|
+
Iterates organization agents across all pages.
|
|
244
|
+
|
|
245
|
+
Required scope: `agents:read`.
|
|
246
|
+
|
|
247
|
+
Options: `ListAgentsOptions`
|
|
248
|
+
|
|
249
|
+
```ts
|
|
250
|
+
for await (const agent of vuevox.agents.paginate({ spaceId: "space-id" })) {
|
|
251
|
+
console.log(agent.id, agent.name);
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Returns: `AsyncGenerator<Agent>`.
|
|
256
|
+
|
|
257
|
+
### `vuevox.calls.list(options?)`
|
|
258
|
+
|
|
259
|
+
Lists organization calls. List responses do not include transcripts.
|
|
260
|
+
|
|
261
|
+
Required scope: `calls:read`.
|
|
262
|
+
|
|
263
|
+
Options: `ListCallsOptions`
|
|
264
|
+
|
|
265
|
+
| Option | Type | Description |
|
|
266
|
+
| --- | --- | --- |
|
|
267
|
+
| `limit` | `number` | Number of calls to return. Defaults to `50`; maximum is `100`. |
|
|
268
|
+
| `cursor` | `string` | Cursor from the previous response. |
|
|
269
|
+
| `spaceId` | `string` | Optional space ID filter. |
|
|
270
|
+
| `leadId` | `string` | Optional lead ID filter. |
|
|
271
|
+
| `agentId` | `string` | Optional agent ID filter. |
|
|
272
|
+
| `createdAfter` | `string` | Optional ISO 8601 lower bound for call creation time. |
|
|
273
|
+
| `createdBefore` | `string` | Optional ISO 8601 upper bound for call creation time. |
|
|
274
|
+
|
|
275
|
+
```ts
|
|
276
|
+
const response = await vuevox.calls.list({
|
|
277
|
+
limit: 50,
|
|
278
|
+
spaceId: "space-id",
|
|
279
|
+
createdAfter: "2026-01-01T00:00:00.000Z",
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
for (const call of response.data.data) {
|
|
283
|
+
console.log(call.id, call.status, call.createdAt);
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Returns: `Promise<VueVoxApiResponse<CallsListResponse>>`.
|
|
288
|
+
|
|
289
|
+
### `vuevox.calls.get(callId)`
|
|
290
|
+
|
|
291
|
+
Gets a call detail record, including transcript data when available.
|
|
292
|
+
|
|
293
|
+
Required scope: `calls:read`.
|
|
294
|
+
|
|
295
|
+
```ts
|
|
296
|
+
const response = await vuevox.calls.get("call-id");
|
|
297
|
+
console.log(response.data.data.transcript);
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Returns: `Promise<VueVoxApiResponse<CallDetailResponse>>`.
|
|
301
|
+
|
|
302
|
+
### `vuevox.calls.paginate(options?)`
|
|
303
|
+
|
|
304
|
+
Iterates organization calls across all pages.
|
|
305
|
+
|
|
306
|
+
Required scope: `calls:read`.
|
|
307
|
+
|
|
308
|
+
Options: `ListCallsOptions`
|
|
309
|
+
|
|
310
|
+
```ts
|
|
311
|
+
for await (const call of vuevox.calls.paginate({ leadId: "lead-id" })) {
|
|
312
|
+
console.log(call.id);
|
|
313
|
+
}
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
Returns: `AsyncGenerator<CallSummary>`.
|
|
317
|
+
|
|
318
|
+
### `vuevox.leads.list(options?)`
|
|
319
|
+
|
|
320
|
+
Lists organization leads. The `leads:read` scope includes lead email and phone contact details.
|
|
321
|
+
|
|
322
|
+
Required scope: `leads:read`.
|
|
323
|
+
|
|
324
|
+
Options: `ListLeadsOptions`
|
|
325
|
+
|
|
326
|
+
| Option | Type | Description |
|
|
327
|
+
| --- | --- | --- |
|
|
328
|
+
| `limit` | `number` | Number of leads to return. Defaults to `50`; maximum is `100`. |
|
|
329
|
+
| `cursor` | `string` | Cursor from the previous response. |
|
|
330
|
+
| `spaceId` | `string` | Optional space ID filter. |
|
|
331
|
+
| `createdAfter` | `string` | Optional ISO 8601 lower bound for lead creation time. |
|
|
332
|
+
| `createdBefore` | `string` | Optional ISO 8601 upper bound for lead creation time. |
|
|
333
|
+
|
|
334
|
+
```ts
|
|
335
|
+
const response = await vuevox.leads.list({ limit: 50, spaceId: "space-id" });
|
|
336
|
+
|
|
337
|
+
for (const lead of response.data.data) {
|
|
338
|
+
console.log(lead.id, lead.email, lead.phone);
|
|
339
|
+
}
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
Returns: `Promise<VueVoxApiResponse<LeadsListResponse>>`.
|
|
343
|
+
|
|
344
|
+
### `vuevox.leads.get(leadId)`
|
|
345
|
+
|
|
346
|
+
Gets a lead detail record, including email and phone contact details.
|
|
347
|
+
|
|
348
|
+
Required scope: `leads:read`.
|
|
349
|
+
|
|
350
|
+
```ts
|
|
351
|
+
const response = await vuevox.leads.get("lead-id");
|
|
352
|
+
console.log(response.data.email, response.data.phone);
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
Returns: `Promise<VueVoxApiResponse<LeadDetailResponse>>`.
|
|
356
|
+
|
|
357
|
+
### `vuevox.leads.paginate(options?)`
|
|
358
|
+
|
|
359
|
+
Iterates organization leads across all pages.
|
|
360
|
+
|
|
361
|
+
Required scope: `leads:read`.
|
|
362
|
+
|
|
363
|
+
Options: `ListLeadsOptions`
|
|
364
|
+
|
|
365
|
+
```ts
|
|
366
|
+
for await (const lead of vuevox.leads.paginate({ createdAfter: "2026-01-01T00:00:00.000Z" })) {
|
|
367
|
+
console.log(lead.id);
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
Returns: `AsyncGenerator<Lead>`.
|
|
372
|
+
|
|
373
|
+
## Lower-Level Calls
|
|
374
|
+
|
|
375
|
+
For advanced integrations, `raw` exposes a typed lower-level OpenAPI client. You must attach authorization yourself.
|
|
376
|
+
|
|
377
|
+
```ts
|
|
378
|
+
const { data, error } = await vuevox.raw.GET("/v1/hello", {
|
|
379
|
+
headers: {
|
|
380
|
+
Authorization: `Bearer ${await vuevox.getAccessToken()}`,
|
|
381
|
+
},
|
|
85
382
|
});
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
## Errors
|
|
386
|
+
|
|
387
|
+
API errors throw `VueVoxApiError`.
|
|
388
|
+
|
|
389
|
+
```ts
|
|
390
|
+
import { VueVoxApiError, createVueVoxClient } from "@vuevox/sdk";
|
|
86
391
|
|
|
87
392
|
try {
|
|
88
|
-
await vuevox.
|
|
393
|
+
await vuevox.calls.list({ limit: 50 });
|
|
89
394
|
} catch (error) {
|
|
90
395
|
if (error instanceof VueVoxApiError) {
|
|
91
396
|
console.error(error.status, error.code, error.message, error.requestId);
|
|
@@ -95,6 +400,19 @@ try {
|
|
|
95
400
|
}
|
|
96
401
|
```
|
|
97
402
|
|
|
403
|
+
Error fields:
|
|
404
|
+
|
|
405
|
+
| Field | Type | Description |
|
|
406
|
+
| --- | --- | --- |
|
|
407
|
+
| `status` | `number` | HTTP status code. |
|
|
408
|
+
| `code` | `string` | Stable API error code. |
|
|
409
|
+
| `message` | `string` | Human-readable message. |
|
|
410
|
+
| `requestId` | `string \| undefined` | Request ID from `X-Request-Id` or error body. |
|
|
411
|
+
| `details` | `Record<string, unknown> \| undefined` | Structured error details when present. |
|
|
412
|
+
| `retryAfter` | `number \| undefined` | Seconds to wait before retrying when present. |
|
|
413
|
+
| `isRateLimited` | `boolean` | `true` for rate limit errors. |
|
|
414
|
+
| `response` | `VueVoxErrorResponse \| undefined` | Full API error response when available. |
|
|
415
|
+
|
|
98
416
|
Common API error codes:
|
|
99
417
|
|
|
100
418
|
```text
|
|
@@ -104,6 +422,24 @@ invalid_client
|
|
|
104
422
|
invalid_scope
|
|
105
423
|
insufficient_scope
|
|
106
424
|
rate_limited
|
|
425
|
+
invalid_request
|
|
426
|
+
call_not_found
|
|
427
|
+
lead_not_found
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
## Retries
|
|
431
|
+
|
|
432
|
+
Configure retry/backoff for safe SDK-managed requests. The SDK retries token requests and GET endpoints for `429`, `500`, `502`, `503`, and `504`, and respects `Retry-After` when present.
|
|
433
|
+
|
|
434
|
+
```ts
|
|
435
|
+
const vuevox = createVueVoxClient({
|
|
436
|
+
clientId: process.env.VUEVOX_CLIENT_ID!,
|
|
437
|
+
clientSecret: process.env.VUEVOX_CLIENT_SECRET!,
|
|
438
|
+
scope: ["calls:read"],
|
|
439
|
+
retries: 2,
|
|
440
|
+
retryBaseDelayMs: 250,
|
|
441
|
+
retryMaxDelayMs: 2000,
|
|
442
|
+
});
|
|
107
443
|
```
|
|
108
444
|
|
|
109
445
|
## Token Behavior
|
|
@@ -130,33 +466,37 @@ const vuevox = createVueVoxClient({
|
|
|
130
466
|
baseUrl: "https://api.vuevox.com",
|
|
131
467
|
clientId: process.env.VUEVOX_CLIENT_ID!,
|
|
132
468
|
clientSecret: process.env.VUEVOX_CLIENT_SECRET!,
|
|
133
|
-
scope: ["
|
|
469
|
+
scope: ["calls:read"],
|
|
134
470
|
});
|
|
135
471
|
```
|
|
136
472
|
|
|
137
|
-
##
|
|
473
|
+
## Exported Types
|
|
138
474
|
|
|
139
|
-
|
|
475
|
+
The package exports these TypeScript types:
|
|
140
476
|
|
|
141
477
|
```ts
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
478
|
+
import type {
|
|
479
|
+
Agent,
|
|
480
|
+
AgentsListResponse,
|
|
481
|
+
CallDetailResponse,
|
|
482
|
+
CallsListResponse,
|
|
483
|
+
CallSummary,
|
|
484
|
+
HelloResponse,
|
|
485
|
+
Lead,
|
|
486
|
+
LeadDetailResponse,
|
|
487
|
+
LeadsListResponse,
|
|
488
|
+
ListAgentsOptions,
|
|
489
|
+
ListCallsOptions,
|
|
490
|
+
ListLeadsOptions,
|
|
491
|
+
ListSpacesOptions,
|
|
492
|
+
Space,
|
|
493
|
+
SpacesListResponse,
|
|
494
|
+
VueVoxApiResponse,
|
|
495
|
+
VueVoxClientOptions,
|
|
496
|
+
VueVoxErrorResponse,
|
|
497
|
+
VueVoxResponseEvent,
|
|
498
|
+
VueVoxResponseMetadata,
|
|
499
|
+
} from "@vuevox/sdk";
|
|
147
500
|
```
|
|
148
501
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
List endpoints use cursor pagination.
|
|
152
|
-
|
|
153
|
-
```ts
|
|
154
|
-
const firstPage = await vuevox.listSpaces({ limit: 50 });
|
|
155
|
-
|
|
156
|
-
if (firstPage.data.pagination.nextCursor) {
|
|
157
|
-
const secondPage = await vuevox.listSpaces({
|
|
158
|
-
limit: 50,
|
|
159
|
-
cursor: firstPage.data.pagination.nextCursor,
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
```
|
|
502
|
+
Generated OpenAPI-derived types are included in the package declaration files, so editors can inspect the exact response fields for each method.
|
package/dist/client.d.ts
CHANGED
|
@@ -1,10 +1,34 @@
|
|
|
1
1
|
import type { components, paths } from "./generated/schema.js";
|
|
2
2
|
type HelloResponse = components["schemas"]["HelloResponse"];
|
|
3
3
|
type SpacesListResponse = components["schemas"]["SpacesListResponse"];
|
|
4
|
+
type AgentsListResponse = components["schemas"]["AgentsListResponse"];
|
|
5
|
+
type CallsListResponse = components["schemas"]["CallsListResponse"];
|
|
6
|
+
type CallDetailResponse = components["schemas"]["CallDetailResponse"];
|
|
7
|
+
type LeadsListResponse = components["schemas"]["LeadsListResponse"];
|
|
8
|
+
type LeadDetailResponse = components["schemas"]["LeadDetailResponse"];
|
|
9
|
+
type Space = components["schemas"]["Space"];
|
|
10
|
+
type Agent = components["schemas"]["Agent"];
|
|
11
|
+
type CallSummary = components["schemas"]["CallSummary"];
|
|
12
|
+
type Lead = components["schemas"]["Lead"];
|
|
4
13
|
export interface ListSpacesOptions {
|
|
5
14
|
limit?: number;
|
|
6
15
|
cursor?: string;
|
|
7
16
|
}
|
|
17
|
+
export interface ListCallsOptions extends ListSpacesOptions {
|
|
18
|
+
spaceId?: string;
|
|
19
|
+
leadId?: string;
|
|
20
|
+
agentId?: string;
|
|
21
|
+
createdAfter?: string;
|
|
22
|
+
createdBefore?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ListAgentsOptions extends ListSpacesOptions {
|
|
25
|
+
spaceId?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface ListLeadsOptions extends ListSpacesOptions {
|
|
28
|
+
spaceId?: string;
|
|
29
|
+
createdAfter?: string;
|
|
30
|
+
createdBefore?: string;
|
|
31
|
+
}
|
|
8
32
|
export interface VueVoxResponseMetadata {
|
|
9
33
|
requestId?: string;
|
|
10
34
|
status: number;
|
|
@@ -15,6 +39,7 @@ export interface VueVoxApiResponse<T> extends VueVoxResponseMetadata {
|
|
|
15
39
|
export interface VueVoxResponseEvent extends VueVoxResponseMetadata {
|
|
16
40
|
method: string;
|
|
17
41
|
path: string;
|
|
42
|
+
retryAfter?: number;
|
|
18
43
|
}
|
|
19
44
|
export interface VueVoxClientOptions {
|
|
20
45
|
baseUrl?: string;
|
|
@@ -23,11 +48,66 @@ export interface VueVoxClientOptions {
|
|
|
23
48
|
scope?: string | string[];
|
|
24
49
|
fetch?: typeof fetch;
|
|
25
50
|
onResponse?: (event: VueVoxResponseEvent) => void;
|
|
51
|
+
retries?: number;
|
|
52
|
+
retryBaseDelayMs?: number;
|
|
53
|
+
retryMaxDelayMs?: number;
|
|
26
54
|
}
|
|
27
55
|
export declare function createVueVoxClient(options: VueVoxClientOptions): {
|
|
28
56
|
getAccessToken: () => Promise<string>;
|
|
29
|
-
hello:
|
|
30
|
-
|
|
57
|
+
hello: {
|
|
58
|
+
get: () => Promise<VueVoxApiResponse<HelloResponse>>;
|
|
59
|
+
};
|
|
60
|
+
spaces: {
|
|
61
|
+
list: (listOptions?: ListSpacesOptions) => Promise<VueVoxApiResponse<SpacesListResponse>>;
|
|
62
|
+
paginate: (listOptions?: ListSpacesOptions) => AsyncGenerator<{
|
|
63
|
+
id: string;
|
|
64
|
+
name: string;
|
|
65
|
+
description: string | null;
|
|
66
|
+
createdAt: string;
|
|
67
|
+
updatedAt: string;
|
|
68
|
+
}, any, any>;
|
|
69
|
+
};
|
|
70
|
+
agents: {
|
|
71
|
+
list: (listOptions?: ListAgentsOptions) => Promise<VueVoxApiResponse<AgentsListResponse>>;
|
|
72
|
+
paginate: (listOptions?: ListAgentsOptions) => AsyncGenerator<{
|
|
73
|
+
id: string;
|
|
74
|
+
name: string;
|
|
75
|
+
spaces: components["schemas"]["ResourceSummary"][];
|
|
76
|
+
createdAt: string;
|
|
77
|
+
updatedAt: string;
|
|
78
|
+
}, any, any>;
|
|
79
|
+
};
|
|
80
|
+
calls: {
|
|
81
|
+
list: (listOptions?: ListCallsOptions) => Promise<VueVoxApiResponse<CallsListResponse>>;
|
|
82
|
+
get: (callId: string) => Promise<VueVoxApiResponse<CallDetailResponse>>;
|
|
83
|
+
paginate: (listOptions?: ListCallsOptions) => AsyncGenerator<{
|
|
84
|
+
id: string;
|
|
85
|
+
space: components["schemas"]["ResourceSummary"];
|
|
86
|
+
lead: components["schemas"]["LeadSummary"];
|
|
87
|
+
agent: components["schemas"]["ResourceSummary"];
|
|
88
|
+
duration: number;
|
|
89
|
+
score: number | null;
|
|
90
|
+
sentiment: string | null;
|
|
91
|
+
analysisStatus: string;
|
|
92
|
+
queueStatus: string | null;
|
|
93
|
+
createdAt: string;
|
|
94
|
+
updatedAt: string;
|
|
95
|
+
}, any, any>;
|
|
96
|
+
};
|
|
97
|
+
leads: {
|
|
98
|
+
list: (listOptions?: ListLeadsOptions) => Promise<VueVoxApiResponse<LeadsListResponse>>;
|
|
99
|
+
get: (leadId: string) => Promise<VueVoxApiResponse<LeadDetailResponse>>;
|
|
100
|
+
paginate: (listOptions?: ListLeadsOptions) => AsyncGenerator<{
|
|
101
|
+
id: string;
|
|
102
|
+
firstName: string;
|
|
103
|
+
lastName: string;
|
|
104
|
+
email: string | null;
|
|
105
|
+
phone: string | null;
|
|
106
|
+
space: components["schemas"]["ResourceSummary"];
|
|
107
|
+
createdAt: string;
|
|
108
|
+
updatedAt: string;
|
|
109
|
+
}, any, any>;
|
|
110
|
+
};
|
|
31
111
|
raw: import("openapi-fetch").Client<paths, `${string}/${string}`>;
|
|
32
112
|
};
|
|
33
|
-
export {};
|
|
113
|
+
export type { Agent, AgentsListResponse, CallDetailResponse, CallsListResponse, CallSummary, HelloResponse, Lead, LeadDetailResponse, LeadsListResponse, Space, SpacesListResponse };
|