@gpt-platform/admin 0.3.3 → 0.4.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/dist/index.d.mts +9040 -3783
- package/dist/index.d.ts +9040 -3783
- package/dist/index.js +3191 -122
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3191 -122
- package/dist/index.mjs.map +1 -1
- package/llms.txt +844 -769
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -853,8 +853,8 @@ var createClient = (config = {}) => {
|
|
|
853
853
|
};
|
|
854
854
|
|
|
855
855
|
// src/version.ts
|
|
856
|
-
var SDK_VERSION = "0.
|
|
857
|
-
var DEFAULT_API_VERSION = "2026-02-
|
|
856
|
+
var SDK_VERSION = "0.4.0";
|
|
857
|
+
var DEFAULT_API_VERSION = "2026-02-27";
|
|
858
858
|
|
|
859
859
|
// src/base-client.ts
|
|
860
860
|
function isSecureUrl(url) {
|
|
@@ -1172,6 +1172,7 @@ var RequestBuilder = class {
|
|
|
1172
1172
|
const { data } = await this.requestWithRetry(
|
|
1173
1173
|
() => fn({
|
|
1174
1174
|
client: this.clientInstance,
|
|
1175
|
+
throwOnError: true,
|
|
1175
1176
|
headers,
|
|
1176
1177
|
...params,
|
|
1177
1178
|
...options?.signal && { signal: options.signal }
|
|
@@ -1191,6 +1192,7 @@ var RequestBuilder = class {
|
|
|
1191
1192
|
await this.requestWithRetry(
|
|
1192
1193
|
() => fn({
|
|
1193
1194
|
client: this.clientInstance,
|
|
1195
|
+
throwOnError: true,
|
|
1194
1196
|
headers,
|
|
1195
1197
|
...params,
|
|
1196
1198
|
...options?.signal && { signal: options.signal }
|
|
@@ -1368,6 +1370,35 @@ var client = createClient(
|
|
|
1368
1370
|
);
|
|
1369
1371
|
|
|
1370
1372
|
// src/_internal/sdk.gen.ts
|
|
1373
|
+
var getAdminFieldTemplates = (options) => (options.client ?? client).get({
|
|
1374
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1375
|
+
url: "/admin/field-templates",
|
|
1376
|
+
...options
|
|
1377
|
+
});
|
|
1378
|
+
var postAdminFieldTemplates = (options) => (options.client ?? client).post({
|
|
1379
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1380
|
+
url: "/admin/field-templates",
|
|
1381
|
+
...options,
|
|
1382
|
+
headers: {
|
|
1383
|
+
"Content-Type": "application/vnd.api+json",
|
|
1384
|
+
...options.headers
|
|
1385
|
+
}
|
|
1386
|
+
});
|
|
1387
|
+
var getAdminAgents = (options) => (options.client ?? client).get({
|
|
1388
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1389
|
+
url: "/admin/agents",
|
|
1390
|
+
...options
|
|
1391
|
+
});
|
|
1392
|
+
var deleteAdminAgentVersionsById = (options) => (options.client ?? client).delete({
|
|
1393
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1394
|
+
url: "/admin/agent-versions/{id}",
|
|
1395
|
+
...options
|
|
1396
|
+
});
|
|
1397
|
+
var getAdminAgentVersionsById = (options) => (options.client ?? client).get({
|
|
1398
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1399
|
+
url: "/admin/agent-versions/{id}",
|
|
1400
|
+
...options
|
|
1401
|
+
});
|
|
1371
1402
|
var patchAdminAccountsByIdCredit = (options) => (options.client ?? client).patch({
|
|
1372
1403
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1373
1404
|
url: "/admin/accounts/{id}/credit",
|
|
@@ -1377,16 +1408,206 @@ var patchAdminAccountsByIdCredit = (options) => (options.client ?? client).patch
|
|
|
1377
1408
|
...options.headers
|
|
1378
1409
|
}
|
|
1379
1410
|
});
|
|
1411
|
+
var getAdminTrainingSessionsAgentsByAgentIdSessions = (options) => (options.client ?? client).get({
|
|
1412
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1413
|
+
url: "/admin/training-sessions/agents/{agent_id}/sessions",
|
|
1414
|
+
...options
|
|
1415
|
+
});
|
|
1416
|
+
var patchAdminApiKeysByIdSetBudget = (options) => (options.client ?? client).patch({
|
|
1417
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1418
|
+
url: "/admin/api-keys/{id}/set-budget",
|
|
1419
|
+
...options,
|
|
1420
|
+
headers: {
|
|
1421
|
+
"Content-Type": "application/vnd.api+json",
|
|
1422
|
+
...options.headers
|
|
1423
|
+
}
|
|
1424
|
+
});
|
|
1425
|
+
var getAdminAgentVersionsByIdRevisions = (options) => (options.client ?? client).get({
|
|
1426
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1427
|
+
url: "/admin/agent-versions/{id}/revisions",
|
|
1428
|
+
...options
|
|
1429
|
+
});
|
|
1430
|
+
var postAdminAgentsCloneForWorkspace = (options) => (options.client ?? client).post({
|
|
1431
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1432
|
+
url: "/admin/agents/clone-for-workspace",
|
|
1433
|
+
...options,
|
|
1434
|
+
headers: {
|
|
1435
|
+
"Content-Type": "application/vnd.api+json",
|
|
1436
|
+
...options.headers
|
|
1437
|
+
}
|
|
1438
|
+
});
|
|
1439
|
+
var getAdminAgentsById = (options) => (options.client ?? client).get({
|
|
1440
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1441
|
+
url: "/admin/agents/{id}",
|
|
1442
|
+
...options
|
|
1443
|
+
});
|
|
1444
|
+
var postAdminAgentsByIdExport = (options) => (options.client ?? client).post({
|
|
1445
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1446
|
+
url: "/admin/agents/{id}/export",
|
|
1447
|
+
...options
|
|
1448
|
+
});
|
|
1449
|
+
var postAdminAgentsByIdRestoreVersion = (options) => (options.client ?? client).post({
|
|
1450
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1451
|
+
url: "/admin/agents/{id}/restore-version",
|
|
1452
|
+
...options,
|
|
1453
|
+
headers: {
|
|
1454
|
+
"Content-Type": "application/vnd.api+json",
|
|
1455
|
+
...options.headers
|
|
1456
|
+
}
|
|
1457
|
+
});
|
|
1458
|
+
var getAdminAgentsByIdTrainingExamples = (options) => (options.client ?? client).get({
|
|
1459
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1460
|
+
url: "/admin/agents/{id}/training-examples",
|
|
1461
|
+
...options
|
|
1462
|
+
});
|
|
1463
|
+
var deleteAdminEmailMarketingCampaignsById = (options) => (options.client ?? client).delete({
|
|
1464
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1465
|
+
url: "/admin/email-marketing/campaigns/{id}",
|
|
1466
|
+
...options
|
|
1467
|
+
});
|
|
1468
|
+
var getAdminEmailMarketingCampaignsById = (options) => (options.client ?? client).get({
|
|
1469
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1470
|
+
url: "/admin/email-marketing/campaigns/{id}",
|
|
1471
|
+
...options
|
|
1472
|
+
});
|
|
1380
1473
|
var getAdminWebhookDeliveriesById = (options) => (options.client ?? client).get({
|
|
1381
1474
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1382
1475
|
url: "/admin/webhook-deliveries/{id}",
|
|
1383
1476
|
...options
|
|
1384
1477
|
});
|
|
1478
|
+
var postAdminAgentsByIdSchemaVersionsByVersionIdActivate = (options) => (options.client ?? client).post({
|
|
1479
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1480
|
+
url: "/admin/agents/{id}/schema-versions/{version_id}/activate",
|
|
1481
|
+
...options
|
|
1482
|
+
});
|
|
1483
|
+
var postAdminAgentsPredict = (options) => (options.client ?? client).post({
|
|
1484
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1485
|
+
url: "/admin/agents/predict",
|
|
1486
|
+
...options,
|
|
1487
|
+
headers: {
|
|
1488
|
+
"Content-Type": "application/vnd.api+json",
|
|
1489
|
+
...options.headers
|
|
1490
|
+
}
|
|
1491
|
+
});
|
|
1492
|
+
var deleteAdminApiKeysById = (options) => (options.client ?? client).delete({
|
|
1493
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1494
|
+
url: "/admin/api-keys/{id}",
|
|
1495
|
+
...options
|
|
1496
|
+
});
|
|
1385
1497
|
var getAdminApiKeysById = (options) => (options.client ?? client).get({
|
|
1386
1498
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1387
1499
|
url: "/admin/api-keys/{id}",
|
|
1388
1500
|
...options
|
|
1389
1501
|
});
|
|
1502
|
+
var patchAdminApiKeysById = (options) => (options.client ?? client).patch({
|
|
1503
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1504
|
+
url: "/admin/api-keys/{id}",
|
|
1505
|
+
...options,
|
|
1506
|
+
headers: {
|
|
1507
|
+
"Content-Type": "application/vnd.api+json",
|
|
1508
|
+
...options.headers
|
|
1509
|
+
}
|
|
1510
|
+
});
|
|
1511
|
+
var getAdminVoiceRecordingsSessionBySessionId = (options) => (options.client ?? client).get({
|
|
1512
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1513
|
+
url: "/admin/voice/recordings/session/{session_id}",
|
|
1514
|
+
...options
|
|
1515
|
+
});
|
|
1516
|
+
var getAdminEmailTrackingEventsWorkspaceByWorkspaceId = (options) => (options.client ?? client).get({
|
|
1517
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1518
|
+
url: "/admin/email/tracking-events/workspace/{workspace_id}",
|
|
1519
|
+
...options
|
|
1520
|
+
});
|
|
1521
|
+
var deleteAdminTrainingExamplesById = (options) => (options.client ?? client).delete({
|
|
1522
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1523
|
+
url: "/admin/training-examples/{id}",
|
|
1524
|
+
...options
|
|
1525
|
+
});
|
|
1526
|
+
var getAdminTrainingExamplesById = (options) => (options.client ?? client).get({
|
|
1527
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1528
|
+
url: "/admin/training-examples/{id}",
|
|
1529
|
+
...options
|
|
1530
|
+
});
|
|
1531
|
+
var patchAdminTrainingExamplesById = (options) => (options.client ?? client).patch({
|
|
1532
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1533
|
+
url: "/admin/training-examples/{id}",
|
|
1534
|
+
...options,
|
|
1535
|
+
headers: {
|
|
1536
|
+
"Content-Type": "application/vnd.api+json",
|
|
1537
|
+
...options.headers
|
|
1538
|
+
}
|
|
1539
|
+
});
|
|
1540
|
+
var postAdminTrainingExamplesBulkDelete = (options) => (options.client ?? client).post({
|
|
1541
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1542
|
+
url: "/admin/training-examples/bulk-delete",
|
|
1543
|
+
...options,
|
|
1544
|
+
headers: {
|
|
1545
|
+
"Content-Type": "application/vnd.api+json",
|
|
1546
|
+
...options.headers
|
|
1547
|
+
}
|
|
1548
|
+
});
|
|
1549
|
+
var getAdminVoiceSessions = (options) => (options.client ?? client).get({
|
|
1550
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1551
|
+
url: "/admin/voice/sessions",
|
|
1552
|
+
...options
|
|
1553
|
+
});
|
|
1554
|
+
var getAdminVoiceTranscriptionResultsSessionBySessionId = (options) => (options.client ?? client).get({
|
|
1555
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1556
|
+
url: "/admin/voice/transcription-results/session/{session_id}",
|
|
1557
|
+
...options
|
|
1558
|
+
});
|
|
1559
|
+
var getAdminUsers = (options) => (options.client ?? client).get({
|
|
1560
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1561
|
+
url: "/admin/users",
|
|
1562
|
+
...options
|
|
1563
|
+
});
|
|
1564
|
+
var getAdminAgentVersionsByIdMetrics = (options) => (options.client ?? client).get({
|
|
1565
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1566
|
+
url: "/admin/agent-versions/{id}/metrics",
|
|
1567
|
+
...options
|
|
1568
|
+
});
|
|
1569
|
+
var postAdminAgentVersionsByIdSetSystemFields = (options) => (options.client ?? client).post({
|
|
1570
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1571
|
+
url: "/admin/agent-versions/{id}/set-system-fields",
|
|
1572
|
+
...options,
|
|
1573
|
+
headers: {
|
|
1574
|
+
"Content-Type": "application/vnd.api+json",
|
|
1575
|
+
...options.headers
|
|
1576
|
+
}
|
|
1577
|
+
});
|
|
1578
|
+
var postAdminEmailMarketingCampaigns = (options) => (options.client ?? client).post({
|
|
1579
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1580
|
+
url: "/admin/email-marketing/campaigns",
|
|
1581
|
+
...options,
|
|
1582
|
+
headers: {
|
|
1583
|
+
"Content-Type": "application/vnd.api+json",
|
|
1584
|
+
...options.headers
|
|
1585
|
+
}
|
|
1586
|
+
});
|
|
1587
|
+
var postAdminAgentVersionsByIdAddSystemField = (options) => (options.client ?? client).post({
|
|
1588
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1589
|
+
url: "/admin/agent-versions/{id}/add-system-field",
|
|
1590
|
+
...options,
|
|
1591
|
+
headers: {
|
|
1592
|
+
"Content-Type": "application/vnd.api+json",
|
|
1593
|
+
...options.headers
|
|
1594
|
+
}
|
|
1595
|
+
});
|
|
1596
|
+
var deleteAdminFieldTemplatesById = (options) => (options.client ?? client).delete({
|
|
1597
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1598
|
+
url: "/admin/field-templates/{id}",
|
|
1599
|
+
...options
|
|
1600
|
+
});
|
|
1601
|
+
var getAdminFieldTemplatesById = (options) => (options.client ?? client).get({
|
|
1602
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1603
|
+
url: "/admin/field-templates/{id}",
|
|
1604
|
+
...options
|
|
1605
|
+
});
|
|
1606
|
+
var getAdminVoiceSessionsById = (options) => (options.client ?? client).get({
|
|
1607
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1608
|
+
url: "/admin/voice/sessions/{id}",
|
|
1609
|
+
...options
|
|
1610
|
+
});
|
|
1390
1611
|
var deleteAdminWebhookConfigsById = (options) => (options.client ?? client).delete({
|
|
1391
1612
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1392
1613
|
url: "/admin/webhook-configs/{id}",
|
|
@@ -1406,6 +1627,24 @@ var patchAdminWebhookConfigsById = (options) => (options.client ?? client).patch
|
|
|
1406
1627
|
...options.headers
|
|
1407
1628
|
}
|
|
1408
1629
|
});
|
|
1630
|
+
var patchAdminUsersByIdAdminEmail = (options) => (options.client ?? client).patch({
|
|
1631
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1632
|
+
url: "/admin/users/{id}/admin/email",
|
|
1633
|
+
...options,
|
|
1634
|
+
headers: {
|
|
1635
|
+
"Content-Type": "application/vnd.api+json",
|
|
1636
|
+
...options.headers
|
|
1637
|
+
}
|
|
1638
|
+
});
|
|
1639
|
+
var postAdminTrainingExamplesSearch = (options) => (options.client ?? client).post({
|
|
1640
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1641
|
+
url: "/admin/training-examples/search",
|
|
1642
|
+
...options,
|
|
1643
|
+
headers: {
|
|
1644
|
+
"Content-Type": "application/vnd.api+json",
|
|
1645
|
+
...options.headers
|
|
1646
|
+
}
|
|
1647
|
+
});
|
|
1409
1648
|
var patchAdminAccountsByIdDebit = (options) => (options.client ?? client).patch({
|
|
1410
1649
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1411
1650
|
url: "/admin/accounts/{id}/debit",
|
|
@@ -1415,11 +1654,25 @@ var patchAdminAccountsByIdDebit = (options) => (options.client ?? client).patch(
|
|
|
1415
1654
|
...options.headers
|
|
1416
1655
|
}
|
|
1417
1656
|
});
|
|
1657
|
+
var getAdminVoiceTranscriptionResultsById = (options) => (options.client ?? client).get({
|
|
1658
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1659
|
+
url: "/admin/voice/transcription-results/{id}",
|
|
1660
|
+
...options
|
|
1661
|
+
});
|
|
1418
1662
|
var getAdminApiKeys = (options) => (options.client ?? client).get({
|
|
1419
1663
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1420
1664
|
url: "/admin/api-keys",
|
|
1421
1665
|
...options
|
|
1422
1666
|
});
|
|
1667
|
+
var postAdminApiKeys = (options) => (options.client ?? client).post({
|
|
1668
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1669
|
+
url: "/admin/api-keys",
|
|
1670
|
+
...options,
|
|
1671
|
+
headers: {
|
|
1672
|
+
"Content-Type": "application/vnd.api+json",
|
|
1673
|
+
...options.headers
|
|
1674
|
+
}
|
|
1675
|
+
});
|
|
1423
1676
|
var getAdminExtractionDocumentsById = (options) => (options.client ?? client).get({
|
|
1424
1677
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1425
1678
|
url: "/admin/extraction/documents/{id}",
|
|
@@ -1435,124 +1688,1442 @@ var getAdminStorageStats = (options) => (options.client ?? client).get({
|
|
|
1435
1688
|
url: "/admin/storage/stats",
|
|
1436
1689
|
...options
|
|
1437
1690
|
});
|
|
1691
|
+
var getAdminAgentsByIdStats = (options) => (options.client ?? client).get({
|
|
1692
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1693
|
+
url: "/admin/agents/{id}/stats",
|
|
1694
|
+
...options
|
|
1695
|
+
});
|
|
1696
|
+
var patchAdminUsersByIdConfirmEmail = (options) => (options.client ?? client).patch({
|
|
1697
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1698
|
+
url: "/admin/users/{id}/confirm-email",
|
|
1699
|
+
...options,
|
|
1700
|
+
headers: {
|
|
1701
|
+
"Content-Type": "application/vnd.api+json",
|
|
1702
|
+
...options.headers
|
|
1703
|
+
}
|
|
1704
|
+
});
|
|
1705
|
+
var getAdminEmailMarketingSenderProfilesWorkspaceByWorkspaceId = (options) => (options.client ?? client).get({
|
|
1706
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1707
|
+
url: "/admin/email-marketing/sender-profiles/workspace/{workspace_id}",
|
|
1708
|
+
...options
|
|
1709
|
+
});
|
|
1710
|
+
var getAdminEmailMarketingCampaignsWorkspaceByWorkspaceId = (options) => (options.client ?? client).get({
|
|
1711
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1712
|
+
url: "/admin/email-marketing/campaigns/workspace/{workspace_id}",
|
|
1713
|
+
...options
|
|
1714
|
+
});
|
|
1438
1715
|
var getAdminAccountsById = (options) => (options.client ?? client).get({
|
|
1439
1716
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1440
1717
|
url: "/admin/accounts/{id}",
|
|
1441
1718
|
...options
|
|
1442
1719
|
});
|
|
1443
|
-
var
|
|
1720
|
+
var deleteAdminUsersById = (options) => (options.client ?? client).delete({
|
|
1444
1721
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1445
|
-
url: "/admin/
|
|
1722
|
+
url: "/admin/users/{id}",
|
|
1446
1723
|
...options
|
|
1447
1724
|
});
|
|
1448
|
-
var
|
|
1725
|
+
var getAdminUsersById = (options) => (options.client ?? client).get({
|
|
1449
1726
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1450
|
-
url: "/admin/
|
|
1727
|
+
url: "/admin/users/{id}",
|
|
1451
1728
|
...options
|
|
1452
1729
|
});
|
|
1453
|
-
var
|
|
1730
|
+
var getAdminAgentsByIdUsage = (options) => (options.client ?? client).get({
|
|
1454
1731
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1455
|
-
url: "/admin/
|
|
1732
|
+
url: "/admin/agents/{id}/usage",
|
|
1456
1733
|
...options
|
|
1457
1734
|
});
|
|
1458
|
-
var
|
|
1735
|
+
var getAdminEmailTrackingEventsById = (options) => (options.client ?? client).get({
|
|
1459
1736
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1460
|
-
url: "/admin/
|
|
1737
|
+
url: "/admin/email/tracking-events/{id}",
|
|
1461
1738
|
...options
|
|
1462
1739
|
});
|
|
1463
|
-
var
|
|
1740
|
+
var deleteAdminEmailMarketingSenderProfilesById = (options) => (options.client ?? client).delete({
|
|
1464
1741
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1465
|
-
url: "/admin/
|
|
1466
|
-
...options
|
|
1467
|
-
headers: {
|
|
1468
|
-
"Content-Type": "application/vnd.api+json",
|
|
1469
|
-
...options.headers
|
|
1470
|
-
}
|
|
1742
|
+
url: "/admin/email-marketing/sender-profiles/{id}",
|
|
1743
|
+
...options
|
|
1471
1744
|
});
|
|
1472
|
-
var
|
|
1745
|
+
var getAdminEmailMarketingSenderProfilesById = (options) => (options.client ?? client).get({
|
|
1473
1746
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1474
|
-
url: "/admin/
|
|
1747
|
+
url: "/admin/email-marketing/sender-profiles/{id}",
|
|
1475
1748
|
...options
|
|
1476
1749
|
});
|
|
1477
|
-
var
|
|
1750
|
+
var patchAdminEmailMarketingSenderProfilesById = (options) => (options.client ?? client).patch({
|
|
1478
1751
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1479
|
-
url: "/admin/
|
|
1752
|
+
url: "/admin/email-marketing/sender-profiles/{id}",
|
|
1480
1753
|
...options,
|
|
1481
1754
|
headers: {
|
|
1482
1755
|
"Content-Type": "application/vnd.api+json",
|
|
1483
1756
|
...options.headers
|
|
1484
1757
|
}
|
|
1485
1758
|
});
|
|
1486
|
-
var
|
|
1759
|
+
var getAdminAgentVersions = (options) => (options.client ?? client).get({
|
|
1487
1760
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1488
|
-
url: "/admin/
|
|
1489
|
-
...options
|
|
1490
|
-
headers: {
|
|
1491
|
-
"Content-Type": "application/vnd.api+json",
|
|
1492
|
-
...options.headers
|
|
1493
|
-
}
|
|
1761
|
+
url: "/admin/agent-versions",
|
|
1762
|
+
...options
|
|
1494
1763
|
});
|
|
1495
|
-
var
|
|
1764
|
+
var postAdminAgentVersions = (options) => (options.client ?? client).post({
|
|
1496
1765
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1497
|
-
url: "/admin/
|
|
1766
|
+
url: "/admin/agent-versions",
|
|
1498
1767
|
...options,
|
|
1499
1768
|
headers: {
|
|
1500
1769
|
"Content-Type": "application/vnd.api+json",
|
|
1501
1770
|
...options.headers
|
|
1502
1771
|
}
|
|
1503
1772
|
});
|
|
1504
|
-
var
|
|
1773
|
+
var getAdminVoiceSessionsWorkspaceByWorkspaceId = (options) => (options.client ?? client).get({
|
|
1505
1774
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1506
|
-
url: "/admin/
|
|
1775
|
+
url: "/admin/voice/sessions/workspace/{workspace_id}",
|
|
1507
1776
|
...options
|
|
1508
1777
|
});
|
|
1509
|
-
var
|
|
1778
|
+
var postAdminEmailOutboundEmails = (options) => (options.client ?? client).post({
|
|
1510
1779
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1511
|
-
url: "/admin/
|
|
1780
|
+
url: "/admin/email/outbound-emails",
|
|
1512
1781
|
...options,
|
|
1513
1782
|
headers: {
|
|
1514
1783
|
"Content-Type": "application/vnd.api+json",
|
|
1515
1784
|
...options.headers
|
|
1516
1785
|
}
|
|
1517
1786
|
});
|
|
1518
|
-
var
|
|
1787
|
+
var getAdminEmailOutboundEmailsWorkspaceByWorkspaceId = (options) => (options.client ?? client).get({
|
|
1519
1788
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1520
|
-
url: "/admin/
|
|
1789
|
+
url: "/admin/email/outbound-emails/workspace/{workspace_id}",
|
|
1521
1790
|
...options
|
|
1522
1791
|
});
|
|
1523
|
-
var
|
|
1792
|
+
var getAdminBucketsByIdStats = (options) => (options.client ?? client).get({
|
|
1524
1793
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1525
|
-
url: "/admin/
|
|
1794
|
+
url: "/admin/buckets/{id}/stats",
|
|
1795
|
+
...options
|
|
1796
|
+
});
|
|
1797
|
+
var getAdminUsersByEmail = (options) => (options.client ?? client).get({
|
|
1798
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1799
|
+
url: "/admin/users/by-email",
|
|
1800
|
+
...options
|
|
1801
|
+
});
|
|
1802
|
+
var deleteAdminAgentsByIdTrainingExamplesByExampleId = (options) => (options.client ?? client).delete({
|
|
1803
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1804
|
+
url: "/admin/agents/{id}/training-examples/{example_id}",
|
|
1805
|
+
...options
|
|
1806
|
+
});
|
|
1807
|
+
var postAdminAgentsImport = (options) => (options.client ?? client).post({
|
|
1808
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1809
|
+
url: "/admin/agents/import",
|
|
1526
1810
|
...options,
|
|
1527
1811
|
headers: {
|
|
1528
1812
|
"Content-Type": "application/vnd.api+json",
|
|
1529
1813
|
...options.headers
|
|
1530
1814
|
}
|
|
1531
1815
|
});
|
|
1532
|
-
var
|
|
1816
|
+
var postAdminAgentsByIdPublishVersion = (options) => (options.client ?? client).post({
|
|
1533
1817
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1534
|
-
url: "/admin/
|
|
1818
|
+
url: "/admin/agents/{id}/publish-version",
|
|
1535
1819
|
...options,
|
|
1536
1820
|
headers: {
|
|
1537
1821
|
"Content-Type": "application/vnd.api+json",
|
|
1538
1822
|
...options.headers
|
|
1539
1823
|
}
|
|
1540
1824
|
});
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1825
|
+
var getAdminDocumentsStats = (options) => (options.client ?? client).get({
|
|
1826
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1827
|
+
url: "/admin/documents/stats",
|
|
1828
|
+
...options
|
|
1829
|
+
});
|
|
1830
|
+
var getAdminWebhookDeliveries = (options) => (options.client ?? client).get({
|
|
1831
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1832
|
+
url: "/admin/webhook-deliveries",
|
|
1833
|
+
...options
|
|
1834
|
+
});
|
|
1835
|
+
var getAdminExtractionDocuments = (options) => (options.client ?? client).get({
|
|
1836
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1837
|
+
url: "/admin/extraction/documents",
|
|
1838
|
+
...options
|
|
1839
|
+
});
|
|
1840
|
+
var getAdminAgentVersionRevisionsById = (options) => (options.client ?? client).get({
|
|
1841
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1842
|
+
url: "/admin/agent-version-revisions/{id}",
|
|
1843
|
+
...options
|
|
1844
|
+
});
|
|
1845
|
+
var getAdminAgentVersionRevisions = (options) => (options.client ?? client).get({
|
|
1846
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1847
|
+
url: "/admin/agent-version-revisions",
|
|
1848
|
+
...options
|
|
1849
|
+
});
|
|
1850
|
+
var postAdminDocumentsBulkDelete = (options) => (options.client ?? client).post({
|
|
1851
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1852
|
+
url: "/admin/documents/bulk-delete",
|
|
1853
|
+
...options,
|
|
1854
|
+
headers: {
|
|
1855
|
+
"Content-Type": "application/vnd.api+json",
|
|
1856
|
+
...options.headers
|
|
1857
|
+
}
|
|
1858
|
+
});
|
|
1859
|
+
var getAdminWebhookConfigs = (options) => (options.client ?? client).get({
|
|
1860
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1861
|
+
url: "/admin/webhook-configs",
|
|
1862
|
+
...options
|
|
1863
|
+
});
|
|
1864
|
+
var postAdminWebhookConfigs = (options) => (options.client ?? client).post({
|
|
1865
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1866
|
+
url: "/admin/webhook-configs",
|
|
1867
|
+
...options,
|
|
1868
|
+
headers: {
|
|
1869
|
+
"Content-Type": "application/vnd.api+json",
|
|
1870
|
+
...options.headers
|
|
1871
|
+
}
|
|
1872
|
+
});
|
|
1873
|
+
var deleteAdminTrainingSessionsById = (options) => (options.client ?? client).delete({
|
|
1874
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1875
|
+
url: "/admin/training-sessions/{id}",
|
|
1876
|
+
...options
|
|
1877
|
+
});
|
|
1878
|
+
var getAdminTrainingSessionsById = (options) => (options.client ?? client).get({
|
|
1879
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1880
|
+
url: "/admin/training-sessions/{id}",
|
|
1881
|
+
...options
|
|
1882
|
+
});
|
|
1883
|
+
var patchAdminUsersByIdAdmin = (options) => (options.client ?? client).patch({
|
|
1884
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1885
|
+
url: "/admin/users/{id}/admin",
|
|
1886
|
+
...options,
|
|
1887
|
+
headers: {
|
|
1888
|
+
"Content-Type": "application/vnd.api+json",
|
|
1889
|
+
...options.headers
|
|
1890
|
+
}
|
|
1891
|
+
});
|
|
1892
|
+
var getAdminAgentsByIdTrainingStats = (options) => (options.client ?? client).get({
|
|
1893
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1894
|
+
url: "/admin/agents/{id}/training-stats",
|
|
1895
|
+
...options
|
|
1896
|
+
});
|
|
1897
|
+
var postAdminAgentsByIdTest = (options) => (options.client ?? client).post({
|
|
1898
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1899
|
+
url: "/admin/agents/{id}/test",
|
|
1900
|
+
...options,
|
|
1901
|
+
headers: {
|
|
1902
|
+
"Content-Type": "application/vnd.api+json",
|
|
1903
|
+
...options.headers
|
|
1904
|
+
}
|
|
1905
|
+
});
|
|
1906
|
+
var patchAdminApiKeysByIdResetPeriod = (options) => (options.client ?? client).patch({
|
|
1907
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1908
|
+
url: "/admin/api-keys/{id}/reset-period",
|
|
1909
|
+
...options,
|
|
1910
|
+
headers: {
|
|
1911
|
+
"Content-Type": "application/vnd.api+json",
|
|
1912
|
+
...options.headers
|
|
1913
|
+
}
|
|
1914
|
+
});
|
|
1915
|
+
var getAdminVoiceTranscriptionResults = (options) => (options.client ?? client).get({
|
|
1916
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1917
|
+
url: "/admin/voice/transcription-results",
|
|
1918
|
+
...options
|
|
1919
|
+
});
|
|
1920
|
+
var postAdminAgentVersionsByIdRemoveSystemField = (options) => (options.client ?? client).post({
|
|
1921
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1922
|
+
url: "/admin/agent-versions/{id}/remove-system-field",
|
|
1923
|
+
...options,
|
|
1924
|
+
headers: {
|
|
1925
|
+
"Content-Type": "application/vnd.api+json",
|
|
1926
|
+
...options.headers
|
|
1927
|
+
}
|
|
1928
|
+
});
|
|
1929
|
+
var getAdminApiKeysStats = (options) => (options.client ?? client).get({
|
|
1930
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1931
|
+
url: "/admin/api-keys/stats",
|
|
1932
|
+
...options
|
|
1933
|
+
});
|
|
1934
|
+
var postAdminAgentsByIdTeach = (options) => (options.client ?? client).post({
|
|
1935
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1936
|
+
url: "/admin/agents/{id}/teach",
|
|
1937
|
+
...options,
|
|
1938
|
+
headers: {
|
|
1939
|
+
"Content-Type": "application/vnd.api+json",
|
|
1940
|
+
...options.headers
|
|
1941
|
+
}
|
|
1942
|
+
});
|
|
1943
|
+
var patchAdminAgentsByIdSchemaVersionsByVersionId = (options) => (options.client ?? client).patch({
|
|
1944
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1945
|
+
url: "/admin/agents/{id}/schema-versions/{version_id}",
|
|
1946
|
+
...options,
|
|
1947
|
+
headers: {
|
|
1948
|
+
"Content-Type": "application/vnd.api+json",
|
|
1949
|
+
...options.headers
|
|
1950
|
+
}
|
|
1951
|
+
});
|
|
1952
|
+
var getAdminVoiceRecordingsById = (options) => (options.client ?? client).get({
|
|
1953
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1954
|
+
url: "/admin/voice/recordings/{id}",
|
|
1955
|
+
...options
|
|
1956
|
+
});
|
|
1957
|
+
var patchAdminApiKeysByIdRevoke = (options) => (options.client ?? client).patch({
|
|
1958
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1959
|
+
url: "/admin/api-keys/{id}/revoke",
|
|
1960
|
+
...options,
|
|
1961
|
+
headers: {
|
|
1962
|
+
"Content-Type": "application/vnd.api+json",
|
|
1963
|
+
...options.headers
|
|
1964
|
+
}
|
|
1965
|
+
});
|
|
1966
|
+
var getAdminBuckets = (options) => (options.client ?? client).get({
|
|
1967
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1968
|
+
url: "/admin/buckets",
|
|
1969
|
+
...options
|
|
1970
|
+
});
|
|
1971
|
+
var getAdminAgentsByIdSchemaVersions = (options) => (options.client ?? client).get({
|
|
1972
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1973
|
+
url: "/admin/agents/{id}/schema-versions",
|
|
1974
|
+
...options
|
|
1975
|
+
});
|
|
1976
|
+
var postAdminAgentsByIdSchemaVersions = (options) => (options.client ?? client).post({
|
|
1977
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1978
|
+
url: "/admin/agents/{id}/schema-versions",
|
|
1979
|
+
...options,
|
|
1980
|
+
headers: {
|
|
1981
|
+
"Content-Type": "application/vnd.api+json",
|
|
1982
|
+
...options.headers
|
|
1983
|
+
}
|
|
1984
|
+
});
|
|
1985
|
+
var patchAdminApiKeysByIdRotate = (options) => (options.client ?? client).patch({
|
|
1986
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1987
|
+
url: "/admin/api-keys/{id}/rotate",
|
|
1988
|
+
...options,
|
|
1989
|
+
headers: {
|
|
1990
|
+
"Content-Type": "application/vnd.api+json",
|
|
1991
|
+
...options.headers
|
|
1992
|
+
}
|
|
1993
|
+
});
|
|
1994
|
+
var getAdminBucketsById = (options) => (options.client ?? client).get({
|
|
1995
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1996
|
+
url: "/admin/buckets/{id}",
|
|
1997
|
+
...options
|
|
1998
|
+
});
|
|
1999
|
+
var patchAdminUsersByIdResetPassword = (options) => (options.client ?? client).patch({
|
|
2000
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2001
|
+
url: "/admin/users/{id}/reset-password",
|
|
2002
|
+
...options,
|
|
2003
|
+
headers: {
|
|
2004
|
+
"Content-Type": "application/vnd.api+json",
|
|
2005
|
+
...options.headers
|
|
2006
|
+
}
|
|
2007
|
+
});
|
|
2008
|
+
var deleteAdminEmailOutboundEmailsById = (options) => (options.client ?? client).delete({
|
|
2009
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2010
|
+
url: "/admin/email/outbound-emails/{id}",
|
|
2011
|
+
...options
|
|
2012
|
+
});
|
|
2013
|
+
var getAdminEmailOutboundEmailsById = (options) => (options.client ?? client).get({
|
|
2014
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2015
|
+
url: "/admin/email/outbound-emails/{id}",
|
|
2016
|
+
...options
|
|
2017
|
+
});
|
|
2018
|
+
var getAdminTrainingExamples = (options) => (options.client ?? client).get({
|
|
2019
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2020
|
+
url: "/admin/training-examples",
|
|
2021
|
+
...options
|
|
2022
|
+
});
|
|
2023
|
+
var postAdminTrainingExamples = (options) => (options.client ?? client).post({
|
|
2024
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2025
|
+
url: "/admin/training-examples",
|
|
2026
|
+
...options,
|
|
2027
|
+
headers: {
|
|
2028
|
+
"Content-Type": "application/vnd.api+json",
|
|
2029
|
+
...options.headers
|
|
2030
|
+
}
|
|
2031
|
+
});
|
|
2032
|
+
var getAdminApiKeysActive = (options) => (options.client ?? client).get({
|
|
2033
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2034
|
+
url: "/admin/api-keys/active",
|
|
2035
|
+
...options
|
|
2036
|
+
});
|
|
2037
|
+
var postAdminAgentsByIdAnalyzeTraining = (options) => (options.client ?? client).post({
|
|
2038
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2039
|
+
url: "/admin/agents/{id}/analyze-training",
|
|
2040
|
+
...options
|
|
2041
|
+
});
|
|
2042
|
+
var postAdminTrainingExamplesBulk = (options) => (options.client ?? client).post({
|
|
2043
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2044
|
+
url: "/admin/training-examples/bulk",
|
|
2045
|
+
...options,
|
|
2046
|
+
headers: {
|
|
2047
|
+
"Content-Type": "application/vnd.api+json",
|
|
2048
|
+
...options.headers
|
|
2049
|
+
}
|
|
2050
|
+
});
|
|
2051
|
+
var postAdminAgentsByIdClone = (options) => (options.client ?? client).post({
|
|
2052
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2053
|
+
url: "/admin/agents/{id}/clone",
|
|
2054
|
+
...options,
|
|
2055
|
+
headers: {
|
|
2056
|
+
"Content-Type": "application/vnd.api+json",
|
|
2057
|
+
...options.headers
|
|
2058
|
+
}
|
|
2059
|
+
});
|
|
2060
|
+
var postAdminWebhookConfigsByIdTest = (options) => (options.client ?? client).post({
|
|
2061
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2062
|
+
url: "/admin/webhook-configs/{id}/test",
|
|
2063
|
+
...options,
|
|
2064
|
+
headers: {
|
|
2065
|
+
"Content-Type": "application/vnd.api+json",
|
|
2066
|
+
...options.headers
|
|
2067
|
+
}
|
|
2068
|
+
});
|
|
2069
|
+
var postAdminAgentVersionComparisons = (options) => (options.client ?? client).post({
|
|
2070
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2071
|
+
url: "/admin/agent-version-comparisons",
|
|
2072
|
+
...options,
|
|
2073
|
+
headers: {
|
|
2074
|
+
"Content-Type": "application/vnd.api+json",
|
|
2075
|
+
...options.headers
|
|
2076
|
+
}
|
|
2077
|
+
});
|
|
2078
|
+
var postAdminWebhookDeliveriesByIdRetry = (options) => (options.client ?? client).post({
|
|
2079
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2080
|
+
url: "/admin/webhook-deliveries/{id}/retry",
|
|
2081
|
+
...options,
|
|
2082
|
+
headers: {
|
|
2083
|
+
"Content-Type": "application/vnd.api+json",
|
|
2084
|
+
...options.headers
|
|
2085
|
+
}
|
|
2086
|
+
});
|
|
2087
|
+
var patchAdminEmailMarketingSenderProfilesByIdValidateDns = (options) => (options.client ?? client).patch({
|
|
2088
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2089
|
+
url: "/admin/email-marketing/sender-profiles/{id}/validate-dns",
|
|
2090
|
+
...options,
|
|
2091
|
+
headers: {
|
|
2092
|
+
"Content-Type": "application/vnd.api+json",
|
|
2093
|
+
...options.headers
|
|
2094
|
+
}
|
|
2095
|
+
});
|
|
2096
|
+
var getAdminAgentsUsage = (options) => (options.client ?? client).get({
|
|
2097
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2098
|
+
url: "/admin/agents/usage",
|
|
2099
|
+
...options
|
|
2100
|
+
});
|
|
2101
|
+
var postAdminAgentsByIdValidate = (options) => (options.client ?? client).post({
|
|
2102
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2103
|
+
url: "/admin/agents/{id}/validate",
|
|
2104
|
+
...options,
|
|
2105
|
+
headers: {
|
|
2106
|
+
"Content-Type": "application/vnd.api+json",
|
|
2107
|
+
...options.headers
|
|
2108
|
+
}
|
|
2109
|
+
});
|
|
2110
|
+
var postAdminEmailMarketingCampaignsByIdSend = (options) => (options.client ?? client).post({
|
|
2111
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2112
|
+
url: "/admin/email-marketing/campaigns/{id}/send",
|
|
2113
|
+
...options,
|
|
2114
|
+
headers: {
|
|
2115
|
+
"Content-Type": "application/vnd.api+json",
|
|
2116
|
+
...options.headers
|
|
2117
|
+
}
|
|
2118
|
+
});
|
|
2119
|
+
var postAdminEmailMarketingSenderProfiles = (options) => (options.client ?? client).post({
|
|
2120
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2121
|
+
url: "/admin/email-marketing/sender-profiles",
|
|
2122
|
+
...options,
|
|
2123
|
+
headers: {
|
|
2124
|
+
"Content-Type": "application/vnd.api+json",
|
|
2125
|
+
...options.headers
|
|
2126
|
+
}
|
|
2127
|
+
});
|
|
2128
|
+
var getAdminVoiceRecordings = (options) => (options.client ?? client).get({
|
|
2129
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2130
|
+
url: "/admin/voice/recordings",
|
|
2131
|
+
...options
|
|
2132
|
+
});
|
|
2133
|
+
|
|
2134
|
+
// src/namespaces/agents.ts
|
|
2135
|
+
function createAgentsNamespace(rb) {
|
|
2136
|
+
return {
|
|
2137
|
+
/**
|
|
2138
|
+
* Lists all agents (platform-wide, no workspace filter).
|
|
2139
|
+
*
|
|
2140
|
+
* @param options - Optional request options.
|
|
2141
|
+
* @returns Array of Agent objects.
|
|
2142
|
+
*
|
|
2143
|
+
* @example
|
|
2144
|
+
* const agents = await admin.agents.list();
|
|
2145
|
+
*/
|
|
2146
|
+
list: async (options) => {
|
|
2147
|
+
return rb.execute(getAdminAgents, {}, options);
|
|
2148
|
+
},
|
|
2149
|
+
/**
|
|
2150
|
+
* Fetches a single agent by ID.
|
|
2151
|
+
*
|
|
2152
|
+
* @param id - The UUID of the agent.
|
|
2153
|
+
* @param options - Optional request options.
|
|
2154
|
+
* @returns The Agent record.
|
|
2155
|
+
*
|
|
2156
|
+
* @example
|
|
2157
|
+
* const agent = await admin.agents.get('agt_01...');
|
|
2158
|
+
*/
|
|
2159
|
+
get: async (id, options) => {
|
|
2160
|
+
return rb.execute(getAdminAgentsById, { path: { id } }, options);
|
|
2161
|
+
},
|
|
2162
|
+
/**
|
|
2163
|
+
* Clones an agent within the same workspace.
|
|
2164
|
+
*
|
|
2165
|
+
* @param id - The UUID of the agent to clone.
|
|
2166
|
+
* @param attributes - Optional attributes for the clone (name, description).
|
|
2167
|
+
* @param options - Optional request options.
|
|
2168
|
+
* @returns The cloned Agent.
|
|
2169
|
+
*
|
|
2170
|
+
* @example
|
|
2171
|
+
* const clone = await admin.agents.clone('agt_01...', { name: 'Clone of Bot' });
|
|
2172
|
+
*/
|
|
2173
|
+
clone: async (id, attributes = {}, options) => {
|
|
2174
|
+
return rb.execute(
|
|
2175
|
+
postAdminAgentsByIdClone,
|
|
2176
|
+
{ path: { id }, body: { data: { type: "agent", attributes } } },
|
|
2177
|
+
options
|
|
2178
|
+
);
|
|
2179
|
+
},
|
|
2180
|
+
/**
|
|
2181
|
+
* Clones an agent into a different workspace.
|
|
2182
|
+
*
|
|
2183
|
+
* @param agentId - The UUID of the agent to clone.
|
|
2184
|
+
* @param targetWorkspaceId - The UUID of the destination workspace.
|
|
2185
|
+
* @param options - Optional request options.
|
|
2186
|
+
* @returns The cloned Agent in the target workspace.
|
|
2187
|
+
*
|
|
2188
|
+
* @example
|
|
2189
|
+
* const cloned = await admin.agents.cloneForWorkspace('agt_01...', 'ws_02...');
|
|
2190
|
+
*/
|
|
2191
|
+
cloneForWorkspace: async (agentId, targetWorkspaceId, options) => {
|
|
2192
|
+
return rb.execute(
|
|
2193
|
+
postAdminAgentsCloneForWorkspace,
|
|
2194
|
+
{
|
|
2195
|
+
body: {
|
|
2196
|
+
data: {
|
|
2197
|
+
type: "agent",
|
|
2198
|
+
attributes: {
|
|
2199
|
+
agent_id: agentId,
|
|
2200
|
+
target_workspace_id: targetWorkspaceId
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
},
|
|
2205
|
+
options
|
|
2206
|
+
);
|
|
2207
|
+
},
|
|
2208
|
+
/**
|
|
2209
|
+
* Exports an agent to a portable JSON bundle.
|
|
2210
|
+
*
|
|
2211
|
+
* @param id - The UUID of the agent to export.
|
|
2212
|
+
* @param options - Optional request options.
|
|
2213
|
+
* @returns The export bundle payload.
|
|
2214
|
+
*
|
|
2215
|
+
* @example
|
|
2216
|
+
* const bundle = await admin.agents.export('agt_01...');
|
|
2217
|
+
*/
|
|
2218
|
+
export: async (id, options) => {
|
|
2219
|
+
return rb.execute(
|
|
2220
|
+
postAdminAgentsByIdExport,
|
|
2221
|
+
{ path: { id }, body: {} },
|
|
2222
|
+
options
|
|
2223
|
+
);
|
|
2224
|
+
},
|
|
2225
|
+
/**
|
|
2226
|
+
* Imports an agent from a portable export bundle.
|
|
2227
|
+
*
|
|
2228
|
+
* @param data - The export bundle object.
|
|
2229
|
+
* @param options - Optional request options.
|
|
2230
|
+
* @returns The newly created Agent.
|
|
2231
|
+
*
|
|
2232
|
+
* @example
|
|
2233
|
+
* const imported = await admin.agents.import(exportBundle);
|
|
2234
|
+
*/
|
|
2235
|
+
import: async (data, options) => {
|
|
2236
|
+
return rb.execute(
|
|
2237
|
+
postAdminAgentsImport,
|
|
2238
|
+
{ body: { data: { type: "agent", attributes: { data } } } },
|
|
2239
|
+
options
|
|
2240
|
+
);
|
|
2241
|
+
},
|
|
2242
|
+
/**
|
|
2243
|
+
* Runs prediction/inference on an agent.
|
|
2244
|
+
*
|
|
2245
|
+
* @param agentId - The UUID of the agent.
|
|
2246
|
+
* @param input - Input data for prediction.
|
|
2247
|
+
* @param options - Optional request options.
|
|
2248
|
+
* @returns Prediction result.
|
|
2249
|
+
*
|
|
2250
|
+
* @example
|
|
2251
|
+
* const result = await admin.agents.predict('agt_01...', { text: 'Classify this' });
|
|
2252
|
+
*/
|
|
2253
|
+
predict: async (agentId, input, options) => {
|
|
2254
|
+
return rb.execute(
|
|
2255
|
+
postAdminAgentsPredict,
|
|
2256
|
+
{
|
|
2257
|
+
body: {
|
|
2258
|
+
data: {
|
|
2259
|
+
type: "agent",
|
|
2260
|
+
attributes: { agent_id: agentId, ...input }
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
2263
|
+
},
|
|
2264
|
+
options
|
|
2265
|
+
);
|
|
2266
|
+
},
|
|
2267
|
+
/**
|
|
2268
|
+
* Runs an agent against a test input and returns the result.
|
|
2269
|
+
*
|
|
2270
|
+
* @param id - The UUID of the agent.
|
|
2271
|
+
* @param attributes - Test attributes (input, expected_output, etc.).
|
|
2272
|
+
* @param options - Optional request options.
|
|
2273
|
+
* @returns Test result payload.
|
|
2274
|
+
*
|
|
2275
|
+
* @example
|
|
2276
|
+
* const result = await admin.agents.test('agt_01...', { input: { text: '...' } });
|
|
2277
|
+
*/
|
|
2278
|
+
test: async (id, attributes, options) => {
|
|
2279
|
+
return rb.execute(
|
|
2280
|
+
postAdminAgentsByIdTest,
|
|
2281
|
+
{ path: { id }, body: { data: { type: "agent", attributes } } },
|
|
2282
|
+
options
|
|
2283
|
+
);
|
|
2284
|
+
},
|
|
2285
|
+
/**
|
|
2286
|
+
* Validates an agent's configuration without publishing.
|
|
2287
|
+
*
|
|
2288
|
+
* @param id - The UUID of the agent.
|
|
2289
|
+
* @param options - Optional request options.
|
|
2290
|
+
* @returns Validation result with any errors or warnings.
|
|
2291
|
+
*
|
|
2292
|
+
* @example
|
|
2293
|
+
* const result = await admin.agents.validate('agt_01...');
|
|
2294
|
+
*/
|
|
2295
|
+
validate: async (id, options) => {
|
|
2296
|
+
return rb.execute(
|
|
2297
|
+
postAdminAgentsByIdValidate,
|
|
2298
|
+
{ path: { id }, body: {} },
|
|
2299
|
+
options
|
|
2300
|
+
);
|
|
2301
|
+
},
|
|
2302
|
+
/**
|
|
2303
|
+
* Runs a training job (fine-tuning) on the agent using its examples.
|
|
2304
|
+
*
|
|
2305
|
+
* @param id - The UUID of the agent.
|
|
2306
|
+
* @param attributes - Training configuration attributes.
|
|
2307
|
+
* @param options - Optional request options.
|
|
2308
|
+
* @returns Training job status payload.
|
|
2309
|
+
*
|
|
2310
|
+
* @example
|
|
2311
|
+
* await admin.agents.teach('agt_01...', { epochs: 3 });
|
|
2312
|
+
*/
|
|
2313
|
+
teach: async (id, attributes = {}, options) => {
|
|
2314
|
+
return rb.execute(
|
|
2315
|
+
postAdminAgentsByIdTeach,
|
|
2316
|
+
{ path: { id }, body: { data: { type: "agent", attributes } } },
|
|
2317
|
+
options
|
|
2318
|
+
);
|
|
2319
|
+
},
|
|
2320
|
+
/**
|
|
2321
|
+
* Publishes a new immutable version from the agent's current state.
|
|
2322
|
+
*
|
|
2323
|
+
* @param id - The UUID of the agent.
|
|
2324
|
+
* @param options - Optional request options.
|
|
2325
|
+
* @returns The newly created AgentVersion.
|
|
2326
|
+
*
|
|
2327
|
+
* @example
|
|
2328
|
+
* const version = await admin.agents.publishVersion('agt_01...');
|
|
2329
|
+
*/
|
|
2330
|
+
publishVersion: async (id, options) => {
|
|
2331
|
+
return rb.execute(
|
|
2332
|
+
postAdminAgentsByIdPublishVersion,
|
|
2333
|
+
{ path: { id }, body: {} },
|
|
2334
|
+
options
|
|
2335
|
+
);
|
|
2336
|
+
},
|
|
2337
|
+
/**
|
|
2338
|
+
* Restores a previously published version as the active version.
|
|
2339
|
+
*
|
|
2340
|
+
* @param id - The UUID of the agent.
|
|
2341
|
+
* @param attributes - Must include `version_id` of the version to restore.
|
|
2342
|
+
* @param options - Optional request options.
|
|
2343
|
+
* @returns The restored AgentVersion.
|
|
2344
|
+
*
|
|
2345
|
+
* @example
|
|
2346
|
+
* const version = await admin.agents.restoreVersion('agt_01...', { version_id: 'ver_01...' });
|
|
2347
|
+
*/
|
|
2348
|
+
restoreVersion: async (id, attributes, options) => {
|
|
2349
|
+
return rb.execute(
|
|
2350
|
+
postAdminAgentsByIdRestoreVersion,
|
|
2351
|
+
{ path: { id }, body: { data: { type: "agent", attributes } } },
|
|
2352
|
+
options
|
|
2353
|
+
);
|
|
2354
|
+
},
|
|
2355
|
+
/**
|
|
2356
|
+
* Analyzes training examples and returns insights.
|
|
2357
|
+
*
|
|
2358
|
+
* @param id - The UUID of the agent.
|
|
2359
|
+
* @param options - Optional request options.
|
|
2360
|
+
* @returns Training analysis result.
|
|
2361
|
+
*
|
|
2362
|
+
* @example
|
|
2363
|
+
* const analysis = await admin.agents.analyzeTraining('agt_01...');
|
|
2364
|
+
*/
|
|
2365
|
+
analyzeTraining: async (id, options) => {
|
|
2366
|
+
return rb.execute(
|
|
2367
|
+
postAdminAgentsByIdAnalyzeTraining,
|
|
2368
|
+
{ path: { id }, body: {} },
|
|
2369
|
+
options
|
|
2370
|
+
);
|
|
2371
|
+
},
|
|
2372
|
+
/**
|
|
2373
|
+
* Retrieves usage statistics for a single agent.
|
|
2374
|
+
*
|
|
2375
|
+
* @param id - The UUID of the agent.
|
|
2376
|
+
* @param options - Optional request options.
|
|
2377
|
+
* @returns Usage data for the agent.
|
|
2378
|
+
*
|
|
2379
|
+
* @example
|
|
2380
|
+
* const usage = await admin.agents.usage('agt_01...');
|
|
2381
|
+
*/
|
|
2382
|
+
usage: async (id, options) => {
|
|
2383
|
+
return rb.execute(
|
|
2384
|
+
getAdminAgentsByIdUsage,
|
|
2385
|
+
{ path: { id } },
|
|
2386
|
+
options
|
|
2387
|
+
);
|
|
2388
|
+
},
|
|
2389
|
+
/**
|
|
2390
|
+
* Retrieves usage information for all agents.
|
|
2391
|
+
*
|
|
2392
|
+
* @param options - Optional request options.
|
|
2393
|
+
* @returns Array of usage data for all agents.
|
|
2394
|
+
*
|
|
2395
|
+
* @example
|
|
2396
|
+
* const allUsage = await admin.agents.usageAll();
|
|
2397
|
+
*/
|
|
2398
|
+
usageAll: async (options) => {
|
|
2399
|
+
return rb.execute(
|
|
2400
|
+
getAdminAgentsUsage,
|
|
2401
|
+
{},
|
|
2402
|
+
options
|
|
2403
|
+
);
|
|
2404
|
+
},
|
|
2405
|
+
/**
|
|
2406
|
+
* Retrieves execution and performance statistics for an agent.
|
|
2407
|
+
*
|
|
2408
|
+
* @param id - The UUID of the agent.
|
|
2409
|
+
* @param options - Optional request options.
|
|
2410
|
+
* @returns Statistics payload.
|
|
2411
|
+
*
|
|
2412
|
+
* @example
|
|
2413
|
+
* const stats = await admin.agents.stats('agt_01...');
|
|
2414
|
+
*/
|
|
2415
|
+
stats: async (id, options) => {
|
|
2416
|
+
return rb.execute(
|
|
2417
|
+
getAdminAgentsByIdStats,
|
|
2418
|
+
{ path: { id } },
|
|
2419
|
+
options
|
|
2420
|
+
);
|
|
2421
|
+
},
|
|
2422
|
+
/**
|
|
2423
|
+
* Retrieves training statistics for a single agent.
|
|
2424
|
+
*
|
|
2425
|
+
* @param id - The UUID of the agent.
|
|
2426
|
+
* @param options - Optional request options.
|
|
2427
|
+
* @returns Training statistics data.
|
|
2428
|
+
*
|
|
2429
|
+
* @example
|
|
2430
|
+
* const stats = await admin.agents.trainingStats('agt_01...');
|
|
2431
|
+
*/
|
|
2432
|
+
trainingStats: async (id, options) => {
|
|
2433
|
+
return rb.execute(
|
|
2434
|
+
getAdminAgentsByIdTrainingStats,
|
|
2435
|
+
{ path: { id } },
|
|
2436
|
+
options
|
|
2437
|
+
);
|
|
2438
|
+
},
|
|
2439
|
+
/**
|
|
2440
|
+
* Sub-namespace for managing immutable agent versions.
|
|
2441
|
+
*/
|
|
2442
|
+
versions: {
|
|
2443
|
+
/**
|
|
2444
|
+
* Lists all agent versions.
|
|
2445
|
+
*
|
|
2446
|
+
* @param options - Optional request options.
|
|
2447
|
+
* @returns Array of AgentVersion objects.
|
|
2448
|
+
*
|
|
2449
|
+
* @example
|
|
2450
|
+
* const versions = await admin.agents.versions.list();
|
|
2451
|
+
*/
|
|
2452
|
+
list: async (options) => {
|
|
2453
|
+
return rb.execute(getAdminAgentVersions, {}, options);
|
|
2454
|
+
},
|
|
2455
|
+
/**
|
|
2456
|
+
* Fetches a single agent version by ID.
|
|
2457
|
+
*
|
|
2458
|
+
* @param id - The UUID of the agent version.
|
|
2459
|
+
* @param options - Optional request options.
|
|
2460
|
+
* @returns The AgentVersion record.
|
|
2461
|
+
*
|
|
2462
|
+
* @example
|
|
2463
|
+
* const version = await admin.agents.versions.get('ver_01...');
|
|
2464
|
+
*/
|
|
2465
|
+
get: async (id, options) => {
|
|
2466
|
+
return rb.execute(
|
|
2467
|
+
getAdminAgentVersionsById,
|
|
2468
|
+
{ path: { id } },
|
|
2469
|
+
options
|
|
2470
|
+
);
|
|
2471
|
+
},
|
|
2472
|
+
/**
|
|
2473
|
+
* Permanently deletes an agent version.
|
|
2474
|
+
*
|
|
2475
|
+
* @param id - The UUID of the version to delete.
|
|
2476
|
+
* @param options - Optional request options.
|
|
2477
|
+
* @returns True on successful deletion.
|
|
2478
|
+
*
|
|
2479
|
+
* @example
|
|
2480
|
+
* await admin.agents.versions.delete('ver_01...');
|
|
2481
|
+
*/
|
|
2482
|
+
delete: async (id, options) => {
|
|
2483
|
+
return rb.executeDelete(
|
|
2484
|
+
deleteAdminAgentVersionsById,
|
|
2485
|
+
{ path: { id } },
|
|
2486
|
+
options
|
|
2487
|
+
);
|
|
2488
|
+
},
|
|
2489
|
+
/**
|
|
2490
|
+
* Creates a new agent version snapshot.
|
|
2491
|
+
*
|
|
2492
|
+
* @param attributes - Version attributes (agent_id, prompt_template, fields, etc.).
|
|
2493
|
+
* @param options - Optional request options.
|
|
2494
|
+
* @returns The newly created AgentVersion.
|
|
2495
|
+
*
|
|
2496
|
+
* @example
|
|
2497
|
+
* const version = await admin.agents.versions.create({ agent_id: 'agt_01...', ... });
|
|
2498
|
+
*/
|
|
2499
|
+
create: async (attributes, options) => {
|
|
2500
|
+
return rb.execute(
|
|
2501
|
+
postAdminAgentVersions,
|
|
2502
|
+
{ body: { data: { type: "agent_version", attributes } } },
|
|
2503
|
+
options
|
|
2504
|
+
);
|
|
2505
|
+
},
|
|
2506
|
+
/**
|
|
2507
|
+
* Marks a system field as selected for this version.
|
|
2508
|
+
*
|
|
2509
|
+
* @param id - The UUID of the agent version.
|
|
2510
|
+
* @param fieldName - The name of the system field to add (e.g. `_filename`).
|
|
2511
|
+
* @param options - Optional request options.
|
|
2512
|
+
* @returns The updated AgentVersion.
|
|
2513
|
+
*
|
|
2514
|
+
* @example
|
|
2515
|
+
* await admin.agents.versions.addSystemField('ver_01...', '_filename');
|
|
2516
|
+
*/
|
|
2517
|
+
addSystemField: async (id, fieldName, options) => {
|
|
2518
|
+
return rb.execute(
|
|
2519
|
+
postAdminAgentVersionsByIdAddSystemField,
|
|
2520
|
+
{
|
|
2521
|
+
path: { id },
|
|
2522
|
+
body: {
|
|
2523
|
+
data: {
|
|
2524
|
+
type: "agent_version",
|
|
2525
|
+
attributes: { system_field_name: fieldName }
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
},
|
|
2529
|
+
options
|
|
2530
|
+
);
|
|
2531
|
+
},
|
|
2532
|
+
/**
|
|
2533
|
+
* Removes a system field from the selected set for this version.
|
|
2534
|
+
*
|
|
2535
|
+
* @param id - The UUID of the agent version.
|
|
2536
|
+
* @param fieldName - The name of the system field to remove (e.g. `_filename`).
|
|
2537
|
+
* @param options - Optional request options.
|
|
2538
|
+
* @returns The updated AgentVersion.
|
|
2539
|
+
*
|
|
2540
|
+
* @example
|
|
2541
|
+
* await admin.agents.versions.removeSystemField('ver_01...', '_filename');
|
|
2542
|
+
*/
|
|
2543
|
+
removeSystemField: async (id, fieldName, options) => {
|
|
2544
|
+
return rb.execute(
|
|
2545
|
+
postAdminAgentVersionsByIdRemoveSystemField,
|
|
2546
|
+
{
|
|
2547
|
+
path: { id },
|
|
2548
|
+
body: {
|
|
2549
|
+
data: {
|
|
2550
|
+
type: "agent_version",
|
|
2551
|
+
attributes: { system_field_name: fieldName }
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
},
|
|
2555
|
+
options
|
|
2556
|
+
);
|
|
2557
|
+
},
|
|
2558
|
+
/**
|
|
2559
|
+
* Sets the full list of selected system fields for this version.
|
|
2560
|
+
*
|
|
2561
|
+
* @param id - The UUID of the agent version.
|
|
2562
|
+
* @param fieldNames - Array of system field names to set (e.g. `['_filename', '_pages']`).
|
|
2563
|
+
* @param options - Optional request options.
|
|
2564
|
+
* @returns The updated AgentVersion.
|
|
2565
|
+
*
|
|
2566
|
+
* @example
|
|
2567
|
+
* await admin.agents.versions.setSystemFields('ver_01...', ['_filename', '_pages']);
|
|
2568
|
+
*/
|
|
2569
|
+
setSystemFields: async (id, fieldNames, options) => {
|
|
2570
|
+
return rb.execute(
|
|
2571
|
+
postAdminAgentVersionsByIdSetSystemFields,
|
|
2572
|
+
{
|
|
2573
|
+
path: { id },
|
|
2574
|
+
body: {
|
|
2575
|
+
data: {
|
|
2576
|
+
type: "agent_version",
|
|
2577
|
+
attributes: { system_field_names: fieldNames }
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
},
|
|
2581
|
+
options
|
|
2582
|
+
);
|
|
2583
|
+
},
|
|
2584
|
+
/**
|
|
2585
|
+
* Retrieves performance metrics for an agent version.
|
|
2586
|
+
*
|
|
2587
|
+
* @param id - The UUID of the agent version.
|
|
2588
|
+
* @param options - Optional request options.
|
|
2589
|
+
* @returns Metrics data for the version.
|
|
2590
|
+
*
|
|
2591
|
+
* @example
|
|
2592
|
+
* const metrics = await admin.agents.versions.metrics('ver_01...');
|
|
2593
|
+
*/
|
|
2594
|
+
metrics: async (id, options) => {
|
|
2595
|
+
return rb.execute(
|
|
2596
|
+
getAdminAgentVersionsByIdMetrics,
|
|
2597
|
+
{ path: { id } },
|
|
2598
|
+
options
|
|
2599
|
+
);
|
|
2600
|
+
},
|
|
2601
|
+
/**
|
|
2602
|
+
* Lists revision history for an agent version.
|
|
2603
|
+
*
|
|
2604
|
+
* @param id - The UUID of the agent version.
|
|
2605
|
+
* @param options - Optional request options.
|
|
2606
|
+
* @returns Array of revision records.
|
|
2607
|
+
*
|
|
2608
|
+
* @example
|
|
2609
|
+
* const revisions = await admin.agents.versions.revisions('ver_01...');
|
|
2610
|
+
*/
|
|
2611
|
+
revisions: async (id, options) => {
|
|
2612
|
+
return rb.execute(
|
|
2613
|
+
getAdminAgentVersionsByIdRevisions,
|
|
2614
|
+
{ path: { id } },
|
|
2615
|
+
options
|
|
2616
|
+
);
|
|
2617
|
+
},
|
|
2618
|
+
/**
|
|
2619
|
+
* Fetches a single revision record by ID.
|
|
2620
|
+
*
|
|
2621
|
+
* @param id - The UUID of the revision.
|
|
2622
|
+
* @param options - Optional request options.
|
|
2623
|
+
* @returns The revision record.
|
|
2624
|
+
*
|
|
2625
|
+
* @example
|
|
2626
|
+
* const revision = await admin.agents.versions.getRevision('rev_01...');
|
|
2627
|
+
*/
|
|
2628
|
+
getRevision: async (id, options) => {
|
|
2629
|
+
return rb.execute(
|
|
2630
|
+
getAdminAgentVersionRevisionsById,
|
|
2631
|
+
{ path: { id } },
|
|
2632
|
+
options
|
|
2633
|
+
);
|
|
2634
|
+
},
|
|
2635
|
+
/**
|
|
2636
|
+
* Lists all revisions across all agent versions.
|
|
2637
|
+
*
|
|
2638
|
+
* @param options - Optional request options.
|
|
2639
|
+
* @returns Array of revision records.
|
|
2640
|
+
*
|
|
2641
|
+
* @example
|
|
2642
|
+
* const revisions = await admin.agents.versions.listAllRevisions();
|
|
2643
|
+
*/
|
|
2644
|
+
listAllRevisions: async (options) => {
|
|
2645
|
+
return rb.execute(
|
|
2646
|
+
getAdminAgentVersionRevisions,
|
|
2647
|
+
{},
|
|
2648
|
+
options
|
|
2649
|
+
);
|
|
2650
|
+
},
|
|
2651
|
+
/**
|
|
2652
|
+
* Compares two agent versions side-by-side.
|
|
2653
|
+
*
|
|
2654
|
+
* @param versionAId - UUID of the first version.
|
|
2655
|
+
* @param versionBId - UUID of the second version.
|
|
2656
|
+
* @param options - Optional request options.
|
|
2657
|
+
* @returns Comparison result with schema_diff and prompt_diff.
|
|
2658
|
+
*
|
|
2659
|
+
* @example
|
|
2660
|
+
* const diff = await admin.agents.versions.compare('ver_A...', 'ver_B...');
|
|
2661
|
+
*/
|
|
2662
|
+
compare: async (versionAId, versionBId, options) => {
|
|
2663
|
+
return rb.execute(
|
|
2664
|
+
postAdminAgentVersionComparisons,
|
|
2665
|
+
{
|
|
2666
|
+
body: {
|
|
2667
|
+
data: {
|
|
2668
|
+
type: "agent_version_comparison",
|
|
2669
|
+
attributes: {
|
|
2670
|
+
version_a_id: versionAId,
|
|
2671
|
+
version_b_id: versionBId
|
|
2672
|
+
}
|
|
2673
|
+
}
|
|
2674
|
+
}
|
|
2675
|
+
},
|
|
2676
|
+
options
|
|
2677
|
+
);
|
|
2678
|
+
},
|
|
2679
|
+
/**
|
|
2680
|
+
* Sub-namespace for managing schema versions within an agent.
|
|
2681
|
+
*/
|
|
2682
|
+
schemaVersions: {
|
|
2683
|
+
/**
|
|
2684
|
+
* Lists all schema versions for an agent.
|
|
2685
|
+
*
|
|
2686
|
+
* @param agentId - The UUID of the agent.
|
|
2687
|
+
* @param options - Optional request options.
|
|
2688
|
+
* @returns Array of schema version records.
|
|
2689
|
+
*
|
|
2690
|
+
* @example
|
|
2691
|
+
* const versions = await admin.agents.versions.schemaVersions.list('agt_01...');
|
|
2692
|
+
*/
|
|
2693
|
+
list: async (agentId, options) => {
|
|
2694
|
+
return rb.execute(
|
|
2695
|
+
getAdminAgentsByIdSchemaVersions,
|
|
2696
|
+
{ path: { id: agentId } },
|
|
2697
|
+
options
|
|
2698
|
+
);
|
|
2699
|
+
},
|
|
2700
|
+
/**
|
|
2701
|
+
* Creates a new schema version for an agent.
|
|
2702
|
+
*
|
|
2703
|
+
* @param agentId - The UUID of the agent.
|
|
2704
|
+
* @param attributes - Schema version attributes.
|
|
2705
|
+
* @param options - Optional request options.
|
|
2706
|
+
* @returns The newly created schema version.
|
|
2707
|
+
*
|
|
2708
|
+
* @example
|
|
2709
|
+
* const sv = await admin.agents.versions.schemaVersions.create('agt_01...', { fields: [...] });
|
|
2710
|
+
*/
|
|
2711
|
+
create: async (agentId, attributes, options) => {
|
|
2712
|
+
return rb.execute(
|
|
2713
|
+
postAdminAgentsByIdSchemaVersions,
|
|
2714
|
+
{
|
|
2715
|
+
path: { id: agentId },
|
|
2716
|
+
body: { data: { type: "agent_version", attributes } }
|
|
2717
|
+
},
|
|
2718
|
+
options
|
|
2719
|
+
);
|
|
2720
|
+
},
|
|
2721
|
+
/**
|
|
2722
|
+
* Activates a schema version, making it the live version.
|
|
2723
|
+
*
|
|
2724
|
+
* @param agentId - The UUID of the agent.
|
|
2725
|
+
* @param versionId - The UUID of the schema version to activate.
|
|
2726
|
+
* @param options - Optional request options.
|
|
2727
|
+
* @returns The activated schema version.
|
|
2728
|
+
*
|
|
2729
|
+
* @example
|
|
2730
|
+
* await admin.agents.versions.schemaVersions.activate('agt_01...', 'ver_01...');
|
|
2731
|
+
*/
|
|
2732
|
+
activate: async (agentId, versionId, options) => {
|
|
2733
|
+
return rb.execute(
|
|
2734
|
+
postAdminAgentsByIdSchemaVersionsByVersionIdActivate,
|
|
2735
|
+
{ path: { id: agentId, version_id: versionId }, body: {} },
|
|
2736
|
+
options
|
|
2737
|
+
);
|
|
2738
|
+
},
|
|
2739
|
+
/**
|
|
2740
|
+
* Updates an existing schema version.
|
|
2741
|
+
*
|
|
2742
|
+
* @param agentId - The UUID of the agent.
|
|
2743
|
+
* @param versionId - The UUID of the schema version to update.
|
|
2744
|
+
* @param attributes - Attributes to update.
|
|
2745
|
+
* @param options - Optional request options.
|
|
2746
|
+
* @returns The updated schema version.
|
|
2747
|
+
*
|
|
2748
|
+
* @example
|
|
2749
|
+
* await admin.agents.versions.schemaVersions.update('agt_01...', 'ver_01...', { fields: [...] });
|
|
2750
|
+
*/
|
|
2751
|
+
update: async (agentId, versionId, attributes, options) => {
|
|
2752
|
+
return rb.execute(
|
|
2753
|
+
patchAdminAgentsByIdSchemaVersionsByVersionId,
|
|
2754
|
+
{
|
|
2755
|
+
path: { id: agentId, version_id: versionId },
|
|
2756
|
+
body: { data: { type: "agent_version", attributes } }
|
|
2757
|
+
},
|
|
2758
|
+
options
|
|
2759
|
+
);
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
},
|
|
2763
|
+
/**
|
|
2764
|
+
* Sub-namespace for managing training examples attached to agents.
|
|
2765
|
+
*/
|
|
2766
|
+
training: {
|
|
2767
|
+
/**
|
|
2768
|
+
* Lists all training examples.
|
|
2769
|
+
*
|
|
2770
|
+
* @param options - Optional request options.
|
|
2771
|
+
* @returns Array of TrainingExample objects.
|
|
2772
|
+
*
|
|
2773
|
+
* @example
|
|
2774
|
+
* const examples = await admin.agents.training.list();
|
|
2775
|
+
*/
|
|
2776
|
+
list: async (options) => {
|
|
2777
|
+
return rb.execute(
|
|
2778
|
+
getAdminTrainingExamples,
|
|
2779
|
+
{},
|
|
2780
|
+
options
|
|
2781
|
+
);
|
|
2782
|
+
},
|
|
2783
|
+
/**
|
|
2784
|
+
* Fetches a single training example by ID.
|
|
2785
|
+
*
|
|
2786
|
+
* @param id - The UUID of the training example.
|
|
2787
|
+
* @param options - Optional request options.
|
|
2788
|
+
* @returns The TrainingExample record.
|
|
2789
|
+
*
|
|
2790
|
+
* @example
|
|
2791
|
+
* const example = await admin.agents.training.get('tex_01...');
|
|
2792
|
+
*/
|
|
2793
|
+
get: async (id, options) => {
|
|
2794
|
+
return rb.execute(
|
|
2795
|
+
getAdminTrainingExamplesById,
|
|
2796
|
+
{ path: { id } },
|
|
2797
|
+
options
|
|
2798
|
+
);
|
|
2799
|
+
},
|
|
2800
|
+
/**
|
|
2801
|
+
* Creates a new training example.
|
|
2802
|
+
*
|
|
2803
|
+
* @param attributes - Training example attributes (agent_id, input_text, output_json, etc.).
|
|
2804
|
+
* @param options - Optional request options.
|
|
2805
|
+
* @returns The created TrainingExample.
|
|
2806
|
+
*
|
|
2807
|
+
* @example
|
|
2808
|
+
* const example = await admin.agents.training.create({ agent_id: 'agt_01...', input_text: '...', output_json: {} });
|
|
2809
|
+
*/
|
|
2810
|
+
create: async (attributes, options) => {
|
|
2811
|
+
return rb.execute(
|
|
2812
|
+
postAdminTrainingExamples,
|
|
2813
|
+
{ body: { data: { type: "training_example", attributes } } },
|
|
2814
|
+
options
|
|
2815
|
+
);
|
|
2816
|
+
},
|
|
2817
|
+
/**
|
|
2818
|
+
* Updates a training example's attributes.
|
|
2819
|
+
*
|
|
2820
|
+
* @param id - The UUID of the training example.
|
|
2821
|
+
* @param attributes - Attributes to update.
|
|
2822
|
+
* @param options - Optional request options.
|
|
2823
|
+
* @returns The updated TrainingExample.
|
|
2824
|
+
*
|
|
2825
|
+
* @example
|
|
2826
|
+
* const updated = await admin.agents.training.update('tex_01...', { label: 'reviewed' });
|
|
2827
|
+
*/
|
|
2828
|
+
update: async (id, attributes, options) => {
|
|
2829
|
+
return rb.execute(
|
|
2830
|
+
patchAdminTrainingExamplesById,
|
|
2831
|
+
{
|
|
2832
|
+
path: { id },
|
|
2833
|
+
body: { data: { id, type: "training_example", attributes } }
|
|
2834
|
+
},
|
|
2835
|
+
options
|
|
2836
|
+
);
|
|
2837
|
+
},
|
|
2838
|
+
/**
|
|
2839
|
+
* Deletes a training example.
|
|
2840
|
+
*
|
|
2841
|
+
* @param id - The UUID of the training example to delete.
|
|
2842
|
+
* @param options - Optional request options.
|
|
2843
|
+
* @returns True on successful deletion.
|
|
2844
|
+
*
|
|
2845
|
+
* @example
|
|
2846
|
+
* await admin.agents.training.delete('tex_01...');
|
|
2847
|
+
*/
|
|
2848
|
+
delete: async (id, options) => {
|
|
2849
|
+
return rb.executeDelete(
|
|
2850
|
+
deleteAdminTrainingExamplesById,
|
|
2851
|
+
{ path: { id } },
|
|
2852
|
+
options
|
|
2853
|
+
);
|
|
2854
|
+
},
|
|
2855
|
+
/**
|
|
2856
|
+
* Creates multiple training examples in a single batch operation.
|
|
2857
|
+
*
|
|
2858
|
+
* @param examples - Array of training example attribute objects.
|
|
2859
|
+
* @param options - Optional request options.
|
|
2860
|
+
* @returns Array of created TrainingExample objects.
|
|
2861
|
+
*
|
|
2862
|
+
* @example
|
|
2863
|
+
* const created = await admin.agents.training.bulkCreate([
|
|
2864
|
+
* { agent_id: 'agt_01...', input_text: '...', output_json: {} },
|
|
2865
|
+
* ]);
|
|
2866
|
+
*/
|
|
2867
|
+
bulkCreate: async (examples, options) => {
|
|
2868
|
+
return rb.execute(
|
|
2869
|
+
postAdminTrainingExamplesBulk,
|
|
2870
|
+
{
|
|
2871
|
+
body: {
|
|
2872
|
+
data: examples.map((attrs) => ({
|
|
2873
|
+
type: "training_example",
|
|
2874
|
+
attributes: attrs
|
|
2875
|
+
}))
|
|
2876
|
+
}
|
|
2877
|
+
},
|
|
2878
|
+
options
|
|
2879
|
+
);
|
|
2880
|
+
},
|
|
2881
|
+
/**
|
|
2882
|
+
* Deletes multiple training examples in a single batch operation.
|
|
2883
|
+
*
|
|
2884
|
+
* @param ids - Array of training example UUIDs to delete.
|
|
2885
|
+
* @param options - Optional request options.
|
|
2886
|
+
* @returns Deletion result payload.
|
|
2887
|
+
*
|
|
2888
|
+
* @example
|
|
2889
|
+
* await admin.agents.training.bulkDelete(['tex_01...', 'tex_02...']);
|
|
2890
|
+
*/
|
|
2891
|
+
bulkDelete: async (ids, options) => {
|
|
2892
|
+
return rb.execute(
|
|
2893
|
+
postAdminTrainingExamplesBulkDelete,
|
|
2894
|
+
{
|
|
2895
|
+
body: { data: ids.map((id) => ({ type: "training_example", id })) }
|
|
2896
|
+
},
|
|
2897
|
+
options
|
|
2898
|
+
);
|
|
2899
|
+
},
|
|
2900
|
+
/**
|
|
2901
|
+
* Searches training examples by semantic similarity.
|
|
2902
|
+
*
|
|
2903
|
+
* @param query - The search query text.
|
|
2904
|
+
* @param options - Optional request options.
|
|
2905
|
+
* @returns Array of matching TrainingExample objects.
|
|
2906
|
+
*
|
|
2907
|
+
* @example
|
|
2908
|
+
* const results = await admin.agents.training.search('invoice total');
|
|
2909
|
+
*/
|
|
2910
|
+
search: async (query, options) => {
|
|
2911
|
+
return rb.execute(
|
|
2912
|
+
postAdminTrainingExamplesSearch,
|
|
2913
|
+
{
|
|
2914
|
+
body: {
|
|
2915
|
+
data: { type: "training_example", attributes: { query } }
|
|
2916
|
+
}
|
|
2917
|
+
},
|
|
2918
|
+
options
|
|
2919
|
+
);
|
|
2920
|
+
},
|
|
2921
|
+
/**
|
|
2922
|
+
* Lists training examples for a specific agent.
|
|
2923
|
+
*
|
|
2924
|
+
* @param agentId - The UUID of the agent.
|
|
2925
|
+
* @param options - Optional request options.
|
|
2926
|
+
* @returns Array of training examples for the agent.
|
|
2927
|
+
*
|
|
2928
|
+
* @example
|
|
2929
|
+
* const examples = await admin.agents.training.listForAgent('agt_01...');
|
|
2930
|
+
*/
|
|
2931
|
+
listForAgent: async (agentId, options) => {
|
|
2932
|
+
return rb.execute(
|
|
2933
|
+
getAdminAgentsByIdTrainingExamples,
|
|
2934
|
+
{ path: { id: agentId } },
|
|
2935
|
+
options
|
|
2936
|
+
);
|
|
2937
|
+
},
|
|
2938
|
+
/**
|
|
2939
|
+
* Deletes a training example for a specific agent.
|
|
2940
|
+
*
|
|
2941
|
+
* @param agentId - The UUID of the agent.
|
|
2942
|
+
* @param exampleId - The UUID of the training example.
|
|
2943
|
+
* @param options - Optional request options.
|
|
2944
|
+
* @returns True on successful deletion.
|
|
2945
|
+
*
|
|
2946
|
+
* @example
|
|
2947
|
+
* await admin.agents.training.deleteForAgent('agt_01...', 'tex_01...');
|
|
2948
|
+
*/
|
|
2949
|
+
deleteForAgent: async (agentId, exampleId, options) => {
|
|
2950
|
+
return rb.executeDelete(
|
|
2951
|
+
deleteAdminAgentsByIdTrainingExamplesByExampleId,
|
|
2952
|
+
{ path: { id: agentId, example_id: exampleId } },
|
|
2953
|
+
options
|
|
2954
|
+
);
|
|
2955
|
+
},
|
|
2956
|
+
/**
|
|
2957
|
+
* Sub-namespace for managing training sessions.
|
|
2958
|
+
*/
|
|
2959
|
+
sessions: {
|
|
2960
|
+
/**
|
|
2961
|
+
* Lists training sessions for a specific agent.
|
|
2962
|
+
*
|
|
2963
|
+
* @param agentId - The UUID of the agent.
|
|
2964
|
+
* @param options - Optional request options.
|
|
2965
|
+
* @returns Array of training session records.
|
|
2966
|
+
*
|
|
2967
|
+
* @example
|
|
2968
|
+
* const sessions = await admin.agents.training.sessions.list('agt_01...');
|
|
2969
|
+
*/
|
|
2970
|
+
list: async (agentId, options) => {
|
|
2971
|
+
return rb.execute(
|
|
2972
|
+
getAdminTrainingSessionsAgentsByAgentIdSessions,
|
|
2973
|
+
{ path: { agent_id: agentId } },
|
|
2974
|
+
options
|
|
2975
|
+
);
|
|
2976
|
+
},
|
|
2977
|
+
/**
|
|
2978
|
+
* Fetches a single training session by ID.
|
|
2979
|
+
*
|
|
2980
|
+
* @param id - The UUID of the training session.
|
|
2981
|
+
* @param options - Optional request options.
|
|
2982
|
+
* @returns The training session record.
|
|
2983
|
+
*
|
|
2984
|
+
* @example
|
|
2985
|
+
* const session = await admin.agents.training.sessions.get('ts_01...');
|
|
2986
|
+
*/
|
|
2987
|
+
get: async (id, options) => {
|
|
2988
|
+
return rb.execute(
|
|
2989
|
+
getAdminTrainingSessionsById,
|
|
2990
|
+
{ path: { id } },
|
|
2991
|
+
options
|
|
2992
|
+
);
|
|
2993
|
+
},
|
|
2994
|
+
/**
|
|
2995
|
+
* Deletes a training session.
|
|
2996
|
+
*
|
|
2997
|
+
* @param id - The UUID of the training session.
|
|
2998
|
+
* @param options - Optional request options.
|
|
2999
|
+
* @returns True on successful deletion.
|
|
3000
|
+
*
|
|
3001
|
+
* @example
|
|
3002
|
+
* await admin.agents.training.sessions.delete('ts_01...');
|
|
3003
|
+
*/
|
|
3004
|
+
delete: async (id, options) => {
|
|
3005
|
+
return rb.executeDelete(
|
|
3006
|
+
deleteAdminTrainingSessionsById,
|
|
3007
|
+
{ path: { id } },
|
|
3008
|
+
options
|
|
3009
|
+
);
|
|
3010
|
+
}
|
|
3011
|
+
}
|
|
3012
|
+
},
|
|
3013
|
+
/**
|
|
3014
|
+
* Sub-namespace for field templates — reusable field definitions.
|
|
3015
|
+
*/
|
|
3016
|
+
fieldTemplates: {
|
|
3017
|
+
/**
|
|
3018
|
+
* Lists all available field templates.
|
|
3019
|
+
*
|
|
3020
|
+
* @param options - Optional request options.
|
|
3021
|
+
* @returns Array of field template objects.
|
|
3022
|
+
*
|
|
3023
|
+
* @example
|
|
3024
|
+
* const templates = await admin.agents.fieldTemplates.list();
|
|
3025
|
+
*/
|
|
3026
|
+
list: async (options) => {
|
|
3027
|
+
return rb.execute(
|
|
3028
|
+
getAdminFieldTemplates,
|
|
3029
|
+
{},
|
|
3030
|
+
options
|
|
3031
|
+
);
|
|
3032
|
+
},
|
|
3033
|
+
/**
|
|
3034
|
+
* Fetches a single field template by ID.
|
|
3035
|
+
*
|
|
3036
|
+
* @param id - The UUID of the field template.
|
|
3037
|
+
* @param options - Optional request options.
|
|
3038
|
+
* @returns The field template object.
|
|
3039
|
+
*
|
|
3040
|
+
* @example
|
|
3041
|
+
* const template = await admin.agents.fieldTemplates.get('ftpl_01...');
|
|
3042
|
+
*/
|
|
3043
|
+
get: async (id, options) => {
|
|
3044
|
+
return rb.execute(
|
|
3045
|
+
getAdminFieldTemplatesById,
|
|
3046
|
+
{ path: { id } },
|
|
3047
|
+
options
|
|
3048
|
+
);
|
|
3049
|
+
},
|
|
3050
|
+
/**
|
|
3051
|
+
* Creates a new field template.
|
|
3052
|
+
*
|
|
3053
|
+
* @param attributes - Field template attributes (name, category, field_type, etc.).
|
|
3054
|
+
* @param options - Optional request options.
|
|
3055
|
+
* @returns The created field template object.
|
|
3056
|
+
*
|
|
3057
|
+
* @example
|
|
3058
|
+
* const template = await admin.agents.fieldTemplates.create({ name: 'Invoice Total', category: 'finance', field_type: 'currency' });
|
|
3059
|
+
*/
|
|
3060
|
+
create: async (attributes, options) => {
|
|
3061
|
+
return rb.execute(
|
|
3062
|
+
postAdminFieldTemplates,
|
|
3063
|
+
{ body: { data: { type: "field_template", attributes } } },
|
|
3064
|
+
options
|
|
3065
|
+
);
|
|
3066
|
+
},
|
|
3067
|
+
/**
|
|
3068
|
+
* Permanently deletes a field template by ID.
|
|
3069
|
+
*
|
|
3070
|
+
* @param id - The UUID of the field template to delete.
|
|
3071
|
+
* @param options - Optional request options.
|
|
3072
|
+
* @returns True on successful deletion.
|
|
3073
|
+
*
|
|
3074
|
+
* @example
|
|
3075
|
+
* await admin.agents.fieldTemplates.delete('ftpl_01...');
|
|
3076
|
+
*/
|
|
3077
|
+
delete: async (id, options) => {
|
|
3078
|
+
return rb.executeDelete(
|
|
3079
|
+
deleteAdminFieldTemplatesById,
|
|
3080
|
+
{ path: { id } },
|
|
3081
|
+
options
|
|
3082
|
+
);
|
|
3083
|
+
}
|
|
3084
|
+
}
|
|
3085
|
+
};
|
|
3086
|
+
}
|
|
3087
|
+
|
|
3088
|
+
// src/namespaces/accounts.ts
|
|
3089
|
+
function createAccountsNamespace(rb) {
|
|
3090
|
+
return {
|
|
3091
|
+
/**
|
|
3092
|
+
* Lists all billing accounts across the platform.
|
|
3093
|
+
*
|
|
3094
|
+
* @param options - Optional request options (headers, abort signal).
|
|
3095
|
+
* @returns Array of Account objects with current balances.
|
|
3096
|
+
*/
|
|
3097
|
+
list: async (options) => {
|
|
3098
|
+
return rb.execute(getAdminAccounts, {}, options);
|
|
3099
|
+
},
|
|
3100
|
+
/**
|
|
3101
|
+
* Fetches a single billing account by ID.
|
|
3102
|
+
*
|
|
3103
|
+
* @param id - Account ID.
|
|
3104
|
+
* @param options - Optional request options.
|
|
3105
|
+
* @returns The Account record.
|
|
3106
|
+
*/
|
|
3107
|
+
get: async (id, options) => {
|
|
3108
|
+
return rb.execute(
|
|
3109
|
+
getAdminAccountsById,
|
|
3110
|
+
{ path: { id } },
|
|
3111
|
+
options
|
|
3112
|
+
);
|
|
3113
|
+
},
|
|
3114
|
+
/**
|
|
3115
|
+
* Adds credits to an account balance.
|
|
3116
|
+
*
|
|
3117
|
+
* Use for manual top-ups, promotional credits, or correction adjustments.
|
|
3118
|
+
* The amount must be a positive number greater than zero.
|
|
3119
|
+
*
|
|
3120
|
+
* @param id - Account ID.
|
|
3121
|
+
* @param amount - Number of credits to add (must be > 0).
|
|
3122
|
+
* @param description - Optional human-readable reason for the credit.
|
|
3123
|
+
* @param options - Optional request options.
|
|
3124
|
+
* @returns Updated Account with the new balance.
|
|
3125
|
+
*/
|
|
3126
|
+
credit: async (id, amount, description, options) => {
|
|
1556
3127
|
if (amount <= 0) {
|
|
1557
3128
|
throw new Error("Credit amount must be positive");
|
|
1558
3129
|
}
|
|
@@ -1567,6 +3138,18 @@ function createAccountsNamespace(rb) {
|
|
|
1567
3138
|
options
|
|
1568
3139
|
);
|
|
1569
3140
|
},
|
|
3141
|
+
/**
|
|
3142
|
+
* Deducts credits from an account balance.
|
|
3143
|
+
*
|
|
3144
|
+
* Use for charge-backs, manual usage adjustments, or corrections.
|
|
3145
|
+
* The amount must be a positive number greater than zero.
|
|
3146
|
+
*
|
|
3147
|
+
* @param id - Account ID.
|
|
3148
|
+
* @param amount - Number of credits to deduct (must be > 0).
|
|
3149
|
+
* @param description - Optional human-readable reason for the debit.
|
|
3150
|
+
* @param options - Optional request options.
|
|
3151
|
+
* @returns Updated Account with the new balance.
|
|
3152
|
+
*/
|
|
1570
3153
|
debit: async (id, amount, description, options) => {
|
|
1571
3154
|
if (amount <= 0) {
|
|
1572
3155
|
throw new Error("Debit amount must be positive");
|
|
@@ -1585,129 +3168,1142 @@ function createAccountsNamespace(rb) {
|
|
|
1585
3168
|
};
|
|
1586
3169
|
}
|
|
1587
3170
|
|
|
1588
|
-
// src/namespaces/
|
|
1589
|
-
function
|
|
3171
|
+
// src/namespaces/capabilities.ts
|
|
3172
|
+
function createCapabilitiesNamespace(rb) {
|
|
3173
|
+
return {
|
|
3174
|
+
/**
|
|
3175
|
+
* List the full capability catalog (platform admin view — no app annotations).
|
|
3176
|
+
*
|
|
3177
|
+
* Returns all capabilities with their tier, dependency, and metadata
|
|
3178
|
+
* information. No per-application annotations (`enabled`, `can_enable`,
|
|
3179
|
+
* etc.) — this view shows the raw platform catalog.
|
|
3180
|
+
*
|
|
3181
|
+
* Requires a platform admin key (`sk_sys_`).
|
|
3182
|
+
*
|
|
3183
|
+
* @param options - Optional request options (signal for cancellation, etc.).
|
|
3184
|
+
* @returns Array of `AdminCapabilityEntry` objects.
|
|
3185
|
+
*
|
|
3186
|
+
* @example
|
|
3187
|
+
* ```typescript
|
|
3188
|
+
* const admin = new GptAdmin({ apiKey: 'sk_sys_...' });
|
|
3189
|
+
* const catalog = await admin.capabilities.list();
|
|
3190
|
+
* const premium = catalog.filter(c => c.tier === "premium");
|
|
3191
|
+
* ```
|
|
3192
|
+
*/
|
|
3193
|
+
list: async (options) => {
|
|
3194
|
+
return rb.rawGet("/sys/capabilities", options);
|
|
3195
|
+
},
|
|
3196
|
+
/**
|
|
3197
|
+
* List the capability catalog annotated for the authenticated application
|
|
3198
|
+
* (ISV view).
|
|
3199
|
+
*
|
|
3200
|
+
* Returns the full catalog with per-application state:
|
|
3201
|
+
* - `enabled` — whether the app currently has this capability active
|
|
3202
|
+
* - `can_enable` — whether the plan tier allows enabling it
|
|
3203
|
+
* - `missing_requires` — required capabilities not yet enabled
|
|
3204
|
+
* - `missing_requires_any` — `requires_any` alternatives not yet enabled
|
|
3205
|
+
*
|
|
3206
|
+
* Requires an ISV application key (`sk_app_`, `sk_srv_`). Use this method
|
|
3207
|
+
* to build plan upgrade flows and capability management UIs.
|
|
3208
|
+
*
|
|
3209
|
+
* @param options - Optional request options (signal for cancellation, etc.).
|
|
3210
|
+
* @returns Array of `AnnotatedCapabilityEntry` objects.
|
|
3211
|
+
*
|
|
3212
|
+
* @example
|
|
3213
|
+
* ```typescript
|
|
3214
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
3215
|
+
* const catalog = await admin.capabilities.listForApplication();
|
|
3216
|
+
* const upgradeable = catalog.filter(c => !c.enabled && c.can_enable);
|
|
3217
|
+
* ```
|
|
3218
|
+
*/
|
|
3219
|
+
listForApplication: async (options) => {
|
|
3220
|
+
return rb.rawGet(
|
|
3221
|
+
"/isv/capabilities",
|
|
3222
|
+
options
|
|
3223
|
+
);
|
|
3224
|
+
},
|
|
3225
|
+
/**
|
|
3226
|
+
* Get a single capability by key from the platform admin catalog.
|
|
3227
|
+
*
|
|
3228
|
+
* Convenience method that fetches the full catalog and returns the entry
|
|
3229
|
+
* matching `key`, or `null` if not found.
|
|
3230
|
+
*
|
|
3231
|
+
* Requires a platform admin key (`sk_sys_`).
|
|
3232
|
+
*
|
|
3233
|
+
* @param key - The capability atom key as a string (e.g., `"salesforce_bulk"`).
|
|
3234
|
+
* @param options - Optional request options.
|
|
3235
|
+
* @returns The matching `AdminCapabilityEntry`, or `null`.
|
|
3236
|
+
*
|
|
3237
|
+
* @example
|
|
3238
|
+
* ```typescript
|
|
3239
|
+
* const entry = await admin.capabilities.get("salesforce_bulk");
|
|
3240
|
+
* if (entry) console.log(entry.tier); // "premium"
|
|
3241
|
+
* ```
|
|
3242
|
+
*/
|
|
3243
|
+
get: async (key, options) => {
|
|
3244
|
+
const all = await rb.rawGet(
|
|
3245
|
+
"/sys/capabilities",
|
|
3246
|
+
options
|
|
3247
|
+
);
|
|
3248
|
+
return all.find((c) => c.key === key) ?? null;
|
|
3249
|
+
}
|
|
3250
|
+
};
|
|
3251
|
+
}
|
|
3252
|
+
|
|
3253
|
+
// src/namespaces/apiKeys.ts
|
|
3254
|
+
function createApiKeysNamespace(rb) {
|
|
3255
|
+
return {
|
|
3256
|
+
/**
|
|
3257
|
+
* Lists API keys. Supports keyset and offset pagination.
|
|
3258
|
+
*
|
|
3259
|
+
* Returns keys scoped to the actor — users see only their own keys,
|
|
3260
|
+
* ISV owners see keys for their application.
|
|
3261
|
+
*
|
|
3262
|
+
* @param options - Optional request options.
|
|
3263
|
+
* @returns Array of ApiKey objects.
|
|
3264
|
+
*/
|
|
3265
|
+
list: async (options) => {
|
|
3266
|
+
return rb.execute(getAdminApiKeys, {}, options);
|
|
3267
|
+
},
|
|
3268
|
+
/**
|
|
3269
|
+
* Fetches a single API key by ID.
|
|
3270
|
+
*
|
|
3271
|
+
* @param id - API key ID.
|
|
3272
|
+
* @param options - Optional request options.
|
|
3273
|
+
* @returns The ApiKey record.
|
|
3274
|
+
*/
|
|
3275
|
+
get: async (id, options) => {
|
|
3276
|
+
return rb.execute(getAdminApiKeysById, { path: { id } }, options);
|
|
3277
|
+
},
|
|
3278
|
+
/**
|
|
3279
|
+
* Revokes an API key, setting its status to `revoked` and recording the
|
|
3280
|
+
* revocation timestamp.
|
|
3281
|
+
*
|
|
3282
|
+
* Triggers smart credit reclaim: any unspent credits allocated to this key
|
|
3283
|
+
* are returned to the App Treasury or Tenant Wallet. Prefer this over
|
|
3284
|
+
* hard deletion to preserve the audit trail.
|
|
3285
|
+
*
|
|
3286
|
+
* @param id - API key ID.
|
|
3287
|
+
* @param options - Optional request options.
|
|
3288
|
+
* @returns Updated ApiKey with status `revoked`.
|
|
3289
|
+
*/
|
|
3290
|
+
revoke: async (id, options) => {
|
|
3291
|
+
return rb.execute(
|
|
3292
|
+
patchAdminApiKeysByIdRevoke,
|
|
3293
|
+
{ path: { id }, body: {} },
|
|
3294
|
+
options
|
|
3295
|
+
);
|
|
3296
|
+
},
|
|
3297
|
+
/**
|
|
3298
|
+
* Rotates an API key by generating a new token while preserving the key's
|
|
3299
|
+
* ID, metadata, and configuration.
|
|
3300
|
+
*
|
|
3301
|
+
* The new raw token is returned once in the `generated_api_key` field and
|
|
3302
|
+
* cannot be retrieved again. All active sessions using the old token are
|
|
3303
|
+
* immediately invalidated.
|
|
3304
|
+
*
|
|
3305
|
+
* @param id - API key ID.
|
|
3306
|
+
* @param options - Optional request options.
|
|
3307
|
+
* @returns Updated ApiKey with the new token in `generated_api_key`.
|
|
3308
|
+
*/
|
|
3309
|
+
rotate: async (id, options) => {
|
|
3310
|
+
return rb.execute(
|
|
3311
|
+
patchAdminApiKeysByIdRotate,
|
|
3312
|
+
{ path: { id }, body: {} },
|
|
3313
|
+
options
|
|
3314
|
+
);
|
|
3315
|
+
},
|
|
3316
|
+
/**
|
|
3317
|
+
* Create a new API key.
|
|
3318
|
+
* @param attributes - Key attributes (name, key_type, scopes, etc.)
|
|
3319
|
+
* @returns Created API key with generated token
|
|
3320
|
+
*/
|
|
3321
|
+
create: async (attributes, options) => {
|
|
3322
|
+
return rb.execute(
|
|
3323
|
+
postAdminApiKeys,
|
|
3324
|
+
{ body: { data: { type: "api_key", attributes } } },
|
|
3325
|
+
options
|
|
3326
|
+
);
|
|
3327
|
+
},
|
|
3328
|
+
/**
|
|
3329
|
+
* Update an API key's configuration.
|
|
3330
|
+
* @param id - API key ID
|
|
3331
|
+
* @param attributes - Attributes to update (name, scopes, rate limits)
|
|
3332
|
+
* @returns Updated API key
|
|
3333
|
+
*/
|
|
3334
|
+
update: async (id, attributes, options) => {
|
|
3335
|
+
return rb.execute(
|
|
3336
|
+
patchAdminApiKeysById,
|
|
3337
|
+
{ path: { id }, body: { data: { id, type: "api_key", attributes } } },
|
|
3338
|
+
options
|
|
3339
|
+
);
|
|
3340
|
+
},
|
|
3341
|
+
/**
|
|
3342
|
+
* Delete an API key permanently.
|
|
3343
|
+
* @param id - API key ID
|
|
3344
|
+
*/
|
|
3345
|
+
delete: async (id, options) => {
|
|
3346
|
+
return rb.executeDelete(
|
|
3347
|
+
deleteAdminApiKeysById,
|
|
3348
|
+
{ path: { id } },
|
|
3349
|
+
options
|
|
3350
|
+
);
|
|
3351
|
+
},
|
|
3352
|
+
/**
|
|
3353
|
+
* Set or remove a credit budget for an API key.
|
|
3354
|
+
* @param id - API key ID
|
|
3355
|
+
* @param creditLimit - Max credits per period (null to remove)
|
|
3356
|
+
* @param creditLimitPeriod - Budget period (null to remove)
|
|
3357
|
+
* @returns Updated API key
|
|
3358
|
+
*/
|
|
3359
|
+
setBudget: async (id, creditLimit, creditLimitPeriod, options) => {
|
|
3360
|
+
return rb.execute(
|
|
3361
|
+
patchAdminApiKeysByIdSetBudget,
|
|
3362
|
+
{
|
|
3363
|
+
path: { id },
|
|
3364
|
+
body: {
|
|
3365
|
+
data: {
|
|
3366
|
+
id,
|
|
3367
|
+
type: "api_key",
|
|
3368
|
+
attributes: {
|
|
3369
|
+
credit_limit: creditLimit,
|
|
3370
|
+
credit_limit_period: creditLimitPeriod
|
|
3371
|
+
}
|
|
3372
|
+
}
|
|
3373
|
+
}
|
|
3374
|
+
},
|
|
3375
|
+
options
|
|
3376
|
+
);
|
|
3377
|
+
},
|
|
3378
|
+
/**
|
|
3379
|
+
* Get API key usage statistics grouped by key type.
|
|
3380
|
+
* @returns Array of usage stat records
|
|
3381
|
+
*/
|
|
3382
|
+
usageStats: async (options) => {
|
|
3383
|
+
return rb.execute(
|
|
3384
|
+
getAdminApiKeysStats,
|
|
3385
|
+
{},
|
|
3386
|
+
options
|
|
3387
|
+
);
|
|
3388
|
+
},
|
|
3389
|
+
/**
|
|
3390
|
+
* List only active (non-revoked) API keys.
|
|
3391
|
+
* @returns Array of active API keys
|
|
3392
|
+
*/
|
|
3393
|
+
active: async (options) => {
|
|
3394
|
+
return rb.execute(getAdminApiKeysActive, {}, options);
|
|
3395
|
+
},
|
|
3396
|
+
/**
|
|
3397
|
+
* Reset the budget period for an API key (resets period_credits_used to 0).
|
|
3398
|
+
* @param id - API key ID
|
|
3399
|
+
* @returns Updated API key
|
|
3400
|
+
*/
|
|
3401
|
+
resetBudgetPeriod: async (id, options) => {
|
|
3402
|
+
return rb.execute(
|
|
3403
|
+
patchAdminApiKeysByIdResetPeriod,
|
|
3404
|
+
{
|
|
3405
|
+
path: { id },
|
|
3406
|
+
body: { data: { id, type: "api_key", attributes: {} } }
|
|
3407
|
+
},
|
|
3408
|
+
options
|
|
3409
|
+
);
|
|
3410
|
+
}
|
|
3411
|
+
};
|
|
3412
|
+
}
|
|
3413
|
+
|
|
3414
|
+
// src/namespaces/documents.ts
|
|
3415
|
+
function createDocumentsNamespace(rb) {
|
|
3416
|
+
return {
|
|
3417
|
+
/**
|
|
3418
|
+
* Lists active (non-deleted) documents across the platform.
|
|
3419
|
+
*
|
|
3420
|
+
* Excludes soft-deleted documents. To list deleted documents, call the
|
|
3421
|
+
* API directly with the `read_trashed` action.
|
|
3422
|
+
*
|
|
3423
|
+
* @param options - Optional request options.
|
|
3424
|
+
* @returns Array of ExtractionDocument objects.
|
|
3425
|
+
*/
|
|
3426
|
+
list: async (options) => {
|
|
3427
|
+
return rb.execute(
|
|
3428
|
+
getAdminExtractionDocuments,
|
|
3429
|
+
{},
|
|
3430
|
+
options
|
|
3431
|
+
);
|
|
3432
|
+
},
|
|
3433
|
+
/**
|
|
3434
|
+
* Fetches a single active document by ID.
|
|
3435
|
+
*
|
|
3436
|
+
* Returns a 404 error for soft-deleted documents.
|
|
3437
|
+
*
|
|
3438
|
+
* @param id - Document ID.
|
|
3439
|
+
* @param options - Optional request options.
|
|
3440
|
+
* @returns The ExtractionDocument.
|
|
3441
|
+
*/
|
|
3442
|
+
get: async (id, options) => {
|
|
3443
|
+
return rb.execute(
|
|
3444
|
+
getAdminExtractionDocumentsById,
|
|
3445
|
+
{ path: { id } },
|
|
3446
|
+
options
|
|
3447
|
+
);
|
|
3448
|
+
},
|
|
3449
|
+
/**
|
|
3450
|
+
* Soft-deletes up to 100 documents in a single operation.
|
|
3451
|
+
*
|
|
3452
|
+
* Sets `deleted_at` on each document without removing the database rows,
|
|
3453
|
+
* preserving the audit trail. Throws synchronously if the array is empty
|
|
3454
|
+
* or exceeds 100 items.
|
|
3455
|
+
*
|
|
3456
|
+
* @param ids - Array of document IDs to delete (1–100 items).
|
|
3457
|
+
* @param options - Optional request options.
|
|
3458
|
+
* @returns Result metadata for the bulk operation.
|
|
3459
|
+
*/
|
|
3460
|
+
bulkDelete: async (ids, options) => {
|
|
3461
|
+
if (ids.length === 0) {
|
|
3462
|
+
throw new Error("At least one document ID is required");
|
|
3463
|
+
}
|
|
3464
|
+
if (ids.length > 100) {
|
|
3465
|
+
throw new Error("Maximum 100 documents per bulk operation");
|
|
3466
|
+
}
|
|
3467
|
+
return rb.execute(
|
|
3468
|
+
postAdminDocumentsBulkDelete,
|
|
3469
|
+
{ body: { data: { type: "bulk_delete", attributes: { ids } } } },
|
|
3470
|
+
options
|
|
3471
|
+
);
|
|
3472
|
+
},
|
|
3473
|
+
/**
|
|
3474
|
+
* Returns platform-wide document statistics.
|
|
3475
|
+
*
|
|
3476
|
+
* Includes total counts by status (uploaded, processing, complete, failed)
|
|
3477
|
+
* and aggregate storage usage.
|
|
3478
|
+
*
|
|
3479
|
+
* @param options - Optional request options.
|
|
3480
|
+
* @returns Statistics record.
|
|
3481
|
+
*/
|
|
3482
|
+
stats: async (options) => {
|
|
3483
|
+
return rb.execute(
|
|
3484
|
+
getAdminDocumentsStats,
|
|
3485
|
+
{},
|
|
3486
|
+
options
|
|
3487
|
+
);
|
|
3488
|
+
}
|
|
3489
|
+
};
|
|
3490
|
+
}
|
|
3491
|
+
|
|
3492
|
+
// src/namespaces/executions.ts
|
|
3493
|
+
function createExecutionsNamespace(rb) {
|
|
3494
|
+
return {
|
|
3495
|
+
/**
|
|
3496
|
+
* Start a new agent execution.
|
|
3497
|
+
*
|
|
3498
|
+
* @param agentId - The UUID of the agent to execute.
|
|
3499
|
+
* @param input - Input data for the agent (task description, documents, etc.).
|
|
3500
|
+
* @param options - Optional request options. Use `idempotencyKey` to prevent duplicate executions.
|
|
3501
|
+
* @returns The created execution record with status `pending`.
|
|
3502
|
+
*
|
|
3503
|
+
* @example
|
|
3504
|
+
* const exec = await admin.executions.start('agt_01...', {
|
|
3505
|
+
* task: 'Process invoice batch',
|
|
3506
|
+
* });
|
|
3507
|
+
* console.log(`Execution ${exec.id} started, status: ${exec.status}`);
|
|
3508
|
+
*/
|
|
3509
|
+
async start(agentId, input, options) {
|
|
3510
|
+
return rb.rawPost(
|
|
3511
|
+
`/isv/agents/${agentId}/execute`,
|
|
3512
|
+
{ input },
|
|
3513
|
+
options
|
|
3514
|
+
);
|
|
3515
|
+
},
|
|
3516
|
+
/**
|
|
3517
|
+
* Estimate credits required for an execution without running it.
|
|
3518
|
+
*
|
|
3519
|
+
* @param agentId - The UUID of the agent.
|
|
3520
|
+
* @param input - The input the agent would process.
|
|
3521
|
+
* @param options - Optional request options.
|
|
3522
|
+
* @returns Cost estimate with min/max credit ranges.
|
|
3523
|
+
*
|
|
3524
|
+
* @example
|
|
3525
|
+
* const estimate = await admin.executions.estimate('agt_01...', {
|
|
3526
|
+
* task: 'Process batch',
|
|
3527
|
+
* });
|
|
3528
|
+
* console.log(`Estimated: ${estimate.min_credits} - ${estimate.max_credits}`);
|
|
3529
|
+
*/
|
|
3530
|
+
async estimate(agentId, input, options) {
|
|
3531
|
+
return rb.rawPost(
|
|
3532
|
+
`/isv/agents/${agentId}/estimate`,
|
|
3533
|
+
{ input },
|
|
3534
|
+
options
|
|
3535
|
+
);
|
|
3536
|
+
},
|
|
3537
|
+
/**
|
|
3538
|
+
* List agent executions.
|
|
3539
|
+
*
|
|
3540
|
+
* @param options - Optional request options.
|
|
3541
|
+
* @returns Array of execution records.
|
|
3542
|
+
*
|
|
3543
|
+
* @example
|
|
3544
|
+
* const executions = await admin.executions.list();
|
|
3545
|
+
*/
|
|
3546
|
+
async list(options) {
|
|
3547
|
+
return rb.rawGet("/isv/agent-executions", options);
|
|
3548
|
+
},
|
|
3549
|
+
/**
|
|
3550
|
+
* Get a single execution by ID.
|
|
3551
|
+
*
|
|
3552
|
+
* @param id - Execution UUID.
|
|
3553
|
+
* @param options - Optional request options.
|
|
3554
|
+
* @returns The execution record.
|
|
3555
|
+
*
|
|
3556
|
+
* @example
|
|
3557
|
+
* const exec = await admin.executions.get('exec_01...');
|
|
3558
|
+
* console.log(exec.status, exec.total_tokens);
|
|
3559
|
+
*/
|
|
3560
|
+
async get(id, options) {
|
|
3561
|
+
return rb.rawGet(`/isv/agent-executions/${id}`, options);
|
|
3562
|
+
},
|
|
3563
|
+
/**
|
|
3564
|
+
* Stream execution events via Server-Sent Events.
|
|
3565
|
+
* Returns an async iterator of typed execution events.
|
|
3566
|
+
*
|
|
3567
|
+
* @param id - Execution UUID to stream.
|
|
3568
|
+
* @param options - Optional request and stream options.
|
|
3569
|
+
* @returns Async iterator of ExecutionEvent objects.
|
|
3570
|
+
*
|
|
3571
|
+
* @example
|
|
3572
|
+
* const stream = await admin.executions.stream(exec.id);
|
|
3573
|
+
* for await (const event of stream) {
|
|
3574
|
+
* if (event.type === 'token_delta') process.stdout.write(event.data.content);
|
|
3575
|
+
* if (event.type === 'done') console.log('Complete');
|
|
3576
|
+
* }
|
|
3577
|
+
*/
|
|
3578
|
+
async stream(id, options) {
|
|
3579
|
+
return rb.streamGetRequest(
|
|
3580
|
+
`/isv/agent-executions/${id}/stream`,
|
|
3581
|
+
options
|
|
3582
|
+
);
|
|
3583
|
+
},
|
|
3584
|
+
/**
|
|
3585
|
+
* Approve a pending human-in-the-loop tool call.
|
|
3586
|
+
*
|
|
3587
|
+
* @param id - Execution UUID awaiting approval.
|
|
3588
|
+
* @param options - Optional request options.
|
|
3589
|
+
* @returns The updated execution record.
|
|
3590
|
+
*
|
|
3591
|
+
* @example
|
|
3592
|
+
* await admin.executions.approve('exec_01...');
|
|
3593
|
+
*/
|
|
3594
|
+
async approve(id, options) {
|
|
3595
|
+
return rb.rawPost(
|
|
3596
|
+
`/isv/agent-executions/${id}/approve`,
|
|
3597
|
+
void 0,
|
|
3598
|
+
options
|
|
3599
|
+
);
|
|
3600
|
+
},
|
|
3601
|
+
/**
|
|
3602
|
+
* Deny a pending human-in-the-loop tool call.
|
|
3603
|
+
*
|
|
3604
|
+
* @param id - Execution UUID awaiting approval.
|
|
3605
|
+
* @param reason - Human-readable reason for rejection.
|
|
3606
|
+
* @param options - Optional request options.
|
|
3607
|
+
* @returns The updated execution record.
|
|
3608
|
+
*
|
|
3609
|
+
* @example
|
|
3610
|
+
* await admin.executions.deny('exec_01...', 'Not authorized to send emails');
|
|
3611
|
+
*/
|
|
3612
|
+
async deny(id, reason, options) {
|
|
3613
|
+
return rb.rawPost(
|
|
3614
|
+
`/isv/agent-executions/${id}/deny`,
|
|
3615
|
+
{ reason },
|
|
3616
|
+
options
|
|
3617
|
+
);
|
|
3618
|
+
},
|
|
3619
|
+
/**
|
|
3620
|
+
* Cancel an in-progress execution.
|
|
3621
|
+
*
|
|
3622
|
+
* @param id - Execution UUID to cancel.
|
|
3623
|
+
* @param options - Optional request options.
|
|
3624
|
+
* @returns The updated execution record with `cancelled` status.
|
|
3625
|
+
*
|
|
3626
|
+
* @example
|
|
3627
|
+
* await admin.executions.cancel('exec_01...');
|
|
3628
|
+
*/
|
|
3629
|
+
async cancel(id, options) {
|
|
3630
|
+
return rb.rawPost(
|
|
3631
|
+
`/isv/agent-executions/${id}/cancel`,
|
|
3632
|
+
void 0,
|
|
3633
|
+
options
|
|
3634
|
+
);
|
|
3635
|
+
},
|
|
3636
|
+
/**
|
|
3637
|
+
* List child executions spawned by a parent execution (multi-agent delegation).
|
|
3638
|
+
*
|
|
3639
|
+
* @param id - Parent execution UUID.
|
|
3640
|
+
* @param options - Optional request options.
|
|
3641
|
+
* @returns Array of child execution records.
|
|
3642
|
+
*
|
|
3643
|
+
* @example
|
|
3644
|
+
* const children = await admin.executions.children('exec_01...');
|
|
3645
|
+
*/
|
|
3646
|
+
async children(id, options) {
|
|
3647
|
+
return rb.rawGet(
|
|
3648
|
+
`/isv/agent-executions/${id}/children`,
|
|
3649
|
+
options
|
|
3650
|
+
);
|
|
3651
|
+
},
|
|
3652
|
+
/**
|
|
3653
|
+
* Get the full execution tree for a root execution.
|
|
3654
|
+
* Includes all nested child executions and their statuses.
|
|
3655
|
+
*
|
|
3656
|
+
* @param id - Root execution UUID.
|
|
3657
|
+
* @param options - Optional request options.
|
|
3658
|
+
* @returns Hierarchical execution tree structure.
|
|
3659
|
+
*
|
|
3660
|
+
* @example
|
|
3661
|
+
* const tree = await admin.executions.tree('exec_01...');
|
|
3662
|
+
*/
|
|
3663
|
+
async tree(id, options) {
|
|
3664
|
+
return rb.rawGet(
|
|
3665
|
+
`/isv/agent-executions/${id}/tree`,
|
|
3666
|
+
options
|
|
3667
|
+
);
|
|
3668
|
+
}
|
|
3669
|
+
};
|
|
3670
|
+
}
|
|
3671
|
+
|
|
3672
|
+
// src/namespaces/storage.ts
|
|
3673
|
+
function createStorageNamespace(rb) {
|
|
3674
|
+
return {
|
|
3675
|
+
/**
|
|
3676
|
+
* Retrieves platform-wide storage statistics.
|
|
3677
|
+
*
|
|
3678
|
+
* Pass a `workspaceId` to scope results to a single workspace.
|
|
3679
|
+
*
|
|
3680
|
+
* @param workspaceId - Optional workspace ID to filter statistics.
|
|
3681
|
+
* @param options - Optional request options.
|
|
3682
|
+
* @returns Storage statistics record with byte counts and file totals.
|
|
3683
|
+
*/
|
|
3684
|
+
stats: async (workspaceId, options) => {
|
|
3685
|
+
const params = workspaceId ? { query: { "filter[workspace_id]": workspaceId } } : {};
|
|
3686
|
+
return rb.execute(
|
|
3687
|
+
getAdminStorageStats,
|
|
3688
|
+
params,
|
|
3689
|
+
options
|
|
3690
|
+
);
|
|
3691
|
+
},
|
|
3692
|
+
buckets: {
|
|
3693
|
+
/**
|
|
3694
|
+
* Lists all storage buckets, excluding processing-type buckets by default.
|
|
3695
|
+
*
|
|
3696
|
+
* @param options - Optional request options.
|
|
3697
|
+
* @returns Array of Bucket objects.
|
|
3698
|
+
*/
|
|
3699
|
+
list: async (options) => {
|
|
3700
|
+
return rb.execute(getAdminBuckets, {}, options);
|
|
3701
|
+
},
|
|
3702
|
+
/**
|
|
3703
|
+
* Fetches a single bucket by ID.
|
|
3704
|
+
*
|
|
3705
|
+
* @param id - Bucket ID.
|
|
3706
|
+
* @param options - Optional request options.
|
|
3707
|
+
* @returns The Bucket record.
|
|
3708
|
+
*/
|
|
3709
|
+
get: async (id, options) => {
|
|
3710
|
+
return rb.execute(
|
|
3711
|
+
getAdminBucketsById,
|
|
3712
|
+
{ path: { id } },
|
|
3713
|
+
options
|
|
3714
|
+
);
|
|
3715
|
+
},
|
|
3716
|
+
/**
|
|
3717
|
+
* Fetches a bucket with the `storage_used` calculation.
|
|
3718
|
+
*
|
|
3719
|
+
* Returns total bytes across all workspace files stored in this bucket.
|
|
3720
|
+
*
|
|
3721
|
+
* @param id - Bucket ID.
|
|
3722
|
+
* @param options - Optional request options.
|
|
3723
|
+
* @returns Bucket record including computed `storage_used` field.
|
|
3724
|
+
*/
|
|
3725
|
+
stats: async (id, options) => {
|
|
3726
|
+
return rb.execute(
|
|
3727
|
+
getAdminBucketsByIdStats,
|
|
3728
|
+
{ path: { id } },
|
|
3729
|
+
options
|
|
3730
|
+
);
|
|
3731
|
+
}
|
|
3732
|
+
}
|
|
3733
|
+
};
|
|
3734
|
+
}
|
|
3735
|
+
|
|
3736
|
+
// src/pagination.ts
|
|
3737
|
+
var DEFAULT_MAX_PAGES = 500;
|
|
3738
|
+
async function* paginateAll(fetcher, options = {}) {
|
|
3739
|
+
const pageSize = options.pageSize || 20;
|
|
3740
|
+
const limit = options.limit;
|
|
3741
|
+
const maxPages = options.maxPages ?? DEFAULT_MAX_PAGES;
|
|
3742
|
+
const logger = options.logger ?? (typeof console !== "undefined" ? console : void 0);
|
|
3743
|
+
let page = 1;
|
|
3744
|
+
let totalYielded = 0;
|
|
3745
|
+
while (true) {
|
|
3746
|
+
if (page > maxPages) {
|
|
3747
|
+
logger?.warn(
|
|
3748
|
+
`[GPT Core SDK] Pagination stopped: reached maximum page limit (${maxPages}). Use options.maxPages to increase or options.limit to cap total items.`
|
|
3749
|
+
);
|
|
3750
|
+
return;
|
|
3751
|
+
}
|
|
3752
|
+
const response = await fetcher(page, pageSize);
|
|
3753
|
+
for (const item of response.data) {
|
|
3754
|
+
yield item;
|
|
3755
|
+
totalYielded++;
|
|
3756
|
+
if (limit && totalYielded >= limit) {
|
|
3757
|
+
return;
|
|
3758
|
+
}
|
|
3759
|
+
}
|
|
3760
|
+
if (!response.links?.next || response.data.length === 0) {
|
|
3761
|
+
break;
|
|
3762
|
+
}
|
|
3763
|
+
page++;
|
|
3764
|
+
}
|
|
3765
|
+
}
|
|
3766
|
+
var DEFAULT_LIMIT = 1e4;
|
|
3767
|
+
async function paginateToArray(fetcher, options = {}) {
|
|
3768
|
+
const safeOptions = {
|
|
3769
|
+
pageSize: options.pageSize || 20,
|
|
3770
|
+
// Security: Apply default limit to prevent unbounded memory usage
|
|
3771
|
+
limit: options.limit ?? DEFAULT_LIMIT,
|
|
3772
|
+
logger: options.logger
|
|
3773
|
+
};
|
|
3774
|
+
const results = [];
|
|
3775
|
+
for await (const item of paginateAll(fetcher, safeOptions)) {
|
|
3776
|
+
results.push(item);
|
|
3777
|
+
}
|
|
3778
|
+
return results;
|
|
3779
|
+
}
|
|
3780
|
+
|
|
3781
|
+
// src/namespace-types.ts
|
|
3782
|
+
function buildPageQuery(page, pageSize) {
|
|
3783
|
+
return {
|
|
3784
|
+
query: {
|
|
3785
|
+
page: {
|
|
3786
|
+
...page && { number: page },
|
|
3787
|
+
...pageSize && { size: pageSize }
|
|
3788
|
+
}
|
|
3789
|
+
}
|
|
3790
|
+
};
|
|
3791
|
+
}
|
|
3792
|
+
|
|
3793
|
+
// src/namespaces/users.ts
|
|
3794
|
+
function createUsersNamespace(rb) {
|
|
1590
3795
|
return {
|
|
3796
|
+
/**
|
|
3797
|
+
* List all users (paginated).
|
|
3798
|
+
* @param options - Optional page and pageSize along with request options
|
|
3799
|
+
* @returns Array of users
|
|
3800
|
+
*/
|
|
1591
3801
|
list: async (options) => {
|
|
1592
|
-
return rb.execute(getAdminApiKeys, {}, options);
|
|
1593
|
-
},
|
|
1594
|
-
get: async (id, options) => {
|
|
1595
|
-
return rb.execute(getAdminApiKeysById, { path: { id } }, options);
|
|
1596
|
-
},
|
|
1597
|
-
allocate: async (id, amount, description, options) => {
|
|
1598
3802
|
return rb.execute(
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
path: { id },
|
|
1602
|
-
body: {
|
|
1603
|
-
data: { type: "api_key", attributes: { amount, description } }
|
|
1604
|
-
}
|
|
1605
|
-
},
|
|
3803
|
+
getAdminUsers,
|
|
3804
|
+
buildPageQuery(options?.page, options?.pageSize),
|
|
1606
3805
|
options
|
|
1607
3806
|
);
|
|
1608
3807
|
},
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
3808
|
+
/**
|
|
3809
|
+
* List all users (fetches all pages automatically).
|
|
3810
|
+
* @returns Complete array of all users
|
|
3811
|
+
*/
|
|
3812
|
+
listAll: async (options) => {
|
|
3813
|
+
return paginateToArray(
|
|
3814
|
+
rb.createPaginatedFetcher(
|
|
3815
|
+
getAdminUsers,
|
|
3816
|
+
(page, pageSize) => ({
|
|
3817
|
+
query: { page: { number: page, size: pageSize } }
|
|
3818
|
+
}),
|
|
3819
|
+
options
|
|
3820
|
+
)
|
|
1614
3821
|
);
|
|
1615
3822
|
},
|
|
1616
|
-
|
|
3823
|
+
/**
|
|
3824
|
+
* Get a user by ID.
|
|
3825
|
+
* @param id - User ID
|
|
3826
|
+
* @returns User object
|
|
3827
|
+
*/
|
|
3828
|
+
get: async (id, options) => {
|
|
3829
|
+
return rb.execute(getAdminUsersById, { path: { id } }, options);
|
|
3830
|
+
},
|
|
3831
|
+
/**
|
|
3832
|
+
* Look up a user by email address.
|
|
3833
|
+
* @param email - Email address to search
|
|
3834
|
+
* @returns User object
|
|
3835
|
+
*/
|
|
3836
|
+
getByEmail: async (email, options) => {
|
|
1617
3837
|
return rb.execute(
|
|
1618
|
-
|
|
1619
|
-
{
|
|
3838
|
+
getAdminUsersByEmail,
|
|
3839
|
+
{ query: { email } },
|
|
1620
3840
|
options
|
|
1621
3841
|
);
|
|
1622
|
-
}
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
3842
|
+
},
|
|
3843
|
+
/**
|
|
3844
|
+
* Update a user's admin-level attributes (is_platform_admin, is_app_admin).
|
|
3845
|
+
* @param id - User ID
|
|
3846
|
+
* @param attributes - Admin attributes to update
|
|
3847
|
+
* @returns Updated user
|
|
3848
|
+
*/
|
|
3849
|
+
adminUpdate: async (id, attributes, options) => {
|
|
1630
3850
|
return rb.execute(
|
|
1631
|
-
|
|
1632
|
-
{},
|
|
3851
|
+
patchAdminUsersByIdAdmin,
|
|
3852
|
+
{ path: { id }, body: { data: { id, type: "user", attributes } } },
|
|
1633
3853
|
options
|
|
1634
3854
|
);
|
|
1635
3855
|
},
|
|
1636
|
-
|
|
3856
|
+
/**
|
|
3857
|
+
* Change a user's email address (admin action).
|
|
3858
|
+
* @param id - User ID
|
|
3859
|
+
* @param email - New email address
|
|
3860
|
+
* @returns Updated user
|
|
3861
|
+
*/
|
|
3862
|
+
adminUpdateEmail: async (id, email, options) => {
|
|
1637
3863
|
return rb.execute(
|
|
1638
|
-
|
|
1639
|
-
{
|
|
3864
|
+
patchAdminUsersByIdAdminEmail,
|
|
3865
|
+
{
|
|
3866
|
+
path: { id },
|
|
3867
|
+
body: { data: { id, type: "user", attributes: { email } } }
|
|
3868
|
+
},
|
|
1640
3869
|
options
|
|
1641
3870
|
);
|
|
1642
3871
|
},
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
}
|
|
3872
|
+
/**
|
|
3873
|
+
* Confirm a user's email address (admin bypass).
|
|
3874
|
+
* @param id - User ID
|
|
3875
|
+
* @returns Updated user
|
|
3876
|
+
*/
|
|
3877
|
+
confirmEmail: async (id, options) => {
|
|
1650
3878
|
return rb.execute(
|
|
1651
|
-
|
|
1652
|
-
{ body: { data: { type: "
|
|
3879
|
+
patchAdminUsersByIdConfirmEmail,
|
|
3880
|
+
{ path: { id }, body: { data: { id, type: "user", attributes: {} } } },
|
|
1653
3881
|
options
|
|
1654
3882
|
);
|
|
1655
3883
|
},
|
|
1656
|
-
|
|
3884
|
+
/**
|
|
3885
|
+
* Trigger a password reset email for a user (admin action).
|
|
3886
|
+
* @param id - User ID
|
|
3887
|
+
* @returns Updated user
|
|
3888
|
+
*/
|
|
3889
|
+
triggerPasswordReset: async (id, options) => {
|
|
1657
3890
|
return rb.execute(
|
|
1658
|
-
|
|
1659
|
-
{},
|
|
3891
|
+
patchAdminUsersByIdResetPassword,
|
|
3892
|
+
{ path: { id }, body: { data: { id, type: "user", attributes: {} } } },
|
|
1660
3893
|
options
|
|
1661
3894
|
);
|
|
3895
|
+
},
|
|
3896
|
+
/**
|
|
3897
|
+
* Delete a user and all associated data.
|
|
3898
|
+
* @param id - User ID
|
|
3899
|
+
*/
|
|
3900
|
+
delete: async (id, options) => {
|
|
3901
|
+
return rb.executeDelete(deleteAdminUsersById, { path: { id } }, options);
|
|
1662
3902
|
}
|
|
1663
3903
|
};
|
|
1664
3904
|
}
|
|
1665
3905
|
|
|
1666
|
-
// src/namespaces/
|
|
1667
|
-
function
|
|
1668
|
-
return {};
|
|
1669
|
-
}
|
|
1670
|
-
|
|
1671
|
-
// src/namespaces/storage.ts
|
|
1672
|
-
function createStorageNamespace(rb) {
|
|
3906
|
+
// src/namespaces/voice.ts
|
|
3907
|
+
function createVoiceNamespace(rb) {
|
|
1673
3908
|
return {
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
3909
|
+
/**
|
|
3910
|
+
* Voice session management — admin view across all workspaces.
|
|
3911
|
+
*/
|
|
3912
|
+
sessions: {
|
|
3913
|
+
/**
|
|
3914
|
+
* List voice sessions across all workspaces.
|
|
3915
|
+
*
|
|
3916
|
+
* @param options - Optional pagination, filter, and request options.
|
|
3917
|
+
* @returns Array of VoiceSession objects.
|
|
3918
|
+
*
|
|
3919
|
+
* @example
|
|
3920
|
+
* ```typescript
|
|
3921
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
3922
|
+
* // List all active sessions
|
|
3923
|
+
* const activeSessions = await admin.voice.sessions.list({ status: "active" });
|
|
3924
|
+
* // List sessions from the last 24 hours
|
|
3925
|
+
* const recentSessions = await admin.voice.sessions.list({
|
|
3926
|
+
* insertedAfter: new Date(Date.now() - 86400000).toISOString()
|
|
3927
|
+
* });
|
|
3928
|
+
* ```
|
|
3929
|
+
*/
|
|
3930
|
+
list: async (options) => {
|
|
3931
|
+
const filters = {};
|
|
3932
|
+
if (options?.status) filters["filter[status]"] = options.status;
|
|
3933
|
+
if (options?.insertedAfter)
|
|
3934
|
+
filters["filter[inserted_after]"] = options.insertedAfter;
|
|
3935
|
+
if (options?.insertedBefore)
|
|
3936
|
+
filters["filter[inserted_before]"] = options.insertedBefore;
|
|
3937
|
+
return rb.execute(
|
|
3938
|
+
getAdminVoiceSessions,
|
|
3939
|
+
{
|
|
3940
|
+
...buildPageQuery(options?.page, options?.pageSize),
|
|
3941
|
+
query: filters
|
|
3942
|
+
},
|
|
3943
|
+
options
|
|
3944
|
+
);
|
|
3945
|
+
},
|
|
3946
|
+
/**
|
|
3947
|
+
* Retrieve a single voice session by ID.
|
|
3948
|
+
*
|
|
3949
|
+
* @param id - The UUID of the voice session.
|
|
3950
|
+
* @param options - Optional request options.
|
|
3951
|
+
* @returns The VoiceSession.
|
|
3952
|
+
*
|
|
3953
|
+
* @example
|
|
3954
|
+
* ```typescript
|
|
3955
|
+
* const session = await admin.voice.sessions.get('session-uuid');
|
|
3956
|
+
* ```
|
|
3957
|
+
*/
|
|
3958
|
+
get: async (id, options) => {
|
|
3959
|
+
return rb.execute(
|
|
3960
|
+
getAdminVoiceSessionsById,
|
|
3961
|
+
{ path: { id } },
|
|
3962
|
+
options
|
|
3963
|
+
);
|
|
3964
|
+
},
|
|
3965
|
+
/**
|
|
3966
|
+
* List voice sessions in a specific workspace.
|
|
3967
|
+
*
|
|
3968
|
+
* @param workspaceId - The UUID of the workspace.
|
|
3969
|
+
* @param options - Optional pagination and request options.
|
|
3970
|
+
* @returns Array of VoiceSession objects in the workspace.
|
|
3971
|
+
*
|
|
3972
|
+
* @example
|
|
3973
|
+
* ```typescript
|
|
3974
|
+
* const sessions = await admin.voice.sessions.listByWorkspace('ws-uuid');
|
|
3975
|
+
* ```
|
|
3976
|
+
*/
|
|
3977
|
+
listByWorkspace: async (workspaceId, options) => {
|
|
3978
|
+
return rb.execute(
|
|
3979
|
+
getAdminVoiceSessionsWorkspaceByWorkspaceId,
|
|
3980
|
+
{
|
|
3981
|
+
path: { workspace_id: workspaceId },
|
|
3982
|
+
...buildPageQuery(options?.page, options?.pageSize)
|
|
3983
|
+
},
|
|
3984
|
+
options
|
|
3985
|
+
);
|
|
3986
|
+
}
|
|
1681
3987
|
},
|
|
1682
|
-
|
|
3988
|
+
/**
|
|
3989
|
+
* Voice recording management — admin view.
|
|
3990
|
+
*/
|
|
3991
|
+
recordings: {
|
|
3992
|
+
/**
|
|
3993
|
+
* List voice recordings.
|
|
3994
|
+
*
|
|
3995
|
+
* @param options - Optional pagination and request options.
|
|
3996
|
+
* @returns Array of VoiceRecording objects.
|
|
3997
|
+
*
|
|
3998
|
+
* @example
|
|
3999
|
+
* ```typescript
|
|
4000
|
+
* const recordings = await admin.voice.recordings.list();
|
|
4001
|
+
* ```
|
|
4002
|
+
*/
|
|
1683
4003
|
list: async (options) => {
|
|
1684
|
-
return rb.execute(
|
|
4004
|
+
return rb.execute(
|
|
4005
|
+
getAdminVoiceRecordings,
|
|
4006
|
+
buildPageQuery(options?.page, options?.pageSize),
|
|
4007
|
+
options
|
|
4008
|
+
);
|
|
1685
4009
|
},
|
|
4010
|
+
/**
|
|
4011
|
+
* Retrieve a single recording by ID.
|
|
4012
|
+
*
|
|
4013
|
+
* @param id - The UUID of the recording.
|
|
4014
|
+
* @param options - Optional request options.
|
|
4015
|
+
* @returns The VoiceRecording.
|
|
4016
|
+
*
|
|
4017
|
+
* @example
|
|
4018
|
+
* ```typescript
|
|
4019
|
+
* const recording = await admin.voice.recordings.get('recording-uuid');
|
|
4020
|
+
* ```
|
|
4021
|
+
*/
|
|
1686
4022
|
get: async (id, options) => {
|
|
1687
4023
|
return rb.execute(
|
|
1688
|
-
|
|
4024
|
+
getAdminVoiceRecordingsById,
|
|
1689
4025
|
{ path: { id } },
|
|
1690
4026
|
options
|
|
1691
4027
|
);
|
|
1692
4028
|
},
|
|
1693
|
-
|
|
4029
|
+
/**
|
|
4030
|
+
* List all recordings for a specific voice session.
|
|
4031
|
+
*
|
|
4032
|
+
* @param sessionId - The UUID of the voice session.
|
|
4033
|
+
* @param options - Optional request options.
|
|
4034
|
+
* @returns Array of VoiceRecording objects for the session.
|
|
4035
|
+
*
|
|
4036
|
+
* @example
|
|
4037
|
+
* ```typescript
|
|
4038
|
+
* const recordings = await admin.voice.recordings.bySession('session-uuid');
|
|
4039
|
+
* ```
|
|
4040
|
+
*/
|
|
4041
|
+
bySession: async (sessionId, options) => {
|
|
1694
4042
|
return rb.execute(
|
|
1695
|
-
|
|
4043
|
+
getAdminVoiceRecordingsSessionBySessionId,
|
|
4044
|
+
{ path: { session_id: sessionId } },
|
|
4045
|
+
options
|
|
4046
|
+
);
|
|
4047
|
+
}
|
|
4048
|
+
},
|
|
4049
|
+
/**
|
|
4050
|
+
* Transcription result management — admin view.
|
|
4051
|
+
*/
|
|
4052
|
+
transcriptionResults: {
|
|
4053
|
+
/**
|
|
4054
|
+
* List transcription results.
|
|
4055
|
+
*
|
|
4056
|
+
* @param options - Optional pagination and request options.
|
|
4057
|
+
* @returns Array of VoiceTranscriptionResult objects.
|
|
4058
|
+
*
|
|
4059
|
+
* @example
|
|
4060
|
+
* ```typescript
|
|
4061
|
+
* const results = await admin.voice.transcriptionResults.list();
|
|
4062
|
+
* ```
|
|
4063
|
+
*/
|
|
4064
|
+
list: async (options) => {
|
|
4065
|
+
return rb.execute(
|
|
4066
|
+
getAdminVoiceTranscriptionResults,
|
|
4067
|
+
buildPageQuery(options?.page, options?.pageSize),
|
|
4068
|
+
options
|
|
4069
|
+
);
|
|
4070
|
+
},
|
|
4071
|
+
/**
|
|
4072
|
+
* Retrieve a single transcription result by ID.
|
|
4073
|
+
*
|
|
4074
|
+
* @param id - The UUID of the transcription result.
|
|
4075
|
+
* @param options - Optional request options.
|
|
4076
|
+
* @returns The VoiceTranscriptionResult.
|
|
4077
|
+
*
|
|
4078
|
+
* @example
|
|
4079
|
+
* ```typescript
|
|
4080
|
+
* const result = await admin.voice.transcriptionResults.get('result-uuid');
|
|
4081
|
+
* ```
|
|
4082
|
+
*/
|
|
4083
|
+
get: async (id, options) => {
|
|
4084
|
+
return rb.execute(
|
|
4085
|
+
getAdminVoiceTranscriptionResultsById,
|
|
1696
4086
|
{ path: { id } },
|
|
1697
4087
|
options
|
|
1698
4088
|
);
|
|
4089
|
+
},
|
|
4090
|
+
/**
|
|
4091
|
+
* List transcription results for a specific voice session.
|
|
4092
|
+
*
|
|
4093
|
+
* @param sessionId - The UUID of the voice session.
|
|
4094
|
+
* @param options - Optional pagination and request options.
|
|
4095
|
+
* @returns Array of VoiceTranscriptionResult objects for the session.
|
|
4096
|
+
*
|
|
4097
|
+
* @example
|
|
4098
|
+
* ```typescript
|
|
4099
|
+
* const results = await admin.voice.transcriptionResults.bySession('session-uuid');
|
|
4100
|
+
* ```
|
|
4101
|
+
*/
|
|
4102
|
+
bySession: async (sessionId, options) => {
|
|
4103
|
+
return rb.execute(
|
|
4104
|
+
getAdminVoiceTranscriptionResultsSessionBySessionId,
|
|
4105
|
+
{
|
|
4106
|
+
path: { session_id: sessionId },
|
|
4107
|
+
...buildPageQuery(options?.page, options?.pageSize)
|
|
4108
|
+
},
|
|
4109
|
+
options
|
|
4110
|
+
);
|
|
1699
4111
|
}
|
|
1700
4112
|
}
|
|
1701
4113
|
};
|
|
1702
4114
|
}
|
|
1703
4115
|
|
|
4116
|
+
// src/namespaces/audit.ts
|
|
4117
|
+
function createAuditNamespace(rb) {
|
|
4118
|
+
return {
|
|
4119
|
+
/**
|
|
4120
|
+
* List audit log entries with keyset or offset pagination.
|
|
4121
|
+
*
|
|
4122
|
+
* Returns up to `limit` (default 50) entries sorted by `inserted_at` descending.
|
|
4123
|
+
* The `actor_display_name` calculation is included automatically.
|
|
4124
|
+
*
|
|
4125
|
+
* @param params - Optional pagination and sort parameters.
|
|
4126
|
+
* @param options - Optional request options.
|
|
4127
|
+
* @returns Array of AuditLog entries.
|
|
4128
|
+
*
|
|
4129
|
+
* @example
|
|
4130
|
+
* ```typescript
|
|
4131
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4132
|
+
*
|
|
4133
|
+
* // First page (default limit 50)
|
|
4134
|
+
* const page1 = await admin.audit.list();
|
|
4135
|
+
*
|
|
4136
|
+
* // Next page using keyset cursor
|
|
4137
|
+
* const page2 = await admin.audit.list({ after: page1.at(-1)?.id, limit: 25 });
|
|
4138
|
+
* ```
|
|
4139
|
+
*/
|
|
4140
|
+
async list(params = {}, options) {
|
|
4141
|
+
const parts = [];
|
|
4142
|
+
if (params.limit !== void 0) parts.push(`page[limit]=${params.limit}`);
|
|
4143
|
+
if (params.offset !== void 0)
|
|
4144
|
+
parts.push(`page[offset]=${params.offset}`);
|
|
4145
|
+
if (params.after)
|
|
4146
|
+
parts.push(`page[after]=${encodeURIComponent(params.after)}`);
|
|
4147
|
+
if (params.before)
|
|
4148
|
+
parts.push(`page[before]=${encodeURIComponent(params.before)}`);
|
|
4149
|
+
if (params.sort) parts.push(`sort=${encodeURIComponent(params.sort)}`);
|
|
4150
|
+
const qs = parts.length ? `?${parts.join("&")}` : "";
|
|
4151
|
+
return rb.rawGet(`/admin/audit-logs${qs}`, options);
|
|
4152
|
+
},
|
|
4153
|
+
/**
|
|
4154
|
+
* Fetch a paginated, time-sorted activity feed scoped to a tenant.
|
|
4155
|
+
*
|
|
4156
|
+
* Optionally filter by workspace, action type, actor, or date range.
|
|
4157
|
+
* Results are sorted by `inserted_at` descending (most recent first).
|
|
4158
|
+
*
|
|
4159
|
+
* @param params - Feed parameters. `tenantId` is required.
|
|
4160
|
+
* @param options - Optional request options.
|
|
4161
|
+
* @returns Array of AuditLog entries matching the filters.
|
|
4162
|
+
*
|
|
4163
|
+
* @example
|
|
4164
|
+
* ```typescript
|
|
4165
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4166
|
+
*
|
|
4167
|
+
* // All activity for a tenant in the last 24h
|
|
4168
|
+
* const feed = await admin.audit.activityFeed({
|
|
4169
|
+
* tenantId: 'tenant-uuid',
|
|
4170
|
+
* fromDate: new Date(Date.now() - 86400000).toISOString(),
|
|
4171
|
+
* });
|
|
4172
|
+
*
|
|
4173
|
+
* // Narrow to a specific workspace and actor
|
|
4174
|
+
* const focused = await admin.audit.activityFeed({
|
|
4175
|
+
* tenantId: 'tenant-uuid',
|
|
4176
|
+
* workspaceId: 'ws-uuid',
|
|
4177
|
+
* actorId: 'user-uuid',
|
|
4178
|
+
* limit: 20,
|
|
4179
|
+
* });
|
|
4180
|
+
* ```
|
|
4181
|
+
*/
|
|
4182
|
+
async activityFeed(params, options) {
|
|
4183
|
+
if (!params.tenantId) throw new Error("tenantId is required");
|
|
4184
|
+
const parts = [
|
|
4185
|
+
`tenant_id=${encodeURIComponent(params.tenantId)}`
|
|
4186
|
+
];
|
|
4187
|
+
if (params.workspaceId)
|
|
4188
|
+
parts.push(`workspace_id=${encodeURIComponent(params.workspaceId)}`);
|
|
4189
|
+
if (params.activityType)
|
|
4190
|
+
parts.push(`activity_type=${encodeURIComponent(params.activityType)}`);
|
|
4191
|
+
if (params.actorId)
|
|
4192
|
+
parts.push(`actor_id=${encodeURIComponent(params.actorId)}`);
|
|
4193
|
+
if (params.fromDate)
|
|
4194
|
+
parts.push(`from_date=${encodeURIComponent(params.fromDate)}`);
|
|
4195
|
+
if (params.toDate)
|
|
4196
|
+
parts.push(`to_date=${encodeURIComponent(params.toDate)}`);
|
|
4197
|
+
if (params.limit !== void 0) parts.push(`limit=${params.limit}`);
|
|
4198
|
+
if (params.offset !== void 0) parts.push(`offset=${params.offset}`);
|
|
4199
|
+
return rb.rawGet(
|
|
4200
|
+
`/admin/audit-logs/activity?${parts.join("&")}`,
|
|
4201
|
+
options
|
|
4202
|
+
);
|
|
4203
|
+
},
|
|
4204
|
+
/**
|
|
4205
|
+
* Return per-action counts for a tenant, sorted by frequency descending.
|
|
4206
|
+
*
|
|
4207
|
+
* Useful for anomaly dashboards and compliance reporting.
|
|
4208
|
+
*
|
|
4209
|
+
* @param params - `tenantId` is required. `workspaceId` narrows to one workspace.
|
|
4210
|
+
* @param options - Optional request options.
|
|
4211
|
+
* @returns Array of `{ action, count }` objects sorted by count descending.
|
|
4212
|
+
*
|
|
4213
|
+
* @example
|
|
4214
|
+
* ```typescript
|
|
4215
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4216
|
+
*
|
|
4217
|
+
* const counts = await admin.audit.countByAction({ tenantId: 'tenant-uuid' });
|
|
4218
|
+
* // [{ action: "document.analyzed", count: 1240 }, { action: "user.login", count: 98 }, ...]
|
|
4219
|
+
* ```
|
|
4220
|
+
*/
|
|
4221
|
+
async countByAction(params, options) {
|
|
4222
|
+
if (!params.tenantId) throw new Error("tenantId is required");
|
|
4223
|
+
const parts = [
|
|
4224
|
+
`tenant_id=${encodeURIComponent(params.tenantId)}`
|
|
4225
|
+
];
|
|
4226
|
+
if (params.workspaceId)
|
|
4227
|
+
parts.push(`workspace_id=${encodeURIComponent(params.workspaceId)}`);
|
|
4228
|
+
return rb.rawGet(
|
|
4229
|
+
`/admin/audit-logs/count-by-action?${parts.join("&")}`,
|
|
4230
|
+
options
|
|
4231
|
+
);
|
|
4232
|
+
},
|
|
4233
|
+
/**
|
|
4234
|
+
* Enqueue a bulk compliance export of audit logs for a tenant.
|
|
4235
|
+
*
|
|
4236
|
+
* The export is processed asynchronously by the `ExportAuditLogsWorker` Oban job.
|
|
4237
|
+
* The caller receives a job ID and status immediately; the file URL is published
|
|
4238
|
+
* to `audit:export:{tenant_id}` via PubSub when ready (see `AuditExportCompleted`).
|
|
4239
|
+
*
|
|
4240
|
+
* @param params - Export parameters. `tenantId` and `format` are required.
|
|
4241
|
+
* @param options - Optional request options.
|
|
4242
|
+
* @returns `{ jobId, status }` — the Oban job ID and initial status (`"enqueued"`).
|
|
4243
|
+
*
|
|
4244
|
+
* @example
|
|
4245
|
+
* ```typescript
|
|
4246
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4247
|
+
*
|
|
4248
|
+
* // Request a CSV export of the last 30 days
|
|
4249
|
+
* const thirty = new Date();
|
|
4250
|
+
* thirty.setDate(thirty.getDate() - 30);
|
|
4251
|
+
* const result = await admin.audit.requestExport({
|
|
4252
|
+
* format: 'csv',
|
|
4253
|
+
* tenantId: 'tenant-uuid',
|
|
4254
|
+
* fromDate: thirty.toISOString(),
|
|
4255
|
+
* });
|
|
4256
|
+
* console.log(`Export job ${result.jobId} enqueued`);
|
|
4257
|
+
* ```
|
|
4258
|
+
*/
|
|
4259
|
+
async requestExport(params, options) {
|
|
4260
|
+
if (!params.tenantId) throw new Error("tenantId is required");
|
|
4261
|
+
return rb.rawPost(
|
|
4262
|
+
`/admin/audit-logs/export`,
|
|
4263
|
+
{
|
|
4264
|
+
data: {
|
|
4265
|
+
type: "audit_log",
|
|
4266
|
+
attributes: {
|
|
4267
|
+
format: params.format,
|
|
4268
|
+
tenant_id: params.tenantId,
|
|
4269
|
+
...params.fromDate && { from_date: params.fromDate },
|
|
4270
|
+
...params.toDate && { to_date: params.toDate }
|
|
4271
|
+
}
|
|
4272
|
+
}
|
|
4273
|
+
},
|
|
4274
|
+
options
|
|
4275
|
+
);
|
|
4276
|
+
}
|
|
4277
|
+
};
|
|
4278
|
+
}
|
|
4279
|
+
|
|
1704
4280
|
// src/namespaces/webhooks-ns.ts
|
|
1705
4281
|
function createWebhooksNamespace(rb) {
|
|
1706
4282
|
return {
|
|
1707
4283
|
configs: {
|
|
4284
|
+
/**
|
|
4285
|
+
* Lists all webhook configurations.
|
|
4286
|
+
*
|
|
4287
|
+
* @param options - Optional request options.
|
|
4288
|
+
* @returns Array of WebhookConfig objects.
|
|
4289
|
+
*/
|
|
1708
4290
|
list: async (options) => {
|
|
1709
4291
|
return rb.execute(getAdminWebhookConfigs, {}, options);
|
|
1710
4292
|
},
|
|
4293
|
+
/**
|
|
4294
|
+
* Registers a new webhook endpoint to receive platform events.
|
|
4295
|
+
*
|
|
4296
|
+
* The `application_id` is inferred from the API key used to make the
|
|
4297
|
+
* request. Supply it explicitly to scope the webhook to a specific application.
|
|
4298
|
+
*
|
|
4299
|
+
* @param name - Display name for the webhook configuration.
|
|
4300
|
+
* @param url - HTTPS URL that will receive event POST requests.
|
|
4301
|
+
* @param events - Event types to subscribe to (e.g. `"document.analyzed"`).
|
|
4302
|
+
* @param applicationId - Optional application ID to scope this webhook.
|
|
4303
|
+
* @param secret - Optional HMAC signing secret for payload verification.
|
|
4304
|
+
* @param options - Optional request options.
|
|
4305
|
+
* @returns The created WebhookConfig.
|
|
4306
|
+
*/
|
|
1711
4307
|
create: async (name, url, events, applicationId, secret, options) => {
|
|
1712
4308
|
return rb.execute(
|
|
1713
4309
|
postAdminWebhookConfigs,
|
|
@@ -1728,6 +4324,13 @@ function createWebhooksNamespace(rb) {
|
|
|
1728
4324
|
options
|
|
1729
4325
|
);
|
|
1730
4326
|
},
|
|
4327
|
+
/**
|
|
4328
|
+
* Fetches a single webhook configuration by ID.
|
|
4329
|
+
*
|
|
4330
|
+
* @param id - WebhookConfig ID.
|
|
4331
|
+
* @param options - Optional request options.
|
|
4332
|
+
* @returns The WebhookConfig.
|
|
4333
|
+
*/
|
|
1731
4334
|
get: async (id, options) => {
|
|
1732
4335
|
return rb.execute(
|
|
1733
4336
|
getAdminWebhookConfigsById,
|
|
@@ -1735,6 +4338,18 @@ function createWebhooksNamespace(rb) {
|
|
|
1735
4338
|
options
|
|
1736
4339
|
);
|
|
1737
4340
|
},
|
|
4341
|
+
/**
|
|
4342
|
+
* Updates webhook endpoint settings.
|
|
4343
|
+
*
|
|
4344
|
+
* Updates URL, subscribed event types, enabled state, and other mutable
|
|
4345
|
+
* fields. To change the HMAC signing secret, use the `rotate_secret`
|
|
4346
|
+
* action via the API directly instead.
|
|
4347
|
+
*
|
|
4348
|
+
* @param id - WebhookConfig ID.
|
|
4349
|
+
* @param attributes - Partial attributes to update.
|
|
4350
|
+
* @param options - Optional request options.
|
|
4351
|
+
* @returns Updated WebhookConfig.
|
|
4352
|
+
*/
|
|
1738
4353
|
update: async (id, attributes, options) => {
|
|
1739
4354
|
return rb.execute(
|
|
1740
4355
|
patchAdminWebhookConfigsById,
|
|
@@ -1745,6 +4360,15 @@ function createWebhooksNamespace(rb) {
|
|
|
1745
4360
|
options
|
|
1746
4361
|
);
|
|
1747
4362
|
},
|
|
4363
|
+
/**
|
|
4364
|
+
* Permanently deletes a webhook configuration.
|
|
4365
|
+
*
|
|
4366
|
+
* This action cannot be undone. Associated delivery records are preserved.
|
|
4367
|
+
*
|
|
4368
|
+
* @param id - WebhookConfig ID.
|
|
4369
|
+
* @param options - Optional request options.
|
|
4370
|
+
* @returns `true` on success.
|
|
4371
|
+
*/
|
|
1748
4372
|
delete: async (id, options) => {
|
|
1749
4373
|
return rb.executeDelete(
|
|
1750
4374
|
deleteAdminWebhookConfigsById,
|
|
@@ -1752,6 +4376,18 @@ function createWebhooksNamespace(rb) {
|
|
|
1752
4376
|
options
|
|
1753
4377
|
);
|
|
1754
4378
|
},
|
|
4379
|
+
/**
|
|
4380
|
+
* Sends a realistic sample payload to the webhook URL.
|
|
4381
|
+
*
|
|
4382
|
+
* Verifies connectivity and signature verification by enqueuing a
|
|
4383
|
+
* WebhookSender Oban job tagged with `test: true`. Use this to confirm
|
|
4384
|
+
* the endpoint is reachable and parsing HMAC signatures correctly before
|
|
4385
|
+
* subscribing to live events.
|
|
4386
|
+
*
|
|
4387
|
+
* @param id - WebhookConfig ID.
|
|
4388
|
+
* @param options - Optional request options.
|
|
4389
|
+
* @returns The WebhookConfig on success.
|
|
4390
|
+
*/
|
|
1755
4391
|
test: async (id, options) => {
|
|
1756
4392
|
return rb.execute(
|
|
1757
4393
|
postAdminWebhookConfigsByIdTest,
|
|
@@ -1761,6 +4397,15 @@ function createWebhooksNamespace(rb) {
|
|
|
1761
4397
|
}
|
|
1762
4398
|
},
|
|
1763
4399
|
deliveries: {
|
|
4400
|
+
/**
|
|
4401
|
+
* Lists all webhook delivery records across all configurations.
|
|
4402
|
+
*
|
|
4403
|
+
* Each delivery record tracks the attempt count, status, payload, and
|
|
4404
|
+
* response for a single event dispatch.
|
|
4405
|
+
*
|
|
4406
|
+
* @param options - Optional request options.
|
|
4407
|
+
* @returns Array of WebhookDelivery objects.
|
|
4408
|
+
*/
|
|
1764
4409
|
list: async (options) => {
|
|
1765
4410
|
return rb.execute(
|
|
1766
4411
|
getAdminWebhookDeliveries,
|
|
@@ -1768,6 +4413,13 @@ function createWebhooksNamespace(rb) {
|
|
|
1768
4413
|
options
|
|
1769
4414
|
);
|
|
1770
4415
|
},
|
|
4416
|
+
/**
|
|
4417
|
+
* Fetches a single delivery record by ID.
|
|
4418
|
+
*
|
|
4419
|
+
* @param id - WebhookDelivery ID.
|
|
4420
|
+
* @param options - Optional request options.
|
|
4421
|
+
* @returns The WebhookDelivery.
|
|
4422
|
+
*/
|
|
1771
4423
|
get: async (id, options) => {
|
|
1772
4424
|
return rb.execute(
|
|
1773
4425
|
getAdminWebhookDeliveriesById,
|
|
@@ -1775,6 +4427,17 @@ function createWebhooksNamespace(rb) {
|
|
|
1775
4427
|
options
|
|
1776
4428
|
);
|
|
1777
4429
|
},
|
|
4430
|
+
/**
|
|
4431
|
+
* Re-enqueues a failed or pending delivery for immediate re-dispatch.
|
|
4432
|
+
*
|
|
4433
|
+
* Sets the delivery status to `retrying` and inserts a new WebhookSender
|
|
4434
|
+
* Oban job. Use this to recover from transient endpoint failures without
|
|
4435
|
+
* waiting for the automatic retry schedule.
|
|
4436
|
+
*
|
|
4437
|
+
* @param id - WebhookDelivery ID.
|
|
4438
|
+
* @param options - Optional request options.
|
|
4439
|
+
* @returns Updated WebhookDelivery with status `retrying`.
|
|
4440
|
+
*/
|
|
1778
4441
|
retry: async (id, options) => {
|
|
1779
4442
|
return rb.execute(
|
|
1780
4443
|
postAdminWebhookDeliveriesByIdRetry,
|
|
@@ -1786,6 +4449,405 @@ function createWebhooksNamespace(rb) {
|
|
|
1786
4449
|
};
|
|
1787
4450
|
}
|
|
1788
4451
|
|
|
4452
|
+
// src/namespaces/campaigns.ts
|
|
4453
|
+
function createCampaignsNamespace(rb) {
|
|
4454
|
+
return {
|
|
4455
|
+
/**
|
|
4456
|
+
* Get a campaign by ID.
|
|
4457
|
+
*
|
|
4458
|
+
* @param id - The unique identifier of the campaign.
|
|
4459
|
+
* @param options - Optional request-level overrides.
|
|
4460
|
+
* @returns A promise resolving to the {@link Campaign}.
|
|
4461
|
+
*
|
|
4462
|
+
* @example
|
|
4463
|
+
* ```typescript
|
|
4464
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4465
|
+
* const campaign = await admin.campaigns.get('camp_abc123');
|
|
4466
|
+
* ```
|
|
4467
|
+
*/
|
|
4468
|
+
get: async (id, options) => {
|
|
4469
|
+
return rb.execute(
|
|
4470
|
+
getAdminEmailMarketingCampaignsById,
|
|
4471
|
+
{ path: { id } },
|
|
4472
|
+
options
|
|
4473
|
+
);
|
|
4474
|
+
},
|
|
4475
|
+
/**
|
|
4476
|
+
* List all campaigns for a workspace.
|
|
4477
|
+
*
|
|
4478
|
+
* @param workspaceId - The ID of the workspace to query.
|
|
4479
|
+
* @param options - Optional pagination and request options.
|
|
4480
|
+
* @returns A promise resolving to an array of {@link Campaign} records.
|
|
4481
|
+
*
|
|
4482
|
+
* @example
|
|
4483
|
+
* ```typescript
|
|
4484
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4485
|
+
* const campaigns = await admin.campaigns.listByWorkspace('ws_abc123');
|
|
4486
|
+
* ```
|
|
4487
|
+
*/
|
|
4488
|
+
listByWorkspace: async (workspaceId, options) => {
|
|
4489
|
+
return rb.execute(
|
|
4490
|
+
getAdminEmailMarketingCampaignsWorkspaceByWorkspaceId,
|
|
4491
|
+
{
|
|
4492
|
+
path: { workspace_id: workspaceId },
|
|
4493
|
+
...buildPageQuery(options?.page, options?.pageSize)
|
|
4494
|
+
},
|
|
4495
|
+
options
|
|
4496
|
+
);
|
|
4497
|
+
},
|
|
4498
|
+
/**
|
|
4499
|
+
* Create a new campaign.
|
|
4500
|
+
*
|
|
4501
|
+
* @param attributes - Campaign attributes including `workspace_id`, `name`, `template_id`.
|
|
4502
|
+
* @param options - Optional request-level overrides.
|
|
4503
|
+
* @returns A promise resolving to the newly created {@link Campaign}.
|
|
4504
|
+
*
|
|
4505
|
+
* @example
|
|
4506
|
+
* ```typescript
|
|
4507
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4508
|
+
* const campaign = await admin.campaigns.create({
|
|
4509
|
+
* workspace_id: 'ws_abc123',
|
|
4510
|
+
* name: 'Q1 Outreach',
|
|
4511
|
+
* template_id: 'tmpl_xyz',
|
|
4512
|
+
* });
|
|
4513
|
+
* ```
|
|
4514
|
+
*/
|
|
4515
|
+
create: async (attributes, options) => {
|
|
4516
|
+
return rb.execute(
|
|
4517
|
+
postAdminEmailMarketingCampaigns,
|
|
4518
|
+
{ body: { data: { type: "campaign", attributes } } },
|
|
4519
|
+
options
|
|
4520
|
+
);
|
|
4521
|
+
},
|
|
4522
|
+
/**
|
|
4523
|
+
* Trigger sending for an approved campaign.
|
|
4524
|
+
*
|
|
4525
|
+
* @param id - The ID of the campaign to send.
|
|
4526
|
+
* @param options - Optional request-level overrides.
|
|
4527
|
+
* @returns A promise resolving to the updated {@link Campaign}.
|
|
4528
|
+
*
|
|
4529
|
+
* @example
|
|
4530
|
+
* ```typescript
|
|
4531
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4532
|
+
* await admin.campaigns.send('camp_abc123');
|
|
4533
|
+
* ```
|
|
4534
|
+
*/
|
|
4535
|
+
send: async (id, options) => {
|
|
4536
|
+
return rb.execute(
|
|
4537
|
+
postAdminEmailMarketingCampaignsByIdSend,
|
|
4538
|
+
{ path: { id }, body: {} },
|
|
4539
|
+
options
|
|
4540
|
+
);
|
|
4541
|
+
},
|
|
4542
|
+
/**
|
|
4543
|
+
* Delete a campaign.
|
|
4544
|
+
*
|
|
4545
|
+
* @param id - The unique identifier of the campaign to delete.
|
|
4546
|
+
* @param options - Optional request-level overrides.
|
|
4547
|
+
* @returns A promise that resolves to `true` on successful deletion.
|
|
4548
|
+
*
|
|
4549
|
+
* @example
|
|
4550
|
+
* ```typescript
|
|
4551
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4552
|
+
* await admin.campaigns.delete('camp_abc123');
|
|
4553
|
+
* ```
|
|
4554
|
+
*/
|
|
4555
|
+
delete: async (id, options) => {
|
|
4556
|
+
return rb.executeDelete(
|
|
4557
|
+
deleteAdminEmailMarketingCampaignsById,
|
|
4558
|
+
{ path: { id } },
|
|
4559
|
+
options
|
|
4560
|
+
);
|
|
4561
|
+
}
|
|
4562
|
+
};
|
|
4563
|
+
}
|
|
4564
|
+
|
|
4565
|
+
// src/namespaces/email.ts
|
|
4566
|
+
function createEmailNamespace(rb) {
|
|
4567
|
+
return {
|
|
4568
|
+
/**
|
|
4569
|
+
* Outbound email management — admin view across all workspaces.
|
|
4570
|
+
*/
|
|
4571
|
+
outboundEmails: {
|
|
4572
|
+
/**
|
|
4573
|
+
* Get an outbound email by ID.
|
|
4574
|
+
*
|
|
4575
|
+
* @param id - The unique identifier of the outbound email.
|
|
4576
|
+
* @param options - Optional request-level overrides.
|
|
4577
|
+
* @returns A promise resolving to the {@link EmailOutboundEmail}.
|
|
4578
|
+
*
|
|
4579
|
+
* @example
|
|
4580
|
+
* ```typescript
|
|
4581
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4582
|
+
* const email = await admin.email.outboundEmails.get('oe_abc123');
|
|
4583
|
+
* ```
|
|
4584
|
+
*/
|
|
4585
|
+
get: async (id, options) => {
|
|
4586
|
+
return rb.execute(
|
|
4587
|
+
getAdminEmailOutboundEmailsById,
|
|
4588
|
+
{ path: { id } },
|
|
4589
|
+
options
|
|
4590
|
+
);
|
|
4591
|
+
},
|
|
4592
|
+
/**
|
|
4593
|
+
* List outbound emails for a workspace.
|
|
4594
|
+
*
|
|
4595
|
+
* @param workspaceId - The ID of the workspace to query.
|
|
4596
|
+
* @param options - Optional pagination and request options.
|
|
4597
|
+
* @returns A promise resolving to an array of {@link EmailOutboundEmail}.
|
|
4598
|
+
*
|
|
4599
|
+
* @example
|
|
4600
|
+
* ```typescript
|
|
4601
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4602
|
+
* const emails = await admin.email.outboundEmails.listByWorkspace('ws_abc123');
|
|
4603
|
+
* ```
|
|
4604
|
+
*/
|
|
4605
|
+
listByWorkspace: async (workspaceId, options) => {
|
|
4606
|
+
return rb.execute(
|
|
4607
|
+
getAdminEmailOutboundEmailsWorkspaceByWorkspaceId,
|
|
4608
|
+
{
|
|
4609
|
+
path: { workspace_id: workspaceId },
|
|
4610
|
+
...buildPageQuery(options?.page, options?.pageSize)
|
|
4611
|
+
},
|
|
4612
|
+
options
|
|
4613
|
+
);
|
|
4614
|
+
},
|
|
4615
|
+
/**
|
|
4616
|
+
* Create an outbound email draft.
|
|
4617
|
+
*
|
|
4618
|
+
* @param attributes - Email attributes including `workspace_id`, `subject`, `body_html`, `sender_profile_id`.
|
|
4619
|
+
* @param options - Optional request-level overrides.
|
|
4620
|
+
* @returns A promise resolving to the created {@link EmailOutboundEmail}.
|
|
4621
|
+
*
|
|
4622
|
+
* @example
|
|
4623
|
+
* ```typescript
|
|
4624
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4625
|
+
* const email = await admin.email.outboundEmails.create({
|
|
4626
|
+
* workspace_id: 'ws_abc123',
|
|
4627
|
+
* subject: 'Admin notification',
|
|
4628
|
+
* body_html: '<p>Hello</p>',
|
|
4629
|
+
* sender_profile_id: 'sp_noreply',
|
|
4630
|
+
* });
|
|
4631
|
+
* ```
|
|
4632
|
+
*/
|
|
4633
|
+
create: async (attributes, options) => {
|
|
4634
|
+
return rb.execute(
|
|
4635
|
+
postAdminEmailOutboundEmails,
|
|
4636
|
+
{ body: { data: { type: "email_outbound_email", attributes } } },
|
|
4637
|
+
options
|
|
4638
|
+
);
|
|
4639
|
+
},
|
|
4640
|
+
/**
|
|
4641
|
+
* Delete an outbound email draft.
|
|
4642
|
+
*
|
|
4643
|
+
* @param id - The unique identifier of the outbound email to delete.
|
|
4644
|
+
* @param options - Optional request-level overrides.
|
|
4645
|
+
* @returns A promise that resolves to `true` on successful deletion.
|
|
4646
|
+
*
|
|
4647
|
+
* @example
|
|
4648
|
+
* ```typescript
|
|
4649
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4650
|
+
* await admin.email.outboundEmails.delete('oe_abc123');
|
|
4651
|
+
* ```
|
|
4652
|
+
*/
|
|
4653
|
+
delete: async (id, options) => {
|
|
4654
|
+
return rb.executeDelete(
|
|
4655
|
+
deleteAdminEmailOutboundEmailsById,
|
|
4656
|
+
{ path: { id } },
|
|
4657
|
+
options
|
|
4658
|
+
);
|
|
4659
|
+
}
|
|
4660
|
+
},
|
|
4661
|
+
/**
|
|
4662
|
+
* Sender profile management — admin view across all workspaces.
|
|
4663
|
+
*/
|
|
4664
|
+
senderProfiles: {
|
|
4665
|
+
/**
|
|
4666
|
+
* Get a sender profile by ID.
|
|
4667
|
+
*
|
|
4668
|
+
* @param id - The unique identifier of the sender profile.
|
|
4669
|
+
* @param options - Optional request-level overrides.
|
|
4670
|
+
* @returns A promise resolving to the {@link EmailMarketingSenderProfile}.
|
|
4671
|
+
*
|
|
4672
|
+
* @example
|
|
4673
|
+
* ```typescript
|
|
4674
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4675
|
+
* const profile = await admin.email.senderProfiles.get('sp_abc123');
|
|
4676
|
+
* ```
|
|
4677
|
+
*/
|
|
4678
|
+
get: async (id, options) => {
|
|
4679
|
+
return rb.execute(
|
|
4680
|
+
getAdminEmailMarketingSenderProfilesById,
|
|
4681
|
+
{ path: { id } },
|
|
4682
|
+
options
|
|
4683
|
+
);
|
|
4684
|
+
},
|
|
4685
|
+
/**
|
|
4686
|
+
* List sender profiles for a workspace.
|
|
4687
|
+
*
|
|
4688
|
+
* @param workspaceId - The ID of the workspace to query.
|
|
4689
|
+
* @param options - Optional pagination and request options.
|
|
4690
|
+
* @returns A promise resolving to an array of {@link EmailMarketingSenderProfile}.
|
|
4691
|
+
*
|
|
4692
|
+
* @example
|
|
4693
|
+
* ```typescript
|
|
4694
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4695
|
+
* const profiles = await admin.email.senderProfiles.listByWorkspace('ws_abc123');
|
|
4696
|
+
* ```
|
|
4697
|
+
*/
|
|
4698
|
+
listByWorkspace: async (workspaceId, options) => {
|
|
4699
|
+
return rb.execute(
|
|
4700
|
+
getAdminEmailMarketingSenderProfilesWorkspaceByWorkspaceId,
|
|
4701
|
+
{
|
|
4702
|
+
path: { workspace_id: workspaceId },
|
|
4703
|
+
...buildPageQuery(options?.page, options?.pageSize)
|
|
4704
|
+
},
|
|
4705
|
+
options
|
|
4706
|
+
);
|
|
4707
|
+
},
|
|
4708
|
+
/**
|
|
4709
|
+
* Create a new sender profile.
|
|
4710
|
+
*
|
|
4711
|
+
* @param attributes - Profile attributes including `workspace_id`, `from_email`, `from_name`.
|
|
4712
|
+
* @param options - Optional request-level overrides.
|
|
4713
|
+
* @returns A promise resolving to the created {@link EmailMarketingSenderProfile}.
|
|
4714
|
+
*
|
|
4715
|
+
* @example
|
|
4716
|
+
* ```typescript
|
|
4717
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4718
|
+
* const profile = await admin.email.senderProfiles.create({
|
|
4719
|
+
* workspace_id: 'ws_abc123',
|
|
4720
|
+
* from_email: 'noreply@acme.com',
|
|
4721
|
+
* from_name: 'Acme Team',
|
|
4722
|
+
* });
|
|
4723
|
+
* ```
|
|
4724
|
+
*/
|
|
4725
|
+
create: async (attributes, options) => {
|
|
4726
|
+
return rb.execute(
|
|
4727
|
+
postAdminEmailMarketingSenderProfiles,
|
|
4728
|
+
{ body: { data: { type: "email_sender_profile", attributes } } },
|
|
4729
|
+
options
|
|
4730
|
+
);
|
|
4731
|
+
},
|
|
4732
|
+
/**
|
|
4733
|
+
* Update a sender profile.
|
|
4734
|
+
*
|
|
4735
|
+
* @param id - The unique identifier of the sender profile to update.
|
|
4736
|
+
* @param attributes - Attributes to update.
|
|
4737
|
+
* @param options - Optional request-level overrides.
|
|
4738
|
+
* @returns A promise resolving to the updated {@link EmailMarketingSenderProfile}.
|
|
4739
|
+
*
|
|
4740
|
+
* @example
|
|
4741
|
+
* ```typescript
|
|
4742
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4743
|
+
* const profile = await admin.email.senderProfiles.update('sp_abc123', {
|
|
4744
|
+
* from_name: 'Acme Support',
|
|
4745
|
+
* });
|
|
4746
|
+
* ```
|
|
4747
|
+
*/
|
|
4748
|
+
update: async (id, attributes, options) => {
|
|
4749
|
+
return rb.execute(
|
|
4750
|
+
patchAdminEmailMarketingSenderProfilesById,
|
|
4751
|
+
{
|
|
4752
|
+
path: { id },
|
|
4753
|
+
body: { data: { id, type: "email_sender_profile", attributes } }
|
|
4754
|
+
},
|
|
4755
|
+
options
|
|
4756
|
+
);
|
|
4757
|
+
},
|
|
4758
|
+
/**
|
|
4759
|
+
* Delete a sender profile.
|
|
4760
|
+
*
|
|
4761
|
+
* @param id - The unique identifier of the sender profile to delete.
|
|
4762
|
+
* @param options - Optional request-level overrides.
|
|
4763
|
+
* @returns A promise that resolves to `true` on successful deletion.
|
|
4764
|
+
*
|
|
4765
|
+
* @example
|
|
4766
|
+
* ```typescript
|
|
4767
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4768
|
+
* await admin.email.senderProfiles.delete('sp_abc123');
|
|
4769
|
+
* ```
|
|
4770
|
+
*/
|
|
4771
|
+
delete: async (id, options) => {
|
|
4772
|
+
return rb.executeDelete(
|
|
4773
|
+
deleteAdminEmailMarketingSenderProfilesById,
|
|
4774
|
+
{ path: { id } },
|
|
4775
|
+
options
|
|
4776
|
+
);
|
|
4777
|
+
},
|
|
4778
|
+
/**
|
|
4779
|
+
* Trigger DNS validation for a sender profile (verifies SPF/DKIM/DMARC).
|
|
4780
|
+
*
|
|
4781
|
+
* @param id - The unique identifier of the sender profile.
|
|
4782
|
+
* @param options - Optional request-level overrides.
|
|
4783
|
+
* @returns A promise resolving to the updated {@link EmailMarketingSenderProfile} with DNS status.
|
|
4784
|
+
*
|
|
4785
|
+
* @example
|
|
4786
|
+
* ```typescript
|
|
4787
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4788
|
+
* const result = await admin.email.senderProfiles.validateDns('sp_abc123');
|
|
4789
|
+
* console.log(result.attributes.spf_valid, result.attributes.dkim_valid);
|
|
4790
|
+
* ```
|
|
4791
|
+
*/
|
|
4792
|
+
validateDns: async (id, options) => {
|
|
4793
|
+
return rb.execute(
|
|
4794
|
+
patchAdminEmailMarketingSenderProfilesByIdValidateDns,
|
|
4795
|
+
{ path: { id }, body: {} },
|
|
4796
|
+
options
|
|
4797
|
+
);
|
|
4798
|
+
}
|
|
4799
|
+
},
|
|
4800
|
+
/**
|
|
4801
|
+
* Tracking event management — admin view across all workspaces.
|
|
4802
|
+
*/
|
|
4803
|
+
trackingEvents: {
|
|
4804
|
+
/**
|
|
4805
|
+
* Get a tracking event by ID.
|
|
4806
|
+
*
|
|
4807
|
+
* @param id - The unique identifier of the tracking event.
|
|
4808
|
+
* @param options - Optional request-level overrides.
|
|
4809
|
+
* @returns A promise resolving to the tracking event record.
|
|
4810
|
+
*
|
|
4811
|
+
* @example
|
|
4812
|
+
* ```typescript
|
|
4813
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4814
|
+
* const event = await admin.email.trackingEvents.get('te_abc123');
|
|
4815
|
+
* ```
|
|
4816
|
+
*/
|
|
4817
|
+
get: async (id, options) => {
|
|
4818
|
+
return rb.execute(
|
|
4819
|
+
getAdminEmailTrackingEventsById,
|
|
4820
|
+
{ path: { id } },
|
|
4821
|
+
options
|
|
4822
|
+
);
|
|
4823
|
+
},
|
|
4824
|
+
/**
|
|
4825
|
+
* List tracking events for a workspace.
|
|
4826
|
+
*
|
|
4827
|
+
* @param workspaceId - The ID of the workspace to query.
|
|
4828
|
+
* @param options - Optional pagination and request options.
|
|
4829
|
+
* @returns A promise resolving to an array of {@link EmailTrackingEvent} records.
|
|
4830
|
+
*
|
|
4831
|
+
* @example
|
|
4832
|
+
* ```typescript
|
|
4833
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
4834
|
+
* const events = await admin.email.trackingEvents.listByWorkspace('ws_abc123');
|
|
4835
|
+
* ```
|
|
4836
|
+
*/
|
|
4837
|
+
listByWorkspace: async (workspaceId, options) => {
|
|
4838
|
+
return rb.execute(
|
|
4839
|
+
getAdminEmailTrackingEventsWorkspaceByWorkspaceId,
|
|
4840
|
+
{
|
|
4841
|
+
path: { workspace_id: workspaceId },
|
|
4842
|
+
...buildPageQuery(options?.page, options?.pageSize)
|
|
4843
|
+
},
|
|
4844
|
+
options
|
|
4845
|
+
);
|
|
4846
|
+
}
|
|
4847
|
+
}
|
|
4848
|
+
};
|
|
4849
|
+
}
|
|
4850
|
+
|
|
1789
4851
|
// src/gpt-admin.ts
|
|
1790
4852
|
var GptAdmin = class extends BaseClient {
|
|
1791
4853
|
constructor(config) {
|
|
@@ -1796,12 +4858,19 @@ var GptAdmin = class extends BaseClient {
|
|
|
1796
4858
|
(d) => this.unwrap(d),
|
|
1797
4859
|
(fn) => this.requestWithRetry(fn)
|
|
1798
4860
|
);
|
|
4861
|
+
this.agents = createAgentsNamespace(rb);
|
|
1799
4862
|
this.accounts = createAccountsNamespace(rb);
|
|
4863
|
+
this.capabilities = createCapabilitiesNamespace(rb);
|
|
1800
4864
|
this.apiKeys = createApiKeysNamespace(rb);
|
|
1801
4865
|
this.documents = createDocumentsNamespace(rb);
|
|
1802
4866
|
this.executions = createExecutionsNamespace(rb);
|
|
1803
4867
|
this.storage = createStorageNamespace(rb);
|
|
4868
|
+
this.users = createUsersNamespace(rb);
|
|
4869
|
+
this.voice = createVoiceNamespace(rb);
|
|
4870
|
+
this.audit = createAuditNamespace(rb);
|
|
1804
4871
|
this.webhooks = createWebhooksNamespace(rb);
|
|
4872
|
+
this.campaigns = createCampaignsNamespace(rb);
|
|
4873
|
+
this.email = createEmailNamespace(rb);
|
|
1805
4874
|
}
|
|
1806
4875
|
};
|
|
1807
4876
|
|