@vuevox/sdk 0.4.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 +361 -55
- package/dist/client.d.ts +16 -1
- package/dist/client.js +7 -0
- package/dist/generated/schema.d.ts +104 -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,11 +29,14 @@ Available scopes:
|
|
|
23
29
|
```text
|
|
24
30
|
hello:read
|
|
25
31
|
spaces:read
|
|
32
|
+
agents:read
|
|
26
33
|
calls:read
|
|
27
34
|
leads:read
|
|
28
35
|
```
|
|
29
36
|
|
|
30
|
-
|
|
37
|
+
The token request can only request scopes that were granted to that API client.
|
|
38
|
+
|
|
39
|
+
## Quickstart
|
|
31
40
|
|
|
32
41
|
```ts
|
|
33
42
|
import { createVueVoxClient } from "@vuevox/sdk";
|
|
@@ -35,85 +44,84 @@ import { createVueVoxClient } from "@vuevox/sdk";
|
|
|
35
44
|
const vuevox = createVueVoxClient({
|
|
36
45
|
clientId: process.env.VUEVOX_CLIENT_ID!,
|
|
37
46
|
clientSecret: process.env.VUEVOX_CLIENT_SECRET!,
|
|
38
|
-
scope: ["hello:read", "spaces:read", "calls:read", "leads:read"],
|
|
47
|
+
scope: ["hello:read", "spaces:read", "agents:read", "calls:read", "leads:read"],
|
|
39
48
|
});
|
|
40
49
|
|
|
41
50
|
const hello = await vuevox.hello.get();
|
|
42
51
|
console.log(hello.data.message, hello.requestId);
|
|
43
52
|
|
|
44
|
-
const spaces = await vuevox.spaces.list({ limit: 50 });
|
|
45
|
-
console.log(spaces.data.data, spaces.requestId);
|
|
46
|
-
|
|
47
53
|
const calls = await vuevox.calls.list({ limit: 50 });
|
|
48
54
|
console.log(calls.data.data, calls.requestId);
|
|
49
|
-
|
|
50
|
-
const leads = await vuevox.leads.list({ limit: 50 });
|
|
51
|
-
console.log(leads.data.data, leads.requestId);
|
|
52
55
|
```
|
|
53
56
|
|
|
54
57
|
The SDK requests and caches a short-lived access token using client credentials, then sends it as a bearer token for API calls.
|
|
55
58
|
|
|
56
|
-
##
|
|
59
|
+
## Client Reference
|
|
57
60
|
|
|
58
|
-
|
|
61
|
+
### `createVueVoxClient(options)`
|
|
59
62
|
|
|
60
|
-
|
|
61
|
-
const call = await vuevox.calls.get("call-id");
|
|
62
|
-
|
|
63
|
-
console.log(call.requestId);
|
|
64
|
-
console.log(call.data.data.transcript);
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
For centralized logging, pass `onResponse`. The hook runs for every SDK-managed HTTP response, including the token request.
|
|
63
|
+
Creates a VueVox API client.
|
|
68
64
|
|
|
69
65
|
```ts
|
|
70
66
|
const vuevox = createVueVoxClient({
|
|
67
|
+
baseUrl: "https://api.vuevox.com",
|
|
71
68
|
clientId: process.env.VUEVOX_CLIENT_ID!,
|
|
72
69
|
clientSecret: process.env.VUEVOX_CLIENT_SECRET!,
|
|
73
70
|
scope: ["calls:read"],
|
|
71
|
+
retries: 2,
|
|
72
|
+
retryBaseDelayMs: 250,
|
|
73
|
+
retryMaxDelayMs: 2000,
|
|
74
74
|
onResponse: ({ method, path, status, requestId }) => {
|
|
75
75
|
console.log({ method, path, status, requestId });
|
|
76
76
|
},
|
|
77
77
|
});
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
Options:
|
|
81
81
|
|
|
82
|
-
|
|
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`. |
|
|
93
|
+
|
|
94
|
+
Returns a namespaced client:
|
|
83
95
|
|
|
84
96
|
```ts
|
|
85
|
-
|
|
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
|
+
```
|
|
86
111
|
|
|
87
|
-
|
|
88
|
-
clientId: process.env.VUEVOX_CLIENT_ID!,
|
|
89
|
-
clientSecret: process.env.VUEVOX_CLIENT_SECRET!,
|
|
90
|
-
scope: ["calls:read"],
|
|
91
|
-
});
|
|
112
|
+
## Response Envelope
|
|
92
113
|
|
|
93
|
-
|
|
94
|
-
await vuevox.calls.list({ limit: 50 });
|
|
95
|
-
} catch (error) {
|
|
96
|
-
if (error instanceof VueVoxApiError) {
|
|
97
|
-
console.error(error.status, error.code, error.message, error.requestId);
|
|
98
|
-
}
|
|
114
|
+
All SDK endpoint methods return a response envelope:
|
|
99
115
|
|
|
100
|
-
|
|
101
|
-
|
|
116
|
+
```ts
|
|
117
|
+
type VueVoxApiResponse<T> = {
|
|
118
|
+
data: T;
|
|
119
|
+
status: number;
|
|
120
|
+
requestId?: string;
|
|
121
|
+
};
|
|
102
122
|
```
|
|
103
123
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
```text
|
|
107
|
-
missing_token
|
|
108
|
-
invalid_token
|
|
109
|
-
invalid_client
|
|
110
|
-
invalid_scope
|
|
111
|
-
insufficient_scope
|
|
112
|
-
rate_limited
|
|
113
|
-
invalid_request
|
|
114
|
-
call_not_found
|
|
115
|
-
lead_not_found
|
|
116
|
-
```
|
|
124
|
+
Use `requestId` in logs and support requests. It maps to the API `X-Request-Id` response header.
|
|
117
125
|
|
|
118
126
|
## Pagination
|
|
119
127
|
|
|
@@ -130,6 +138,13 @@ if (firstPage.data.pagination.nextCursor) {
|
|
|
130
138
|
}
|
|
131
139
|
```
|
|
132
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
|
+
|
|
133
148
|
The SDK also includes async iterable helpers:
|
|
134
149
|
|
|
135
150
|
```ts
|
|
@@ -138,7 +153,279 @@ for await (const call of vuevox.calls.paginate({ limit: 50 })) {
|
|
|
138
153
|
}
|
|
139
154
|
```
|
|
140
155
|
|
|
141
|
-
Pagination helpers are available for `spaces`, `calls`, and `leads`.
|
|
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
|
+
},
|
|
382
|
+
});
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
## Errors
|
|
386
|
+
|
|
387
|
+
API errors throw `VueVoxApiError`.
|
|
388
|
+
|
|
389
|
+
```ts
|
|
390
|
+
import { VueVoxApiError, createVueVoxClient } from "@vuevox/sdk";
|
|
391
|
+
|
|
392
|
+
try {
|
|
393
|
+
await vuevox.calls.list({ limit: 50 });
|
|
394
|
+
} catch (error) {
|
|
395
|
+
if (error instanceof VueVoxApiError) {
|
|
396
|
+
console.error(error.status, error.code, error.message, error.requestId);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
throw error;
|
|
400
|
+
}
|
|
401
|
+
```
|
|
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
|
+
|
|
416
|
+
Common API error codes:
|
|
417
|
+
|
|
418
|
+
```text
|
|
419
|
+
missing_token
|
|
420
|
+
invalid_token
|
|
421
|
+
invalid_client
|
|
422
|
+
invalid_scope
|
|
423
|
+
insufficient_scope
|
|
424
|
+
rate_limited
|
|
425
|
+
invalid_request
|
|
426
|
+
call_not_found
|
|
427
|
+
lead_not_found
|
|
428
|
+
```
|
|
142
429
|
|
|
143
430
|
## Retries
|
|
144
431
|
|
|
@@ -183,14 +470,33 @@ const vuevox = createVueVoxClient({
|
|
|
183
470
|
});
|
|
184
471
|
```
|
|
185
472
|
|
|
186
|
-
##
|
|
473
|
+
## Exported Types
|
|
187
474
|
|
|
188
|
-
|
|
475
|
+
The package exports these TypeScript types:
|
|
189
476
|
|
|
190
477
|
```ts
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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";
|
|
196
500
|
```
|
|
501
|
+
|
|
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,11 +1,13 @@
|
|
|
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"];
|
|
4
5
|
type CallsListResponse = components["schemas"]["CallsListResponse"];
|
|
5
6
|
type CallDetailResponse = components["schemas"]["CallDetailResponse"];
|
|
6
7
|
type LeadsListResponse = components["schemas"]["LeadsListResponse"];
|
|
7
8
|
type LeadDetailResponse = components["schemas"]["LeadDetailResponse"];
|
|
8
9
|
type Space = components["schemas"]["Space"];
|
|
10
|
+
type Agent = components["schemas"]["Agent"];
|
|
9
11
|
type CallSummary = components["schemas"]["CallSummary"];
|
|
10
12
|
type Lead = components["schemas"]["Lead"];
|
|
11
13
|
export interface ListSpacesOptions {
|
|
@@ -19,6 +21,9 @@ export interface ListCallsOptions extends ListSpacesOptions {
|
|
|
19
21
|
createdAfter?: string;
|
|
20
22
|
createdBefore?: string;
|
|
21
23
|
}
|
|
24
|
+
export interface ListAgentsOptions extends ListSpacesOptions {
|
|
25
|
+
spaceId?: string;
|
|
26
|
+
}
|
|
22
27
|
export interface ListLeadsOptions extends ListSpacesOptions {
|
|
23
28
|
spaceId?: string;
|
|
24
29
|
createdAfter?: string;
|
|
@@ -62,6 +67,16 @@ export declare function createVueVoxClient(options: VueVoxClientOptions): {
|
|
|
62
67
|
updatedAt: string;
|
|
63
68
|
}, any, any>;
|
|
64
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
|
+
};
|
|
65
80
|
calls: {
|
|
66
81
|
list: (listOptions?: ListCallsOptions) => Promise<VueVoxApiResponse<CallsListResponse>>;
|
|
67
82
|
get: (callId: string) => Promise<VueVoxApiResponse<CallDetailResponse>>;
|
|
@@ -95,4 +110,4 @@ export declare function createVueVoxClient(options: VueVoxClientOptions): {
|
|
|
95
110
|
};
|
|
96
111
|
raw: import("openapi-fetch").Client<paths, `${string}/${string}`>;
|
|
97
112
|
};
|
|
98
|
-
export type { CallDetailResponse, CallsListResponse, CallSummary, HelloResponse, Lead, LeadDetailResponse, LeadsListResponse, Space, SpacesListResponse };
|
|
113
|
+
export type { Agent, AgentsListResponse, CallDetailResponse, CallsListResponse, CallSummary, HelloResponse, Lead, LeadDetailResponse, LeadsListResponse, Space, SpacesListResponse };
|
package/dist/client.js
CHANGED
|
@@ -37,6 +37,9 @@ export function createVueVoxClient(options) {
|
|
|
37
37
|
async function listSpaces(listOptions = {}) {
|
|
38
38
|
return apiGet("/v1/spaces", listOptions);
|
|
39
39
|
}
|
|
40
|
+
async function listAgents(listOptions = {}) {
|
|
41
|
+
return apiGet("/v1/agents", listOptions);
|
|
42
|
+
}
|
|
40
43
|
async function listCalls(listOptions = {}) {
|
|
41
44
|
return apiGet("/v1/calls", listOptions);
|
|
42
45
|
}
|
|
@@ -96,6 +99,10 @@ export function createVueVoxClient(options) {
|
|
|
96
99
|
list: listSpaces,
|
|
97
100
|
paginate: (listOptions = {}) => paginate(listSpaces, listOptions),
|
|
98
101
|
},
|
|
102
|
+
agents: {
|
|
103
|
+
list: listAgents,
|
|
104
|
+
paginate: (listOptions = {}) => paginate(listAgents, listOptions),
|
|
105
|
+
},
|
|
99
106
|
calls: {
|
|
100
107
|
list: listCalls,
|
|
101
108
|
get: getCall,
|
|
@@ -64,6 +64,26 @@ export interface paths {
|
|
|
64
64
|
patch?: never;
|
|
65
65
|
trace?: never;
|
|
66
66
|
};
|
|
67
|
+
"/v1/agents": {
|
|
68
|
+
parameters: {
|
|
69
|
+
query?: never;
|
|
70
|
+
header?: never;
|
|
71
|
+
path?: never;
|
|
72
|
+
cookie?: never;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* List organization agents
|
|
76
|
+
* @description Returns agents for the API client's organization using cursor pagination. Optionally filter agents by space ID.
|
|
77
|
+
*/
|
|
78
|
+
get: operations["listAgents"];
|
|
79
|
+
put?: never;
|
|
80
|
+
post?: never;
|
|
81
|
+
delete?: never;
|
|
82
|
+
options?: never;
|
|
83
|
+
head?: never;
|
|
84
|
+
patch?: never;
|
|
85
|
+
trace?: never;
|
|
86
|
+
};
|
|
67
87
|
"/v1/calls": {
|
|
68
88
|
parameters: {
|
|
69
89
|
query?: never;
|
|
@@ -155,7 +175,7 @@ export interface components {
|
|
|
155
175
|
client_secret: string;
|
|
156
176
|
/**
|
|
157
177
|
* @description Space-separated scopes requested for the access token.
|
|
158
|
-
* @example hello:read spaces:read calls:read leads:read
|
|
178
|
+
* @example hello:read spaces:read agents:read calls:read leads:read
|
|
159
179
|
*/
|
|
160
180
|
scope?: string;
|
|
161
181
|
};
|
|
@@ -165,7 +185,7 @@ export interface components {
|
|
|
165
185
|
token_type: "Bearer";
|
|
166
186
|
/** @example 3600 */
|
|
167
187
|
expires_in: number;
|
|
168
|
-
/** @example hello:read spaces:read calls:read leads:read */
|
|
188
|
+
/** @example hello:read spaces:read agents:read calls:read leads:read */
|
|
169
189
|
scope: string;
|
|
170
190
|
};
|
|
171
191
|
HelloResponse: {
|
|
@@ -188,6 +208,21 @@ export interface components {
|
|
|
188
208
|
data: components["schemas"]["Space"][];
|
|
189
209
|
pagination: components["schemas"]["CursorPagination"];
|
|
190
210
|
};
|
|
211
|
+
Agent: {
|
|
212
|
+
/** Format: uuid */
|
|
213
|
+
id: string;
|
|
214
|
+
/** @example Morgan Agent */
|
|
215
|
+
name: string;
|
|
216
|
+
spaces: components["schemas"]["ResourceSummary"][];
|
|
217
|
+
/** Format: date-time */
|
|
218
|
+
createdAt: string;
|
|
219
|
+
/** Format: date-time */
|
|
220
|
+
updatedAt: string;
|
|
221
|
+
};
|
|
222
|
+
AgentsListResponse: {
|
|
223
|
+
data: components["schemas"]["Agent"][];
|
|
224
|
+
pagination: components["schemas"]["CursorPagination"];
|
|
225
|
+
};
|
|
191
226
|
ResourceSummary: {
|
|
192
227
|
/** Format: uuid */
|
|
193
228
|
id: string;
|
|
@@ -461,6 +496,73 @@ export interface operations {
|
|
|
461
496
|
};
|
|
462
497
|
};
|
|
463
498
|
};
|
|
499
|
+
listAgents: {
|
|
500
|
+
parameters: {
|
|
501
|
+
query?: {
|
|
502
|
+
/** @description Number of agents to return. Defaults to 50. Maximum is 100. */
|
|
503
|
+
limit?: number;
|
|
504
|
+
/** @description Opaque cursor from the previous response's pagination.nextCursor value. */
|
|
505
|
+
cursor?: string;
|
|
506
|
+
/** @description Filter agents assigned to a space ID. */
|
|
507
|
+
spaceId?: string;
|
|
508
|
+
};
|
|
509
|
+
header?: never;
|
|
510
|
+
path?: never;
|
|
511
|
+
cookie?: never;
|
|
512
|
+
};
|
|
513
|
+
requestBody?: never;
|
|
514
|
+
responses: {
|
|
515
|
+
/** @description Paginated agents response. */
|
|
516
|
+
200: {
|
|
517
|
+
headers: {
|
|
518
|
+
[name: string]: unknown;
|
|
519
|
+
};
|
|
520
|
+
content: {
|
|
521
|
+
"application/json": components["schemas"]["AgentsListResponse"];
|
|
522
|
+
};
|
|
523
|
+
};
|
|
524
|
+
/** @description Bearer token is missing, invalid, or expired. */
|
|
525
|
+
401: {
|
|
526
|
+
headers: {
|
|
527
|
+
[name: string]: unknown;
|
|
528
|
+
};
|
|
529
|
+
content: {
|
|
530
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
531
|
+
};
|
|
532
|
+
};
|
|
533
|
+
/** @description Bearer token does not include the required scope. */
|
|
534
|
+
403: {
|
|
535
|
+
headers: {
|
|
536
|
+
[name: string]: unknown;
|
|
537
|
+
};
|
|
538
|
+
content: {
|
|
539
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
540
|
+
};
|
|
541
|
+
};
|
|
542
|
+
/** @description Query parameters failed validation. */
|
|
543
|
+
422: {
|
|
544
|
+
headers: {
|
|
545
|
+
[name: string]: unknown;
|
|
546
|
+
};
|
|
547
|
+
content: {
|
|
548
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
549
|
+
};
|
|
550
|
+
};
|
|
551
|
+
/** @description Per-client rate limit exceeded. */
|
|
552
|
+
429: {
|
|
553
|
+
headers: {
|
|
554
|
+
/** @description Seconds to wait before retrying. */
|
|
555
|
+
"Retry-After"?: string;
|
|
556
|
+
/** @description Request limit per minute for this API client. */
|
|
557
|
+
"X-RateLimit-Limit"?: string;
|
|
558
|
+
[name: string]: unknown;
|
|
559
|
+
};
|
|
560
|
+
content: {
|
|
561
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
562
|
+
};
|
|
563
|
+
};
|
|
564
|
+
};
|
|
565
|
+
};
|
|
464
566
|
listCalls: {
|
|
465
567
|
parameters: {
|
|
466
568
|
query?: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { createVueVoxClient } from "./client.js";
|
|
2
|
-
export type { CallDetailResponse, CallsListResponse, CallSummary, HelloResponse, Lead, LeadDetailResponse, LeadsListResponse, ListCallsOptions, ListLeadsOptions, ListSpacesOptions, Space, SpacesListResponse, VueVoxApiResponse, VueVoxClientOptions, VueVoxResponseEvent, VueVoxResponseMetadata, } from "./client.js";
|
|
2
|
+
export type { Agent, AgentsListResponse, CallDetailResponse, CallsListResponse, CallSummary, HelloResponse, Lead, LeadDetailResponse, LeadsListResponse, ListAgentsOptions, ListCallsOptions, ListLeadsOptions, ListSpacesOptions, Space, SpacesListResponse, VueVoxApiResponse, VueVoxClientOptions, VueVoxResponseEvent, VueVoxResponseMetadata, } from "./client.js";
|
|
3
3
|
export { VueVoxApiError } from "./errors.js";
|
|
4
4
|
export type { VueVoxErrorResponse } from "./errors.js";
|