@gpt-platform/admin 0.4.2 → 0.4.3
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 +6040 -1086
- package/dist/index.d.ts +6040 -1086
- package/dist/index.js +631 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +631 -1
- package/dist/index.mjs.map +1 -1
- package/llms.txt +11 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -814,7 +814,7 @@ var createClient = (config = {}) => {
|
|
|
814
814
|
};
|
|
815
815
|
|
|
816
816
|
// src/version.ts
|
|
817
|
-
var SDK_VERSION = "0.4.
|
|
817
|
+
var SDK_VERSION = "0.4.3";
|
|
818
818
|
var DEFAULT_API_VERSION = "2026-02-27";
|
|
819
819
|
|
|
820
820
|
// src/base-client.ts
|
|
@@ -1331,6 +1331,11 @@ var client = createClient(
|
|
|
1331
1331
|
);
|
|
1332
1332
|
|
|
1333
1333
|
// src/_internal/sdk.gen.ts
|
|
1334
|
+
var getAdminWallet = (options) => (options.client ?? client).get({
|
|
1335
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1336
|
+
url: "/admin/wallet",
|
|
1337
|
+
...options
|
|
1338
|
+
});
|
|
1334
1339
|
var getAdminFieldTemplates = (options) => (options.client ?? client).get({
|
|
1335
1340
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1336
1341
|
url: "/admin/field-templates",
|
|
@@ -1374,6 +1379,20 @@ var getAdminTrainingSessionsAgentsByAgentIdSessions = (options) => (options.clie
|
|
|
1374
1379
|
url: "/admin/training-sessions/agents/{agent_id}/sessions",
|
|
1375
1380
|
...options
|
|
1376
1381
|
});
|
|
1382
|
+
var getAdminTenantPricingOverrides = (options) => (options.client ?? client).get({
|
|
1383
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1384
|
+
url: "/admin/tenant-pricing-overrides",
|
|
1385
|
+
...options
|
|
1386
|
+
});
|
|
1387
|
+
var postAdminTenantPricingOverrides = (options) => (options.client ?? client).post({
|
|
1388
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1389
|
+
url: "/admin/tenant-pricing-overrides",
|
|
1390
|
+
...options,
|
|
1391
|
+
headers: {
|
|
1392
|
+
"Content-Type": "application/vnd.api+json",
|
|
1393
|
+
...options.headers
|
|
1394
|
+
}
|
|
1395
|
+
});
|
|
1377
1396
|
var patchAdminApiKeysByIdSetBudget = (options) => (options.client ?? client).patch({
|
|
1378
1397
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1379
1398
|
url: "/admin/api-keys/{id}/set-budget",
|
|
@@ -1402,11 +1421,39 @@ var getAdminAgentsById = (options) => (options.client ?? client).get({
|
|
|
1402
1421
|
url: "/admin/agents/{id}",
|
|
1403
1422
|
...options
|
|
1404
1423
|
});
|
|
1424
|
+
var getAdminSettlements = (options) => (options.client ?? client).get({
|
|
1425
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1426
|
+
url: "/admin/settlements",
|
|
1427
|
+
...options
|
|
1428
|
+
});
|
|
1429
|
+
var postAdminSettlements = (options) => (options.client ?? client).post({
|
|
1430
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1431
|
+
url: "/admin/settlements",
|
|
1432
|
+
...options,
|
|
1433
|
+
headers: {
|
|
1434
|
+
"Content-Type": "application/vnd.api+json",
|
|
1435
|
+
...options.headers
|
|
1436
|
+
}
|
|
1437
|
+
});
|
|
1405
1438
|
var postAdminAgentsByIdExport = (options) => (options.client ?? client).post({
|
|
1406
1439
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1407
1440
|
url: "/admin/agents/{id}/export",
|
|
1408
1441
|
...options
|
|
1409
1442
|
});
|
|
1443
|
+
var patchAdminApplicationsByIdGrantCredits = (options) => (options.client ?? client).patch({
|
|
1444
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1445
|
+
url: "/admin/applications/{id}/grant-credits",
|
|
1446
|
+
...options,
|
|
1447
|
+
headers: {
|
|
1448
|
+
"Content-Type": "application/vnd.api+json",
|
|
1449
|
+
...options.headers
|
|
1450
|
+
}
|
|
1451
|
+
});
|
|
1452
|
+
var getAdminSettlementsById = (options) => (options.client ?? client).get({
|
|
1453
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1454
|
+
url: "/admin/settlements/{id}",
|
|
1455
|
+
...options
|
|
1456
|
+
});
|
|
1410
1457
|
var postAdminAgentsByIdRestoreVersion = (options) => (options.client ?? client).post({
|
|
1411
1458
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1412
1459
|
url: "/admin/agents/{id}/restore-version",
|
|
@@ -1421,6 +1468,25 @@ var getAdminAgentsByIdTrainingExamples = (options) => (options.client ?? client)
|
|
|
1421
1468
|
url: "/admin/agents/{id}/training-examples",
|
|
1422
1469
|
...options
|
|
1423
1470
|
});
|
|
1471
|
+
var deleteAdminTenantPricingOverridesById = (options) => (options.client ?? client).delete({
|
|
1472
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1473
|
+
url: "/admin/tenant-pricing-overrides/{id}",
|
|
1474
|
+
...options
|
|
1475
|
+
});
|
|
1476
|
+
var getAdminTenantPricingOverridesById = (options) => (options.client ?? client).get({
|
|
1477
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1478
|
+
url: "/admin/tenant-pricing-overrides/{id}",
|
|
1479
|
+
...options
|
|
1480
|
+
});
|
|
1481
|
+
var patchAdminTenantPricingOverridesById = (options) => (options.client ?? client).patch({
|
|
1482
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1483
|
+
url: "/admin/tenant-pricing-overrides/{id}",
|
|
1484
|
+
...options,
|
|
1485
|
+
headers: {
|
|
1486
|
+
"Content-Type": "application/vnd.api+json",
|
|
1487
|
+
...options.headers
|
|
1488
|
+
}
|
|
1489
|
+
});
|
|
1424
1490
|
var deleteAdminEmailMarketingCampaignsById = (options) => (options.client ?? client).delete({
|
|
1425
1491
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1426
1492
|
url: "/admin/email-marketing/campaigns/{id}",
|
|
@@ -1564,6 +1630,20 @@ var getAdminFieldTemplatesById = (options) => (options.client ?? client).get({
|
|
|
1564
1630
|
url: "/admin/field-templates/{id}",
|
|
1565
1631
|
...options
|
|
1566
1632
|
});
|
|
1633
|
+
var getAdminPlans = (options) => (options.client ?? client).get({
|
|
1634
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1635
|
+
url: "/admin/plans",
|
|
1636
|
+
...options
|
|
1637
|
+
});
|
|
1638
|
+
var postAdminPlans = (options) => (options.client ?? client).post({
|
|
1639
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1640
|
+
url: "/admin/plans",
|
|
1641
|
+
...options,
|
|
1642
|
+
headers: {
|
|
1643
|
+
"Content-Type": "application/vnd.api+json",
|
|
1644
|
+
...options.headers
|
|
1645
|
+
}
|
|
1646
|
+
});
|
|
1567
1647
|
var getAdminVoiceSessionsById = (options) => (options.client ?? client).get({
|
|
1568
1648
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1569
1649
|
url: "/admin/voice/sessions/{id}",
|
|
@@ -1620,6 +1700,20 @@ var getAdminVoiceTranscriptionResultsById = (options) => (options.client ?? clie
|
|
|
1620
1700
|
url: "/admin/voice/transcription-results/{id}",
|
|
1621
1701
|
...options
|
|
1622
1702
|
});
|
|
1703
|
+
var getAdminPricingStrategies = (options) => (options.client ?? client).get({
|
|
1704
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1705
|
+
url: "/admin/pricing-strategies",
|
|
1706
|
+
...options
|
|
1707
|
+
});
|
|
1708
|
+
var postAdminPricingStrategies = (options) => (options.client ?? client).post({
|
|
1709
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1710
|
+
url: "/admin/pricing-strategies",
|
|
1711
|
+
...options,
|
|
1712
|
+
headers: {
|
|
1713
|
+
"Content-Type": "application/vnd.api+json",
|
|
1714
|
+
...options.headers
|
|
1715
|
+
}
|
|
1716
|
+
});
|
|
1623
1717
|
var getAdminApiKeys = (options) => (options.client ?? client).get({
|
|
1624
1718
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1625
1719
|
url: "/admin/api-keys",
|
|
@@ -1639,6 +1733,15 @@ var getAdminExtractionDocumentsById = (options) => (options.client ?? client).ge
|
|
|
1639
1733
|
url: "/admin/extraction/documents/{id}",
|
|
1640
1734
|
...options
|
|
1641
1735
|
});
|
|
1736
|
+
var patchAdminWalletCredits = (options) => (options.client ?? client).patch({
|
|
1737
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1738
|
+
url: "/admin/wallet/credits",
|
|
1739
|
+
...options,
|
|
1740
|
+
headers: {
|
|
1741
|
+
"Content-Type": "application/vnd.api+json",
|
|
1742
|
+
...options.headers
|
|
1743
|
+
}
|
|
1744
|
+
});
|
|
1642
1745
|
var getAdminAccounts = (options) => (options.client ?? client).get({
|
|
1643
1746
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1644
1747
|
url: "/admin/accounts",
|
|
@@ -1678,6 +1781,15 @@ var getAdminAccountsById = (options) => (options.client ?? client).get({
|
|
|
1678
1781
|
url: "/admin/accounts/{id}",
|
|
1679
1782
|
...options
|
|
1680
1783
|
});
|
|
1784
|
+
var patchAdminWalletPlan = (options) => (options.client ?? client).patch({
|
|
1785
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1786
|
+
url: "/admin/wallet/plan",
|
|
1787
|
+
...options,
|
|
1788
|
+
headers: {
|
|
1789
|
+
"Content-Type": "application/vnd.api+json",
|
|
1790
|
+
...options.headers
|
|
1791
|
+
}
|
|
1792
|
+
});
|
|
1681
1793
|
var deleteAdminUsersById = (options) => (options.client ?? client).delete({
|
|
1682
1794
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1683
1795
|
url: "/admin/users/{id}",
|
|
@@ -1717,6 +1829,11 @@ var patchAdminEmailMarketingSenderProfilesById = (options) => (options.client ??
|
|
|
1717
1829
|
...options.headers
|
|
1718
1830
|
}
|
|
1719
1831
|
});
|
|
1832
|
+
var getAdminWalletUsage = (options) => (options.client ?? client).get({
|
|
1833
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1834
|
+
url: "/admin/wallet/usage",
|
|
1835
|
+
...options
|
|
1836
|
+
});
|
|
1720
1837
|
var getAdminAgentVersions = (options) => (options.client ?? client).get({
|
|
1721
1838
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1722
1839
|
url: "/admin/agent-versions",
|
|
@@ -1850,6 +1967,34 @@ var patchAdminUsersByIdAdmin = (options) => (options.client ?? client).patch({
|
|
|
1850
1967
|
...options.headers
|
|
1851
1968
|
}
|
|
1852
1969
|
});
|
|
1970
|
+
var getAdminWholesaleAgreementsById = (options) => (options.client ?? client).get({
|
|
1971
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1972
|
+
url: "/admin/wholesale-agreements/{id}",
|
|
1973
|
+
...options
|
|
1974
|
+
});
|
|
1975
|
+
var patchAdminWholesaleAgreementsById = (options) => (options.client ?? client).patch({
|
|
1976
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1977
|
+
url: "/admin/wholesale-agreements/{id}",
|
|
1978
|
+
...options,
|
|
1979
|
+
headers: {
|
|
1980
|
+
"Content-Type": "application/vnd.api+json",
|
|
1981
|
+
...options.headers
|
|
1982
|
+
}
|
|
1983
|
+
});
|
|
1984
|
+
var getAdminPricingStrategiesById = (options) => (options.client ?? client).get({
|
|
1985
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1986
|
+
url: "/admin/pricing-strategies/{id}",
|
|
1987
|
+
...options
|
|
1988
|
+
});
|
|
1989
|
+
var patchAdminPricingStrategiesById = (options) => (options.client ?? client).patch({
|
|
1990
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1991
|
+
url: "/admin/pricing-strategies/{id}",
|
|
1992
|
+
...options,
|
|
1993
|
+
headers: {
|
|
1994
|
+
"Content-Type": "application/vnd.api+json",
|
|
1995
|
+
...options.headers
|
|
1996
|
+
}
|
|
1997
|
+
});
|
|
1853
1998
|
var getAdminAgentsByIdTrainingStats = (options) => (options.client ?? client).get({
|
|
1854
1999
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1855
2000
|
url: "/admin/agents/{id}/training-stats",
|
|
@@ -1901,6 +2046,20 @@ var postAdminAgentsByIdTeach = (options) => (options.client ?? client).post({
|
|
|
1901
2046
|
...options.headers
|
|
1902
2047
|
}
|
|
1903
2048
|
});
|
|
2049
|
+
var getAdminWholesaleAgreements = (options) => (options.client ?? client).get({
|
|
2050
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2051
|
+
url: "/admin/wholesale-agreements",
|
|
2052
|
+
...options
|
|
2053
|
+
});
|
|
2054
|
+
var postAdminWholesaleAgreements = (options) => (options.client ?? client).post({
|
|
2055
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2056
|
+
url: "/admin/wholesale-agreements",
|
|
2057
|
+
...options,
|
|
2058
|
+
headers: {
|
|
2059
|
+
"Content-Type": "application/vnd.api+json",
|
|
2060
|
+
...options.headers
|
|
2061
|
+
}
|
|
2062
|
+
});
|
|
1904
2063
|
var patchAdminAgentsByIdSchemaVersionsByVersionId = (options) => (options.client ?? client).patch({
|
|
1905
2064
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1906
2065
|
url: "/admin/agents/{id}/schema-versions/{version_id}",
|
|
@@ -1957,6 +2116,25 @@ var getAdminBucketsById = (options) => (options.client ?? client).get({
|
|
|
1957
2116
|
url: "/admin/buckets/{id}",
|
|
1958
2117
|
...options
|
|
1959
2118
|
});
|
|
2119
|
+
var deleteAdminPlansById = (options) => (options.client ?? client).delete({
|
|
2120
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2121
|
+
url: "/admin/plans/{id}",
|
|
2122
|
+
...options
|
|
2123
|
+
});
|
|
2124
|
+
var getAdminPlansById = (options) => (options.client ?? client).get({
|
|
2125
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2126
|
+
url: "/admin/plans/{id}",
|
|
2127
|
+
...options
|
|
2128
|
+
});
|
|
2129
|
+
var patchAdminPlansById = (options) => (options.client ?? client).patch({
|
|
2130
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2131
|
+
url: "/admin/plans/{id}",
|
|
2132
|
+
...options,
|
|
2133
|
+
headers: {
|
|
2134
|
+
"Content-Type": "application/vnd.api+json",
|
|
2135
|
+
...options.headers
|
|
2136
|
+
}
|
|
2137
|
+
});
|
|
1960
2138
|
var patchAdminUsersByIdResetPassword = (options) => (options.client ?? client).patch({
|
|
1961
2139
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1962
2140
|
url: "/admin/users/{id}/reset-password",
|
|
@@ -4809,6 +4987,457 @@ function createEmailNamespace(rb) {
|
|
|
4809
4987
|
};
|
|
4810
4988
|
}
|
|
4811
4989
|
|
|
4990
|
+
// src/namespaces/billing.ts
|
|
4991
|
+
function createBillingNamespace(rb) {
|
|
4992
|
+
return {
|
|
4993
|
+
wallet: {
|
|
4994
|
+
/**
|
|
4995
|
+
* Fetch the wallet for the current authenticated context.
|
|
4996
|
+
*
|
|
4997
|
+
* @param options - Optional request-level overrides.
|
|
4998
|
+
* @returns A promise resolving to the {@link Wallet}.
|
|
4999
|
+
*
|
|
5000
|
+
* @example
|
|
5001
|
+
* ```typescript
|
|
5002
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
5003
|
+
* const wallet = await admin.billing.wallet.get();
|
|
5004
|
+
* console.log(`Balance: ${wallet.attributes?.balance_credits} credits`);
|
|
5005
|
+
* ```
|
|
5006
|
+
*/
|
|
5007
|
+
get: async (options) => {
|
|
5008
|
+
return rb.execute(getAdminWallet, {}, options);
|
|
5009
|
+
},
|
|
5010
|
+
/**
|
|
5011
|
+
* Change the subscription plan on the wallet.
|
|
5012
|
+
*
|
|
5013
|
+
* Upgrades charge a prorated amount immediately against the default payment
|
|
5014
|
+
* method. Downgrades are deferred to the end of the current billing period.
|
|
5015
|
+
*
|
|
5016
|
+
* @param walletId - The wallet UUID from `wallet.get()`.
|
|
5017
|
+
* @param planSlug - The slug of the target plan (e.g. `"pro-monthly"`).
|
|
5018
|
+
* @param options - Optional request-level overrides.
|
|
5019
|
+
* @returns A promise resolving to the updated {@link Wallet}.
|
|
5020
|
+
*
|
|
5021
|
+
* @example
|
|
5022
|
+
* ```typescript
|
|
5023
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
5024
|
+
* const wallet = await admin.billing.wallet.get();
|
|
5025
|
+
* await admin.billing.wallet.changePlan(wallet.id as string, 'enterprise-annual');
|
|
5026
|
+
* ```
|
|
5027
|
+
*/
|
|
5028
|
+
changePlan: async (walletId, planSlug, options) => {
|
|
5029
|
+
return rb.execute(
|
|
5030
|
+
patchAdminWalletPlan,
|
|
5031
|
+
{
|
|
5032
|
+
body: {
|
|
5033
|
+
data: {
|
|
5034
|
+
id: walletId,
|
|
5035
|
+
type: "wallet",
|
|
5036
|
+
attributes: { plan_slug: planSlug }
|
|
5037
|
+
}
|
|
5038
|
+
}
|
|
5039
|
+
},
|
|
5040
|
+
options
|
|
5041
|
+
);
|
|
5042
|
+
},
|
|
5043
|
+
/**
|
|
5044
|
+
* Adjust credits on the wallet by purchasing a credit package.
|
|
5045
|
+
*
|
|
5046
|
+
* @param walletId - The wallet UUID from `wallet.get()`.
|
|
5047
|
+
* @param packageSlug - The slug of the credit package to purchase.
|
|
5048
|
+
* @param paymentMethodId - Optional payment method UUID. Uses the default if omitted.
|
|
5049
|
+
* @param options - Optional request-level overrides.
|
|
5050
|
+
* @returns A promise resolving to the updated {@link Wallet}.
|
|
5051
|
+
*
|
|
5052
|
+
* @example
|
|
5053
|
+
* ```typescript
|
|
5054
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
5055
|
+
* const wallet = await admin.billing.wallet.get();
|
|
5056
|
+
* await admin.billing.wallet.adjustCredits(wallet.id as string, 'starter-1000');
|
|
5057
|
+
* ```
|
|
5058
|
+
*/
|
|
5059
|
+
adjustCredits: async (walletId, packageSlug, paymentMethodId, options) => {
|
|
5060
|
+
const attributes = {
|
|
5061
|
+
package_slug: packageSlug
|
|
5062
|
+
};
|
|
5063
|
+
if (paymentMethodId !== void 0) {
|
|
5064
|
+
attributes.payment_method_id = paymentMethodId;
|
|
5065
|
+
}
|
|
5066
|
+
return rb.execute(
|
|
5067
|
+
patchAdminWalletCredits,
|
|
5068
|
+
{
|
|
5069
|
+
body: {
|
|
5070
|
+
data: {
|
|
5071
|
+
id: walletId,
|
|
5072
|
+
type: "wallet",
|
|
5073
|
+
attributes
|
|
5074
|
+
}
|
|
5075
|
+
}
|
|
5076
|
+
},
|
|
5077
|
+
options
|
|
5078
|
+
);
|
|
5079
|
+
},
|
|
5080
|
+
/**
|
|
5081
|
+
* Get credit usage history for the wallet.
|
|
5082
|
+
*
|
|
5083
|
+
* @param tenantId - Optional tenant ID to scope the usage query.
|
|
5084
|
+
* @param options - Optional request-level overrides.
|
|
5085
|
+
* @returns A promise resolving to a {@link Wallet} with usage data.
|
|
5086
|
+
*
|
|
5087
|
+
* @example
|
|
5088
|
+
* ```typescript
|
|
5089
|
+
* const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
|
|
5090
|
+
* const usage = await admin.billing.wallet.getUsage('tenant_abc123');
|
|
5091
|
+
* ```
|
|
5092
|
+
*/
|
|
5093
|
+
getUsage: async (tenantId, options) => {
|
|
5094
|
+
const query = {};
|
|
5095
|
+
if (tenantId !== void 0) {
|
|
5096
|
+
query.tenant_id = tenantId;
|
|
5097
|
+
}
|
|
5098
|
+
return rb.execute(
|
|
5099
|
+
getAdminWalletUsage,
|
|
5100
|
+
Object.keys(query).length > 0 ? { query } : {},
|
|
5101
|
+
options
|
|
5102
|
+
);
|
|
5103
|
+
}
|
|
5104
|
+
},
|
|
5105
|
+
/**
|
|
5106
|
+
* Plan management — create, read, update, delete subscription plans available to tenants.
|
|
5107
|
+
*
|
|
5108
|
+
* Plans define subscription tiers with monthly prices, credit grants, storage quotas,
|
|
5109
|
+
* and capability tiers. ISVs configure their plan catalogue here.
|
|
5110
|
+
*/
|
|
5111
|
+
plans: {
|
|
5112
|
+
/** List all plans for the application. */
|
|
5113
|
+
list: async (options) => {
|
|
5114
|
+
const result = await rb.execute(getAdminPlans, {}, options);
|
|
5115
|
+
return result.data ?? result;
|
|
5116
|
+
},
|
|
5117
|
+
/** Get a plan by ID. */
|
|
5118
|
+
get: async (planId, options) => {
|
|
5119
|
+
return rb.execute(
|
|
5120
|
+
getAdminPlansById,
|
|
5121
|
+
{ path: { id: planId } },
|
|
5122
|
+
options
|
|
5123
|
+
);
|
|
5124
|
+
},
|
|
5125
|
+
/**
|
|
5126
|
+
* Create a new plan.
|
|
5127
|
+
*
|
|
5128
|
+
* @param attrs - Plan attributes (name, slug, monthly_price, monthly_credits, etc.)
|
|
5129
|
+
*/
|
|
5130
|
+
create: async (attrs, options) => {
|
|
5131
|
+
return rb.execute(
|
|
5132
|
+
postAdminPlans,
|
|
5133
|
+
{ body: { data: { type: "plan", attributes: attrs } } },
|
|
5134
|
+
options
|
|
5135
|
+
);
|
|
5136
|
+
},
|
|
5137
|
+
/**
|
|
5138
|
+
* Update an existing plan.
|
|
5139
|
+
*
|
|
5140
|
+
* @param planId - The plan UUID.
|
|
5141
|
+
* @param attrs - Attributes to update.
|
|
5142
|
+
*/
|
|
5143
|
+
update: async (planId, attrs, options) => {
|
|
5144
|
+
return rb.execute(
|
|
5145
|
+
patchAdminPlansById,
|
|
5146
|
+
{
|
|
5147
|
+
path: { id: planId },
|
|
5148
|
+
body: { data: { id: planId, type: "plan", attributes: attrs } }
|
|
5149
|
+
},
|
|
5150
|
+
options
|
|
5151
|
+
);
|
|
5152
|
+
},
|
|
5153
|
+
/** Delete a plan by ID. */
|
|
5154
|
+
delete: async (planId, options) => {
|
|
5155
|
+
await rb.execute(
|
|
5156
|
+
deleteAdminPlansById,
|
|
5157
|
+
{ path: { id: planId } },
|
|
5158
|
+
options
|
|
5159
|
+
);
|
|
5160
|
+
}
|
|
5161
|
+
},
|
|
5162
|
+
/**
|
|
5163
|
+
* Pricing strategy management — configure per-service floor prices and margins
|
|
5164
|
+
* for your application. These are the Tier 2 prices in the 5-tier pricing resolution.
|
|
5165
|
+
*/
|
|
5166
|
+
pricingStrategies: {
|
|
5167
|
+
/** List all pricing strategies for the application. */
|
|
5168
|
+
list: async (options) => {
|
|
5169
|
+
const result = await rb.execute(
|
|
5170
|
+
getAdminPricingStrategies,
|
|
5171
|
+
{},
|
|
5172
|
+
options
|
|
5173
|
+
);
|
|
5174
|
+
return result.data ?? result;
|
|
5175
|
+
},
|
|
5176
|
+
/** Get a pricing strategy by ID. */
|
|
5177
|
+
get: async (id, options) => {
|
|
5178
|
+
return rb.execute(
|
|
5179
|
+
getAdminPricingStrategiesById,
|
|
5180
|
+
{ path: { id } },
|
|
5181
|
+
options
|
|
5182
|
+
);
|
|
5183
|
+
},
|
|
5184
|
+
/**
|
|
5185
|
+
* Create a pricing strategy for a service.
|
|
5186
|
+
*
|
|
5187
|
+
* @param attrs - Strategy attributes: `service_id`, `metric`, `floor_price`, `margin_percent`.
|
|
5188
|
+
* The `floor_price` cannot be below the ISV minimum retail floor set in the WholesaleAgreement.
|
|
5189
|
+
*/
|
|
5190
|
+
create: async (attrs, options) => {
|
|
5191
|
+
return rb.execute(
|
|
5192
|
+
postAdminPricingStrategies,
|
|
5193
|
+
{ body: { data: { type: "pricing_strategy", attributes: attrs } } },
|
|
5194
|
+
options
|
|
5195
|
+
);
|
|
5196
|
+
},
|
|
5197
|
+
/**
|
|
5198
|
+
* Update a pricing strategy.
|
|
5199
|
+
*
|
|
5200
|
+
* @param id - The pricing strategy UUID.
|
|
5201
|
+
* @param attrs - Attributes to update (`floor_price`, `margin_percent`).
|
|
5202
|
+
*/
|
|
5203
|
+
update: async (id, attrs, options) => {
|
|
5204
|
+
return rb.execute(
|
|
5205
|
+
patchAdminPricingStrategiesById,
|
|
5206
|
+
{
|
|
5207
|
+
path: { id },
|
|
5208
|
+
body: { data: { id, type: "pricing_strategy", attributes: attrs } }
|
|
5209
|
+
},
|
|
5210
|
+
options
|
|
5211
|
+
);
|
|
5212
|
+
}
|
|
5213
|
+
},
|
|
5214
|
+
/**
|
|
5215
|
+
* Tenant pricing override management — set per-tenant, per-service custom prices.
|
|
5216
|
+
* These are Tier 1 in the 5-tier pricing resolution (highest priority).
|
|
5217
|
+
*
|
|
5218
|
+
* Use for enterprise contracts, volume discounts, and promotional pricing.
|
|
5219
|
+
* Always provide a `reason` for audit trail purposes.
|
|
5220
|
+
*/
|
|
5221
|
+
tenantPricingOverrides: {
|
|
5222
|
+
/** List all tenant pricing overrides for the application. */
|
|
5223
|
+
list: async (options) => {
|
|
5224
|
+
const result = await rb.execute(
|
|
5225
|
+
getAdminTenantPricingOverrides,
|
|
5226
|
+
{},
|
|
5227
|
+
options
|
|
5228
|
+
);
|
|
5229
|
+
return result.data ?? result;
|
|
5230
|
+
},
|
|
5231
|
+
/** Get a tenant pricing override by ID. */
|
|
5232
|
+
get: async (id, options) => {
|
|
5233
|
+
return rb.execute(
|
|
5234
|
+
getAdminTenantPricingOverridesById,
|
|
5235
|
+
{ path: { id } },
|
|
5236
|
+
options
|
|
5237
|
+
);
|
|
5238
|
+
},
|
|
5239
|
+
/**
|
|
5240
|
+
* Create a tenant-specific pricing override.
|
|
5241
|
+
*
|
|
5242
|
+
* @param attrs - Override attributes: `service_id`, `tenant_id`, `application_id`,
|
|
5243
|
+
* `floor_price`, `margin_percent`, `expires_at`, `reason`.
|
|
5244
|
+
* The `reason` field is required for audit compliance.
|
|
5245
|
+
*/
|
|
5246
|
+
create: async (attrs, options) => {
|
|
5247
|
+
return rb.execute(
|
|
5248
|
+
postAdminTenantPricingOverrides,
|
|
5249
|
+
{
|
|
5250
|
+
body: {
|
|
5251
|
+
data: { type: "tenant_pricing_override", attributes: attrs }
|
|
5252
|
+
}
|
|
5253
|
+
},
|
|
5254
|
+
options
|
|
5255
|
+
);
|
|
5256
|
+
},
|
|
5257
|
+
/**
|
|
5258
|
+
* Update a tenant pricing override.
|
|
5259
|
+
*
|
|
5260
|
+
* @param id - The override UUID.
|
|
5261
|
+
* @param attrs - Attributes to update (`floor_price`, `margin_percent`, `expires_at`, `reason`).
|
|
5262
|
+
*/
|
|
5263
|
+
update: async (id, attrs, options) => {
|
|
5264
|
+
return rb.execute(
|
|
5265
|
+
patchAdminTenantPricingOverridesById,
|
|
5266
|
+
{
|
|
5267
|
+
path: { id },
|
|
5268
|
+
body: {
|
|
5269
|
+
data: { id, type: "tenant_pricing_override", attributes: attrs }
|
|
5270
|
+
}
|
|
5271
|
+
},
|
|
5272
|
+
options
|
|
5273
|
+
);
|
|
5274
|
+
},
|
|
5275
|
+
/**
|
|
5276
|
+
* Delete a tenant pricing override. The tenant's pricing reverts to the
|
|
5277
|
+
* PricingStrategy (or platform default) immediately.
|
|
5278
|
+
*
|
|
5279
|
+
* @param id - The override UUID to delete.
|
|
5280
|
+
*/
|
|
5281
|
+
delete: async (id, options) => {
|
|
5282
|
+
await rb.execute(
|
|
5283
|
+
deleteAdminTenantPricingOverridesById,
|
|
5284
|
+
{ path: { id } },
|
|
5285
|
+
options
|
|
5286
|
+
);
|
|
5287
|
+
}
|
|
5288
|
+
},
|
|
5289
|
+
/**
|
|
5290
|
+
* Wholesale agreement management — configure the economic relationship between
|
|
5291
|
+
* your ISV account and the platform. Defines take rates, minimum retail floors,
|
|
5292
|
+
* and settlement terms.
|
|
5293
|
+
*
|
|
5294
|
+
* Wholesale agreements are typically configured once during ISV onboarding and
|
|
5295
|
+
* updated only when contract terms change.
|
|
5296
|
+
*/
|
|
5297
|
+
wholesaleAgreements: {
|
|
5298
|
+
/** List all wholesale agreements for the ISV account. */
|
|
5299
|
+
list: async (options) => {
|
|
5300
|
+
const result = await rb.execute(
|
|
5301
|
+
getAdminWholesaleAgreements,
|
|
5302
|
+
{},
|
|
5303
|
+
options
|
|
5304
|
+
);
|
|
5305
|
+
return result.data ?? result;
|
|
5306
|
+
},
|
|
5307
|
+
/** Get a wholesale agreement by ID. */
|
|
5308
|
+
get: async (id, options) => {
|
|
5309
|
+
return rb.execute(
|
|
5310
|
+
getAdminWholesaleAgreementsById,
|
|
5311
|
+
{ path: { id } },
|
|
5312
|
+
options
|
|
5313
|
+
);
|
|
5314
|
+
},
|
|
5315
|
+
/**
|
|
5316
|
+
* Create a wholesale agreement.
|
|
5317
|
+
*
|
|
5318
|
+
* @param attrs - Agreement attributes: `model` (`"percentage"` or `"interchange_plus"`),
|
|
5319
|
+
* `take_rate_percent`, `minimum_retail_floors`, `settlement_frequency`, etc.
|
|
5320
|
+
*/
|
|
5321
|
+
create: async (attrs, options) => {
|
|
5322
|
+
return rb.execute(
|
|
5323
|
+
postAdminWholesaleAgreements,
|
|
5324
|
+
{
|
|
5325
|
+
body: { data: { type: "wholesale_agreement", attributes: attrs } }
|
|
5326
|
+
},
|
|
5327
|
+
options
|
|
5328
|
+
);
|
|
5329
|
+
},
|
|
5330
|
+
/**
|
|
5331
|
+
* Update a wholesale agreement.
|
|
5332
|
+
*
|
|
5333
|
+
* @param id - The wholesale agreement UUID.
|
|
5334
|
+
* @param attrs - Attributes to update.
|
|
5335
|
+
*/
|
|
5336
|
+
update: async (id, attrs, options) => {
|
|
5337
|
+
return rb.execute(
|
|
5338
|
+
patchAdminWholesaleAgreementsById,
|
|
5339
|
+
{
|
|
5340
|
+
path: { id },
|
|
5341
|
+
body: {
|
|
5342
|
+
data: { id, type: "wholesale_agreement", attributes: attrs }
|
|
5343
|
+
}
|
|
5344
|
+
},
|
|
5345
|
+
options
|
|
5346
|
+
);
|
|
5347
|
+
}
|
|
5348
|
+
},
|
|
5349
|
+
/**
|
|
5350
|
+
* Settlement management — view and initiate ISV revenue settlements.
|
|
5351
|
+
*
|
|
5352
|
+
* The platform calculates net position (retail collected minus wholesale owed)
|
|
5353
|
+
* and releases settlements based on your WholesaleAgreement terms.
|
|
5354
|
+
*/
|
|
5355
|
+
settlements: {
|
|
5356
|
+
/** List all settlements for the ISV account. */
|
|
5357
|
+
list: async (options) => {
|
|
5358
|
+
const result = await rb.execute(
|
|
5359
|
+
getAdminSettlements,
|
|
5360
|
+
{},
|
|
5361
|
+
options
|
|
5362
|
+
);
|
|
5363
|
+
return result.data ?? result;
|
|
5364
|
+
},
|
|
5365
|
+
/** Get a settlement by ID. */
|
|
5366
|
+
get: async (id, options) => {
|
|
5367
|
+
return rb.execute(
|
|
5368
|
+
getAdminSettlementsById,
|
|
5369
|
+
{ path: { id } },
|
|
5370
|
+
options
|
|
5371
|
+
);
|
|
5372
|
+
},
|
|
5373
|
+
/**
|
|
5374
|
+
* Initiate a settlement calculation for a given period.
|
|
5375
|
+
*
|
|
5376
|
+
* @param attrs - Settlement attributes: `period_start`, `period_end`, `isv_tenant_id`.
|
|
5377
|
+
*/
|
|
5378
|
+
create: async (attrs, options) => {
|
|
5379
|
+
return rb.execute(
|
|
5380
|
+
postAdminSettlements,
|
|
5381
|
+
{ body: { data: { type: "settlement", attributes: attrs } } },
|
|
5382
|
+
options
|
|
5383
|
+
);
|
|
5384
|
+
}
|
|
5385
|
+
},
|
|
5386
|
+
/**
|
|
5387
|
+
* Account credit management — grant promotional or purchased credits to tenant applications.
|
|
5388
|
+
*
|
|
5389
|
+
* Use this for:
|
|
5390
|
+
* - Onboarding bonuses
|
|
5391
|
+
* - Service credits (compensation for downtime)
|
|
5392
|
+
* - Referral rewards
|
|
5393
|
+
* - Marketing campaigns
|
|
5394
|
+
*/
|
|
5395
|
+
accounts: {
|
|
5396
|
+
/**
|
|
5397
|
+
* Grant credits to an application (and its tenants).
|
|
5398
|
+
*
|
|
5399
|
+
* @param applicationId - The application UUID.
|
|
5400
|
+
* @param opts - Credit grant options: `amount` (integer credits), `type`
|
|
5401
|
+
* (`"promotional"` | `"purchased"` | `"subscription"`), optional `reason` and `expires_at`.
|
|
5402
|
+
*
|
|
5403
|
+
* @example
|
|
5404
|
+
* ```typescript
|
|
5405
|
+
* // Apology credits — permanent, no expiry
|
|
5406
|
+
* await admin.billing.accounts.grantCredits(applicationId, {
|
|
5407
|
+
* amount: 10000,
|
|
5408
|
+
* type: 'purchased',
|
|
5409
|
+
* reason: 'Service incident 2026-03-04 compensation',
|
|
5410
|
+
* });
|
|
5411
|
+
*
|
|
5412
|
+
* // Promotional trial credits — expire in 14 days
|
|
5413
|
+
* await admin.billing.accounts.grantCredits(applicationId, {
|
|
5414
|
+
* amount: 25000,
|
|
5415
|
+
* type: 'promotional',
|
|
5416
|
+
* expires_at: new Date(Date.now() + 14 * 86400 * 1000).toISOString(),
|
|
5417
|
+
* });
|
|
5418
|
+
* ```
|
|
5419
|
+
*/
|
|
5420
|
+
grantCredits: async (applicationId, opts, options) => {
|
|
5421
|
+
const attributes = {
|
|
5422
|
+
amount: opts.amount,
|
|
5423
|
+
type: opts.type
|
|
5424
|
+
};
|
|
5425
|
+
if (opts.reason !== void 0) attributes.reason = opts.reason;
|
|
5426
|
+
if (opts.expires_at !== void 0)
|
|
5427
|
+
attributes.expires_at = opts.expires_at;
|
|
5428
|
+
return rb.execute(
|
|
5429
|
+
patchAdminApplicationsByIdGrantCredits,
|
|
5430
|
+
{
|
|
5431
|
+
path: { id: applicationId },
|
|
5432
|
+
body: { data: { type: "application", attributes } }
|
|
5433
|
+
},
|
|
5434
|
+
options
|
|
5435
|
+
);
|
|
5436
|
+
}
|
|
5437
|
+
}
|
|
5438
|
+
};
|
|
5439
|
+
}
|
|
5440
|
+
|
|
4812
5441
|
// src/gpt-admin.ts
|
|
4813
5442
|
var GptAdmin = class extends BaseClient {
|
|
4814
5443
|
constructor(config) {
|
|
@@ -4832,6 +5461,7 @@ var GptAdmin = class extends BaseClient {
|
|
|
4832
5461
|
this.webhooks = createWebhooksNamespace(rb);
|
|
4833
5462
|
this.campaigns = createCampaignsNamespace(rb);
|
|
4834
5463
|
this.email = createEmailNamespace(rb);
|
|
5464
|
+
this.billing = createBillingNamespace(rb);
|
|
4835
5465
|
}
|
|
4836
5466
|
};
|
|
4837
5467
|
|