@getsupervisor/agents-studio-sdk 1.41.2 → 1.42.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 +56 -4
- package/README.md +69 -20
- package/dist/index.cjs +319 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +399 -18
- package/dist/index.d.ts +399 -18
- package/dist/index.js +315 -10
- package/dist/index.js.map +1 -1
- package/package.json +11 -6
package/dist/index.cjs
CHANGED
|
@@ -43,12 +43,16 @@ __export(index_exports, {
|
|
|
43
43
|
createAgentVersionsApi: () => createAgentVersionsApi,
|
|
44
44
|
createAgentsApi: () => createAgentsApi,
|
|
45
45
|
createApiKeysApi: () => createApiKeysApi,
|
|
46
|
+
createBillingApi: () => createBillingApi,
|
|
47
|
+
createCallsApi: () => createCallsApi,
|
|
46
48
|
createCampaignsApi: () => createCampaignsApi,
|
|
47
49
|
createCatalogTemplatesApi: () => createCatalogTemplatesApi,
|
|
48
50
|
createCatalogsApi: () => createCatalogsApi,
|
|
49
51
|
createClient: () => createClient,
|
|
50
52
|
createHttp: () => createHttp,
|
|
53
|
+
createSipTrunksApi: () => createSipTrunksApi,
|
|
51
54
|
createToolsApi: () => createToolsApi,
|
|
55
|
+
createUsageApi: () => createUsageApi,
|
|
52
56
|
createVoicesApi: () => createVoicesApi,
|
|
53
57
|
createWebhooksApi: () => createWebhooksApi,
|
|
54
58
|
createWorkspacesApi: () => createWorkspacesApi,
|
|
@@ -238,7 +242,8 @@ function createHttp(cfg) {
|
|
|
238
242
|
}
|
|
239
243
|
return res;
|
|
240
244
|
} catch (e) {
|
|
241
|
-
if (e
|
|
245
|
+
if (e?.name === "AbortError")
|
|
246
|
+
throw new TimeoutError(timeout, targetUrl);
|
|
242
247
|
if (e instanceof HttpError) throw e;
|
|
243
248
|
throw new NetworkError(e, targetUrl);
|
|
244
249
|
}
|
|
@@ -259,6 +264,11 @@ function createHttp(cfg) {
|
|
|
259
264
|
}
|
|
260
265
|
|
|
261
266
|
// src/utils/query.ts
|
|
267
|
+
function buildSearchParams(entries) {
|
|
268
|
+
const searchParams = new URLSearchParams();
|
|
269
|
+
entries.forEach(([key, value]) => appendParam(searchParams, key, value));
|
|
270
|
+
return searchParams;
|
|
271
|
+
}
|
|
262
272
|
function serializeListOptions(options = {}, extra = {}) {
|
|
263
273
|
const params = new URLSearchParams();
|
|
264
274
|
appendParam(params, "page", options.page);
|
|
@@ -1130,7 +1140,8 @@ var createAgentEntity = (dto, options) => {
|
|
|
1130
1140
|
stageTriggersApi,
|
|
1131
1141
|
reload,
|
|
1132
1142
|
updateAgent,
|
|
1133
|
-
deleteAgent
|
|
1143
|
+
deleteAgent,
|
|
1144
|
+
cloneAgent
|
|
1134
1145
|
} = options;
|
|
1135
1146
|
const schedulesHelper = bindAgentSchedules(
|
|
1136
1147
|
scheduleApi,
|
|
@@ -1149,6 +1160,9 @@ var createAgentEntity = (dto, options) => {
|
|
|
1149
1160
|
async save(patch) {
|
|
1150
1161
|
return updateAgent(dto.agentId, patch);
|
|
1151
1162
|
},
|
|
1163
|
+
async clone(payload) {
|
|
1164
|
+
return cloneAgent(dto.agentId, payload);
|
|
1165
|
+
},
|
|
1152
1166
|
async delete() {
|
|
1153
1167
|
await deleteAgent(dto.agentId);
|
|
1154
1168
|
},
|
|
@@ -1174,6 +1188,22 @@ function createAgentsApi(cfg, relatedApis) {
|
|
|
1174
1188
|
throw new WorkspaceNotSelectedError();
|
|
1175
1189
|
};
|
|
1176
1190
|
const jsonHeaders = { "content-type": "application/json" };
|
|
1191
|
+
const normalizeCloneSelection = (selection) => {
|
|
1192
|
+
if (!selection) {
|
|
1193
|
+
return [];
|
|
1194
|
+
}
|
|
1195
|
+
if (Array.isArray(selection)) {
|
|
1196
|
+
return selection;
|
|
1197
|
+
}
|
|
1198
|
+
return Object.entries(selection).filter(([, enabled]) => enabled).map(([component]) => component);
|
|
1199
|
+
};
|
|
1200
|
+
const buildCloneAgentRequest = (payload) => {
|
|
1201
|
+
const { clone, ...rest } = payload;
|
|
1202
|
+
return {
|
|
1203
|
+
...rest,
|
|
1204
|
+
clone: normalizeCloneSelection(clone)
|
|
1205
|
+
};
|
|
1206
|
+
};
|
|
1177
1207
|
const fetchAgentsPage = async (options = {}) => {
|
|
1178
1208
|
requireWorkspace();
|
|
1179
1209
|
const sanitizedOptions = {
|
|
@@ -1218,6 +1248,16 @@ function createAgentsApi(cfg, relatedApis) {
|
|
|
1218
1248
|
});
|
|
1219
1249
|
return res.json();
|
|
1220
1250
|
};
|
|
1251
|
+
const cloneAgent = async (agentId, payload) => {
|
|
1252
|
+
requireWorkspace();
|
|
1253
|
+
const requestPayload = buildCloneAgentRequest(payload);
|
|
1254
|
+
const res = await doFetch(`${base}/agents/${agentId}/clone`, {
|
|
1255
|
+
method: "POST",
|
|
1256
|
+
body: JSON.stringify(requestPayload),
|
|
1257
|
+
headers: jsonHeaders
|
|
1258
|
+
});
|
|
1259
|
+
return res.json();
|
|
1260
|
+
};
|
|
1221
1261
|
const updateAgent = async (agentId, payload) => {
|
|
1222
1262
|
requireWorkspace();
|
|
1223
1263
|
const res = await doFetch(`${base}/agents/${agentId}`, {
|
|
@@ -1241,6 +1281,7 @@ function createAgentsApi(cfg, relatedApis) {
|
|
|
1241
1281
|
list: listAgents,
|
|
1242
1282
|
get: getAgentDetail,
|
|
1243
1283
|
create: createAgent,
|
|
1284
|
+
clone: cloneAgent,
|
|
1244
1285
|
forkFromTemplate: forkAgentFromTemplate,
|
|
1245
1286
|
update: updateAgent,
|
|
1246
1287
|
delete: deleteAgent
|
|
@@ -1267,6 +1308,10 @@ function createAgentsApi(cfg, relatedApis) {
|
|
|
1267
1308
|
},
|
|
1268
1309
|
deleteAgent: async (agentId) => {
|
|
1269
1310
|
await deleteAgent(agentId);
|
|
1311
|
+
},
|
|
1312
|
+
cloneAgent: async (agentId, payload) => {
|
|
1313
|
+
const cloned = await cloneAgent(agentId, payload);
|
|
1314
|
+
return wrapAgent(cloned);
|
|
1270
1315
|
}
|
|
1271
1316
|
});
|
|
1272
1317
|
return {
|
|
@@ -1292,6 +1337,10 @@ function createAgentsApi(cfg, relatedApis) {
|
|
|
1292
1337
|
const detail = await createAgent(payload);
|
|
1293
1338
|
return wrapAgent(detail);
|
|
1294
1339
|
},
|
|
1340
|
+
async clone(agentId, payload) {
|
|
1341
|
+
const detail = await cloneAgent(agentId, payload);
|
|
1342
|
+
return wrapAgent(detail);
|
|
1343
|
+
},
|
|
1295
1344
|
async forkFromTemplate(payload) {
|
|
1296
1345
|
const detail = await forkAgentFromTemplate(payload);
|
|
1297
1346
|
return wrapAgent(detail);
|
|
@@ -1334,6 +1383,82 @@ function createApiKeysApi(cfg) {
|
|
|
1334
1383
|
};
|
|
1335
1384
|
}
|
|
1336
1385
|
|
|
1386
|
+
// src/api/billing.ts
|
|
1387
|
+
function createBillingApi(cfg) {
|
|
1388
|
+
const { base, doFetch } = createHttp(cfg);
|
|
1389
|
+
return {
|
|
1390
|
+
async getBalance() {
|
|
1391
|
+
const res = await doFetch(`${base}/billing/balance`, {
|
|
1392
|
+
method: "GET"
|
|
1393
|
+
});
|
|
1394
|
+
return res.json();
|
|
1395
|
+
}
|
|
1396
|
+
};
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
// src/api/calls.ts
|
|
1400
|
+
function createCallsApi(cfg) {
|
|
1401
|
+
const { base, doFetch } = createHttp(cfg);
|
|
1402
|
+
const fetchCallsPage = async (options = {}) => {
|
|
1403
|
+
const {
|
|
1404
|
+
agentBatchId,
|
|
1405
|
+
agentId,
|
|
1406
|
+
executionId,
|
|
1407
|
+
recordedAfter,
|
|
1408
|
+
recordedBefore,
|
|
1409
|
+
durationBucket,
|
|
1410
|
+
goalStatus,
|
|
1411
|
+
query: searchQuery,
|
|
1412
|
+
...listOptions
|
|
1413
|
+
} = options ?? {};
|
|
1414
|
+
const query = serializeListOptions(listOptions, {
|
|
1415
|
+
agentBatchId,
|
|
1416
|
+
agentId,
|
|
1417
|
+
executionId,
|
|
1418
|
+
recordedAfter,
|
|
1419
|
+
recordedBefore,
|
|
1420
|
+
durationBucket,
|
|
1421
|
+
goalStatus,
|
|
1422
|
+
query: searchQuery
|
|
1423
|
+
});
|
|
1424
|
+
const res = await doFetch(`${base}/calls`, {
|
|
1425
|
+
method: "GET",
|
|
1426
|
+
query
|
|
1427
|
+
});
|
|
1428
|
+
return res.json();
|
|
1429
|
+
};
|
|
1430
|
+
return {
|
|
1431
|
+
async list(options = {}) {
|
|
1432
|
+
const normalizedOptions = { ...options ?? {} };
|
|
1433
|
+
const response = await fetchCallsPage(normalizedOptions);
|
|
1434
|
+
return attachPaginator(response, fetchCallsPage, normalizedOptions);
|
|
1435
|
+
},
|
|
1436
|
+
async stream(options) {
|
|
1437
|
+
const query = buildSearchParams([
|
|
1438
|
+
["after", options.after],
|
|
1439
|
+
["limit", options.limit],
|
|
1440
|
+
["agentBatchId", options.agentBatchId],
|
|
1441
|
+
["agentId", options.agentId],
|
|
1442
|
+
["executionId", options.executionId],
|
|
1443
|
+
["durationBucket", options.durationBucket],
|
|
1444
|
+
["goalStatus", options.goalStatus],
|
|
1445
|
+
["query", options.query]
|
|
1446
|
+
]);
|
|
1447
|
+
const res = await doFetch(`${base}/calls/stream`, {
|
|
1448
|
+
method: "GET",
|
|
1449
|
+
query
|
|
1450
|
+
});
|
|
1451
|
+
return res.json();
|
|
1452
|
+
},
|
|
1453
|
+
async get(callId) {
|
|
1454
|
+
const res = await doFetch(`${base}/calls/${callId}`, {
|
|
1455
|
+
method: "GET"
|
|
1456
|
+
});
|
|
1457
|
+
return res.json();
|
|
1458
|
+
}
|
|
1459
|
+
};
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1337
1462
|
// src/api/campaigns.ts
|
|
1338
1463
|
function createCampaignsApi(cfg) {
|
|
1339
1464
|
const { base, doFetch } = createHttp(cfg);
|
|
@@ -1349,10 +1474,7 @@ function createCampaignsApi(cfg) {
|
|
|
1349
1474
|
return res.json();
|
|
1350
1475
|
};
|
|
1351
1476
|
const fetchExecutionsPage = async (campaignId, options = {}) => {
|
|
1352
|
-
const query = serializeListOptions({
|
|
1353
|
-
page: options.page,
|
|
1354
|
-
limit: options.limit
|
|
1355
|
-
});
|
|
1477
|
+
const query = serializeListOptions(options ?? {});
|
|
1356
1478
|
const res = await doFetch(`${base}/campaigns/${campaignId}/executions`, {
|
|
1357
1479
|
method: "GET",
|
|
1358
1480
|
query
|
|
@@ -1406,6 +1528,51 @@ function createCampaignsApi(cfg) {
|
|
|
1406
1528
|
const response = await fetchExecutionsPage(campaignId, normalizedOptions);
|
|
1407
1529
|
const fetchPage = (opts) => fetchExecutionsPage(campaignId, opts);
|
|
1408
1530
|
return attachPaginator(response, fetchPage, normalizedOptions);
|
|
1531
|
+
},
|
|
1532
|
+
/**
|
|
1533
|
+
* Pausa una campaña en curso. Los reintentos ya programados se
|
|
1534
|
+
* reagendan al ejecutarse (sin consumir intentos) hasta `resume()`.
|
|
1535
|
+
*/
|
|
1536
|
+
async pause(campaignId) {
|
|
1537
|
+
const res = await doFetch(`${base}/campaigns/${campaignId}/pause`, {
|
|
1538
|
+
method: "POST"
|
|
1539
|
+
});
|
|
1540
|
+
return res.json();
|
|
1541
|
+
},
|
|
1542
|
+
/**
|
|
1543
|
+
* Reanuda una campaña pausada. Re-encola los reintentos pendientes
|
|
1544
|
+
* según su `nextRetryAt`.
|
|
1545
|
+
*/
|
|
1546
|
+
async resume(campaignId) {
|
|
1547
|
+
const res = await doFetch(`${base}/campaigns/${campaignId}/resume`, {
|
|
1548
|
+
method: "POST"
|
|
1549
|
+
});
|
|
1550
|
+
return res.json();
|
|
1551
|
+
},
|
|
1552
|
+
/**
|
|
1553
|
+
* Cancela definitivamente una campaña no terminal. Los reintentos
|
|
1554
|
+
* pendientes se descartan — operación destructiva.
|
|
1555
|
+
*/
|
|
1556
|
+
async cancel(campaignId) {
|
|
1557
|
+
const res = await doFetch(`${base}/campaigns/${campaignId}/cancel`, {
|
|
1558
|
+
method: "POST"
|
|
1559
|
+
});
|
|
1560
|
+
return res.json();
|
|
1561
|
+
},
|
|
1562
|
+
/**
|
|
1563
|
+
* Descarga el CSV con todas las ejecuciones de la campaña. Devuelve un
|
|
1564
|
+
* `Blob` con `text/csv; charset=utf-8` (BOM UTF-8 incluido). Para
|
|
1565
|
+
* campañas > 20,000 filas la API responde 413.
|
|
1566
|
+
*/
|
|
1567
|
+
async exportExecutions(campaignId) {
|
|
1568
|
+
const res = await doFetch(
|
|
1569
|
+
`${base}/campaigns/${campaignId}/executions/export`,
|
|
1570
|
+
{
|
|
1571
|
+
method: "GET",
|
|
1572
|
+
headers: { Accept: "text/csv" }
|
|
1573
|
+
}
|
|
1574
|
+
);
|
|
1575
|
+
return res.blob();
|
|
1409
1576
|
}
|
|
1410
1577
|
};
|
|
1411
1578
|
}
|
|
@@ -1486,6 +1653,42 @@ function createCatalogsApi(cfg) {
|
|
|
1486
1653
|
};
|
|
1487
1654
|
}
|
|
1488
1655
|
|
|
1656
|
+
// src/api/sip-trunks.ts
|
|
1657
|
+
function createSipTrunksApi(cfg) {
|
|
1658
|
+
const { base, doFetch } = createHttp(cfg);
|
|
1659
|
+
return {
|
|
1660
|
+
async list() {
|
|
1661
|
+
const res = await doFetch(`${base}/sip/trunks`, { method: "GET" });
|
|
1662
|
+
return res.json();
|
|
1663
|
+
},
|
|
1664
|
+
async get(trunkId) {
|
|
1665
|
+
const res = await doFetch(`${base}/sip/trunks/${trunkId}`, {
|
|
1666
|
+
method: "GET"
|
|
1667
|
+
});
|
|
1668
|
+
return res.json();
|
|
1669
|
+
},
|
|
1670
|
+
async create(body) {
|
|
1671
|
+
const res = await doFetch(`${base}/sip/trunks`, {
|
|
1672
|
+
method: "POST",
|
|
1673
|
+
headers: { "Content-Type": "application/json" },
|
|
1674
|
+
body: JSON.stringify(body)
|
|
1675
|
+
});
|
|
1676
|
+
return res.json();
|
|
1677
|
+
},
|
|
1678
|
+
async update(trunkId, body) {
|
|
1679
|
+
const res = await doFetch(`${base}/sip/trunks/${trunkId}`, {
|
|
1680
|
+
method: "PATCH",
|
|
1681
|
+
headers: { "Content-Type": "application/json" },
|
|
1682
|
+
body: JSON.stringify(body)
|
|
1683
|
+
});
|
|
1684
|
+
return res.json();
|
|
1685
|
+
},
|
|
1686
|
+
async delete(trunkId) {
|
|
1687
|
+
await doFetch(`${base}/sip/trunks/${trunkId}`, { method: "DELETE" });
|
|
1688
|
+
}
|
|
1689
|
+
};
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1489
1692
|
// src/api/tools.ts
|
|
1490
1693
|
var IDEMPOTENCY_HEADER = "Idempotency-Key";
|
|
1491
1694
|
var generateIdempotencyKey = (explicit) => {
|
|
@@ -1675,6 +1878,74 @@ function createToolsApi(cfg) {
|
|
|
1675
1878
|
};
|
|
1676
1879
|
}
|
|
1677
1880
|
|
|
1881
|
+
// src/api/usage.ts
|
|
1882
|
+
var import_api_query_builder = require("@getsupervisor/api-query-builder");
|
|
1883
|
+
function createUsageApi(cfg) {
|
|
1884
|
+
const { base, doFetch } = createHttp(cfg);
|
|
1885
|
+
const fetchUsageAgentsPage = async (options = {}) => {
|
|
1886
|
+
const { resource, from, to, ...listOptions } = options;
|
|
1887
|
+
const query = serializeListOptions({
|
|
1888
|
+
...listOptions,
|
|
1889
|
+
filter: resolveFilter(
|
|
1890
|
+
buildUsageFilter(resource, from, to),
|
|
1891
|
+
listOptions.filter
|
|
1892
|
+
)
|
|
1893
|
+
});
|
|
1894
|
+
const res = await doFetch(`${base}/usage/agents`, {
|
|
1895
|
+
method: "GET",
|
|
1896
|
+
query
|
|
1897
|
+
});
|
|
1898
|
+
return res.json();
|
|
1899
|
+
};
|
|
1900
|
+
return {
|
|
1901
|
+
async agents(options = {}) {
|
|
1902
|
+
const normalizedOptions = {
|
|
1903
|
+
...options
|
|
1904
|
+
};
|
|
1905
|
+
const response = await fetchUsageAgentsPage(normalizedOptions);
|
|
1906
|
+
return attachPaginator(response, fetchUsageAgentsPage, normalizedOptions);
|
|
1907
|
+
}
|
|
1908
|
+
};
|
|
1909
|
+
}
|
|
1910
|
+
function resolveFilter(usageFilter, fallback) {
|
|
1911
|
+
if (usageFilter) {
|
|
1912
|
+
return usageFilter;
|
|
1913
|
+
}
|
|
1914
|
+
return fallback;
|
|
1915
|
+
}
|
|
1916
|
+
function appendCondition(query, factory) {
|
|
1917
|
+
if (query) {
|
|
1918
|
+
query.and(factory);
|
|
1919
|
+
return query;
|
|
1920
|
+
}
|
|
1921
|
+
return new import_api_query_builder.Query(factory);
|
|
1922
|
+
}
|
|
1923
|
+
var DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
|
|
1924
|
+
function toISOString(value) {
|
|
1925
|
+
const input = DATE_ONLY.test(value) ? `${value}T00:00:00` : value;
|
|
1926
|
+
const date = new Date(input);
|
|
1927
|
+
if (Number.isNaN(date.getTime())) {
|
|
1928
|
+
return value;
|
|
1929
|
+
}
|
|
1930
|
+
return date.toISOString();
|
|
1931
|
+
}
|
|
1932
|
+
function buildUsageFilter(resource, from, to) {
|
|
1933
|
+
let query;
|
|
1934
|
+
if (resource) {
|
|
1935
|
+
query = appendCondition(query, (qb) => qb.eq("resource", resource));
|
|
1936
|
+
}
|
|
1937
|
+
if (from) {
|
|
1938
|
+
query = appendCondition(
|
|
1939
|
+
query,
|
|
1940
|
+
(qb) => qb.mte("createdAt", toISOString(from))
|
|
1941
|
+
);
|
|
1942
|
+
}
|
|
1943
|
+
if (to) {
|
|
1944
|
+
query = appendCondition(query, (qb) => qb.lt("createdAt", toISOString(to)));
|
|
1945
|
+
}
|
|
1946
|
+
return query;
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1678
1949
|
// src/utils/catalog-voices.ts
|
|
1679
1950
|
var FALLBACK_LOCALE = "und";
|
|
1680
1951
|
var FALLBACK_PROVIDER = "catalog";
|
|
@@ -1733,9 +2004,9 @@ function pickGender(value) {
|
|
|
1733
2004
|
}
|
|
1734
2005
|
|
|
1735
2006
|
// src/utils/catalog-filter.ts
|
|
1736
|
-
var
|
|
2007
|
+
var import_api_query_builder2 = require("@getsupervisor/api-query-builder");
|
|
1737
2008
|
function createCatalogTypeQuery(type) {
|
|
1738
|
-
return new
|
|
2009
|
+
return new import_api_query_builder2.Query((qb) => qb.eq("type", type));
|
|
1739
2010
|
}
|
|
1740
2011
|
function ensureCatalogTypeFilter(filter, type) {
|
|
1741
2012
|
const requiredQuery = createCatalogTypeQuery(type);
|
|
@@ -1971,6 +2242,35 @@ function createWebhooksApi(cfg) {
|
|
|
1971
2242
|
`${base}/webhooks/${webhookId}/subscriptions/${subscriptionId}`,
|
|
1972
2243
|
{ method: "DELETE" }
|
|
1973
2244
|
);
|
|
2245
|
+
},
|
|
2246
|
+
// Deliveries
|
|
2247
|
+
async listDeliveries(webhookId, options = {}) {
|
|
2248
|
+
const fetchPage = async (opts) => {
|
|
2249
|
+
const query = serializeListOptions({
|
|
2250
|
+
page: opts.page,
|
|
2251
|
+
limit: opts.limit,
|
|
2252
|
+
sort: opts.sort,
|
|
2253
|
+
fields: opts.fields,
|
|
2254
|
+
include: opts.include,
|
|
2255
|
+
search: opts.search,
|
|
2256
|
+
filter: opts.filter
|
|
2257
|
+
});
|
|
2258
|
+
const res = await doFetch(`${base}/webhooks/${webhookId}/deliveries`, {
|
|
2259
|
+
method: "GET",
|
|
2260
|
+
query
|
|
2261
|
+
});
|
|
2262
|
+
return res.json();
|
|
2263
|
+
};
|
|
2264
|
+
const normalized = { ...options ?? {} };
|
|
2265
|
+
const response = await fetchPage(normalized);
|
|
2266
|
+
return attachPaginator(response, fetchPage, normalized);
|
|
2267
|
+
},
|
|
2268
|
+
async getDelivery(webhookId, deliveryId) {
|
|
2269
|
+
const res = await doFetch(
|
|
2270
|
+
`${base}/webhooks/${webhookId}/deliveries/${deliveryId}`,
|
|
2271
|
+
{ method: "GET" }
|
|
2272
|
+
);
|
|
2273
|
+
return res.json();
|
|
1974
2274
|
}
|
|
1975
2275
|
};
|
|
1976
2276
|
}
|
|
@@ -2034,8 +2334,8 @@ function createWorkspacesApi(cfg) {
|
|
|
2034
2334
|
const fetchPage = (options) => fetchPhonesPage(workspaceId, options);
|
|
2035
2335
|
return attachPaginator(response, fetchPage, normalizedOptions);
|
|
2036
2336
|
},
|
|
2037
|
-
async enable(
|
|
2038
|
-
const res = await doFetch(`${base}/workspaces
|
|
2337
|
+
async enable(payload) {
|
|
2338
|
+
const res = await doFetch(`${base}/workspaces/enable`, {
|
|
2039
2339
|
method: "POST",
|
|
2040
2340
|
headers: jsonHeaders,
|
|
2041
2341
|
body: JSON.stringify(payload)
|
|
@@ -2081,6 +2381,7 @@ function createClient(initialCfg) {
|
|
|
2081
2381
|
const stagesApi = createAgentStagesApi(runtimeCfg);
|
|
2082
2382
|
const voicesApi = createVoicesApi(runtimeCfg);
|
|
2083
2383
|
const apiKeysApi = createApiKeysApi(runtimeCfg);
|
|
2384
|
+
const callsApi = createCallsApi(runtimeCfg);
|
|
2084
2385
|
const catalogsApi = createCatalogsApi(runtimeCfg);
|
|
2085
2386
|
const catalogTemplatesApi = createCatalogTemplatesApi(runtimeCfg);
|
|
2086
2387
|
const webhooksApi = createWebhooksApi(runtimeCfg);
|
|
@@ -2152,6 +2453,10 @@ function createClient(initialCfg) {
|
|
|
2152
2453
|
campaigns: createCampaignsApi(runtimeCfg),
|
|
2153
2454
|
voices: voicesApi,
|
|
2154
2455
|
apiKeys: apiKeysApi,
|
|
2456
|
+
billing: createBillingApi(runtimeCfg),
|
|
2457
|
+
calls: callsApi,
|
|
2458
|
+
usage: createUsageApi(runtimeCfg),
|
|
2459
|
+
sip: createSipTrunksApi(runtimeCfg),
|
|
2155
2460
|
webhooks: webhooksApi
|
|
2156
2461
|
};
|
|
2157
2462
|
return {
|
|
@@ -2235,12 +2540,16 @@ function createClient(initialCfg) {
|
|
|
2235
2540
|
createAgentVersionsApi,
|
|
2236
2541
|
createAgentsApi,
|
|
2237
2542
|
createApiKeysApi,
|
|
2543
|
+
createBillingApi,
|
|
2544
|
+
createCallsApi,
|
|
2238
2545
|
createCampaignsApi,
|
|
2239
2546
|
createCatalogTemplatesApi,
|
|
2240
2547
|
createCatalogsApi,
|
|
2241
2548
|
createClient,
|
|
2242
2549
|
createHttp,
|
|
2550
|
+
createSipTrunksApi,
|
|
2243
2551
|
createToolsApi,
|
|
2552
|
+
createUsageApi,
|
|
2244
2553
|
createVoicesApi,
|
|
2245
2554
|
createWebhooksApi,
|
|
2246
2555
|
createWorkspacesApi,
|