@gpt-platform/client 0.4.1 → 0.4.2
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 +364 -17
- package/dist/index.d.ts +364 -17
- package/dist/index.js +197 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +197 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1224,7 +1224,7 @@ function buildUserAgent(sdkVersion, appInfo) {
|
|
|
1224
1224
|
}
|
|
1225
1225
|
|
|
1226
1226
|
// src/version.ts
|
|
1227
|
-
var SDK_VERSION = "0.4.
|
|
1227
|
+
var SDK_VERSION = "0.4.2";
|
|
1228
1228
|
var DEFAULT_API_VERSION = "2026-02-27";
|
|
1229
1229
|
|
|
1230
1230
|
// src/base-client.ts
|
|
@@ -1690,6 +1690,15 @@ var postEmailOutboundEmails = (options) => (options.client ?? client).post({
|
|
|
1690
1690
|
...options.headers
|
|
1691
1691
|
}
|
|
1692
1692
|
});
|
|
1693
|
+
var patchWalletCredits = (options) => (options.client ?? client).patch({
|
|
1694
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1695
|
+
url: "/wallet/credits",
|
|
1696
|
+
...options,
|
|
1697
|
+
headers: {
|
|
1698
|
+
"Content-Type": "application/vnd.api+json",
|
|
1699
|
+
...options.headers
|
|
1700
|
+
}
|
|
1701
|
+
});
|
|
1693
1702
|
var getCrmCustomEntitiesWorkspaceByWorkspaceId = (options) => (options.client ?? client).get({
|
|
1694
1703
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1695
1704
|
url: "/crm/custom-entities/workspace/{workspace_id}",
|
|
@@ -2172,6 +2181,15 @@ var postAgentsByIdRestoreVersion = (options) => (options.client ?? client).post(
|
|
|
2172
2181
|
...options.headers
|
|
2173
2182
|
}
|
|
2174
2183
|
});
|
|
2184
|
+
var patchWalletAutoTopUp = (options) => (options.client ?? client).patch({
|
|
2185
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2186
|
+
url: "/wallet/auto-top-up",
|
|
2187
|
+
...options,
|
|
2188
|
+
headers: {
|
|
2189
|
+
"Content-Type": "application/vnd.api+json",
|
|
2190
|
+
...options.headers
|
|
2191
|
+
}
|
|
2192
|
+
});
|
|
2175
2193
|
var postTokens = (options) => (options.client ?? client).post({
|
|
2176
2194
|
security: [{ scheme: "bearer", type: "http" }],
|
|
2177
2195
|
url: "/tokens",
|
|
@@ -3375,6 +3393,11 @@ var getExtractionSchemaDiscoveriesById = (options) => (options.client ?? client)
|
|
|
3375
3393
|
url: "/extraction/schema-discoveries/{id}",
|
|
3376
3394
|
...options
|
|
3377
3395
|
});
|
|
3396
|
+
var getWalletInvoices = (options) => (options.client ?? client).get({
|
|
3397
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
3398
|
+
url: "/wallet/invoices",
|
|
3399
|
+
...options
|
|
3400
|
+
});
|
|
3378
3401
|
var getFieldTemplates = (options) => (options.client ?? client).get({
|
|
3379
3402
|
security: [{ scheme: "bearer", type: "http" }],
|
|
3380
3403
|
url: "/field-templates",
|
|
@@ -3460,6 +3483,15 @@ var postDocumentsPresignedUpload = (options) => (options.client ?? client).post(
|
|
|
3460
3483
|
...options.headers
|
|
3461
3484
|
}
|
|
3462
3485
|
});
|
|
3486
|
+
var postPaymentMethodsTokenize = (options) => (options.client ?? client).post({
|
|
3487
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
3488
|
+
url: "/payment-methods/tokenize",
|
|
3489
|
+
...options,
|
|
3490
|
+
headers: {
|
|
3491
|
+
"Content-Type": "application/vnd.api+json",
|
|
3492
|
+
...options.headers
|
|
3493
|
+
}
|
|
3494
|
+
});
|
|
3463
3495
|
var getCrmContactsWorkspaceByWorkspaceIdArchived = (options) => (options.client ?? client).get({
|
|
3464
3496
|
security: [{ scheme: "bearer", type: "http" }],
|
|
3465
3497
|
url: "/crm/contacts/workspace/{workspace_id}/archived",
|
|
@@ -3829,6 +3861,15 @@ var postSearchSavedByIdRun = (options) => (options.client ?? client).post({
|
|
|
3829
3861
|
...options.headers
|
|
3830
3862
|
}
|
|
3831
3863
|
});
|
|
3864
|
+
var patchWalletPlan = (options) => (options.client ?? client).patch({
|
|
3865
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
3866
|
+
url: "/wallet/plan",
|
|
3867
|
+
...options,
|
|
3868
|
+
headers: {
|
|
3869
|
+
"Content-Type": "application/vnd.api+json",
|
|
3870
|
+
...options.headers
|
|
3871
|
+
}
|
|
3872
|
+
});
|
|
3832
3873
|
var deleteCatalogProductsById = (options) => (options.client ?? client).delete({
|
|
3833
3874
|
security: [{ scheme: "bearer", type: "http" }],
|
|
3834
3875
|
url: "/catalog/products/{id}",
|
|
@@ -4439,6 +4480,11 @@ var postSupportTags = (options) => (options.client ?? client).post({
|
|
|
4439
4480
|
...options.headers
|
|
4440
4481
|
}
|
|
4441
4482
|
});
|
|
4483
|
+
var getWalletPlanPreview = (options) => (options.client ?? client).get({
|
|
4484
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
4485
|
+
url: "/wallet/plan/preview",
|
|
4486
|
+
...options
|
|
4487
|
+
});
|
|
4442
4488
|
var postAgentVersionsByIdSetSystemFields = (options) => (options.client ?? client).post({
|
|
4443
4489
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4444
4490
|
url: "/agent-versions/{id}/set-system-fields",
|
|
@@ -7134,22 +7180,139 @@ function createBillingNamespace(rb) {
|
|
|
7134
7180
|
/**
|
|
7135
7181
|
* Retrieves the current workspace wallet, including the available credit
|
|
7136
7182
|
* balance, usage totals, and any pending charges.
|
|
7183
|
+
*/
|
|
7184
|
+
get: async (options) => {
|
|
7185
|
+
return rb.execute(getWallet, {}, options);
|
|
7186
|
+
},
|
|
7187
|
+
/**
|
|
7188
|
+
* Preview the cost and effective date of a plan change before committing.
|
|
7137
7189
|
*
|
|
7138
|
-
* @param
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
|
|
7190
|
+
* @param planSlug - The slug of the target plan (e.g. `"pro-monthly"`).
|
|
7191
|
+
*/
|
|
7192
|
+
previewPlanChange: async (planSlug, options) => {
|
|
7193
|
+
return rb.execute(
|
|
7194
|
+
getWalletPlanPreview,
|
|
7195
|
+
{ query: { plan_slug: planSlug } },
|
|
7196
|
+
options
|
|
7197
|
+
);
|
|
7198
|
+
},
|
|
7199
|
+
/**
|
|
7200
|
+
* Change the workspace's subscription plan.
|
|
7142
7201
|
*
|
|
7143
|
-
*
|
|
7144
|
-
*
|
|
7145
|
-
*
|
|
7202
|
+
* Upgrades charge a prorated amount immediately against the default payment
|
|
7203
|
+
* method. Downgrades are deferred to the end of the current billing period.
|
|
7204
|
+
* Use `previewPlanChange` first to show the user a cost estimate.
|
|
7146
7205
|
*
|
|
7147
|
-
*
|
|
7148
|
-
*
|
|
7149
|
-
* ```
|
|
7206
|
+
* @param walletId - The wallet UUID from `wallet.get()`.
|
|
7207
|
+
* @param planSlug - The slug of the target plan (e.g. `"pro-monthly"`).
|
|
7150
7208
|
*/
|
|
7151
|
-
|
|
7152
|
-
return rb.execute(
|
|
7209
|
+
changePlan: async (walletId, planSlug, options) => {
|
|
7210
|
+
return rb.execute(
|
|
7211
|
+
patchWalletPlan,
|
|
7212
|
+
{
|
|
7213
|
+
body: {
|
|
7214
|
+
data: {
|
|
7215
|
+
id: walletId,
|
|
7216
|
+
type: "wallet",
|
|
7217
|
+
attributes: { plan_slug: planSlug }
|
|
7218
|
+
}
|
|
7219
|
+
}
|
|
7220
|
+
},
|
|
7221
|
+
options
|
|
7222
|
+
);
|
|
7223
|
+
},
|
|
7224
|
+
/**
|
|
7225
|
+
* Purchase a credit package to top up the workspace wallet immediately.
|
|
7226
|
+
*
|
|
7227
|
+
* Charges the specified (or default) payment method. Credits are added to
|
|
7228
|
+
* the `purchased` bucket and never expire.
|
|
7229
|
+
*
|
|
7230
|
+
* @param walletId - The wallet UUID from `wallet.get()`.
|
|
7231
|
+
* @param packageSlug - The slug of the credit package to purchase.
|
|
7232
|
+
* @param paymentMethodId - Optional payment method UUID. Uses the default if omitted.
|
|
7233
|
+
*/
|
|
7234
|
+
buyCredits: async (walletId, packageSlug, paymentMethodId, options) => {
|
|
7235
|
+
const attributes = {
|
|
7236
|
+
package_slug: packageSlug
|
|
7237
|
+
};
|
|
7238
|
+
if (paymentMethodId !== void 0) {
|
|
7239
|
+
attributes.payment_method_id = paymentMethodId;
|
|
7240
|
+
}
|
|
7241
|
+
return rb.execute(
|
|
7242
|
+
patchWalletCredits,
|
|
7243
|
+
{ body: { data: { id: walletId, type: "wallet", attributes } } },
|
|
7244
|
+
options
|
|
7245
|
+
);
|
|
7246
|
+
},
|
|
7247
|
+
/**
|
|
7248
|
+
* Update the workspace's auto top-up settings.
|
|
7249
|
+
*
|
|
7250
|
+
* When enabled, the platform automatically purchases the specified credit
|
|
7251
|
+
* package whenever the balance drops below `threshold`.
|
|
7252
|
+
*
|
|
7253
|
+
* @param walletId - The wallet UUID from `wallet.get()`.
|
|
7254
|
+
* @param opts.enabled - Enable or disable auto top-up.
|
|
7255
|
+
* @param opts.threshold - Credit balance floor that triggers a purchase.
|
|
7256
|
+
* @param opts.amount - Credits to purchase per top-up event.
|
|
7257
|
+
* @param opts.packageId - Credit package UUID to auto-purchase.
|
|
7258
|
+
*/
|
|
7259
|
+
updateAutoTopUp: async (walletId, opts, options) => {
|
|
7260
|
+
const attributes = { enabled: opts.enabled };
|
|
7261
|
+
if (opts.threshold !== void 0) attributes.threshold = opts.threshold;
|
|
7262
|
+
if (opts.amount !== void 0) attributes.amount = opts.amount;
|
|
7263
|
+
if (opts.packageId !== void 0)
|
|
7264
|
+
attributes.package_id = opts.packageId;
|
|
7265
|
+
return rb.execute(
|
|
7266
|
+
patchWalletAutoTopUp,
|
|
7267
|
+
{ body: { data: { id: walletId, type: "wallet", attributes } } },
|
|
7268
|
+
options
|
|
7269
|
+
);
|
|
7270
|
+
},
|
|
7271
|
+
/**
|
|
7272
|
+
* Sub-namespace for invoice operations.
|
|
7273
|
+
*
|
|
7274
|
+
* Invoices are generated per billing period and carry a `pdf_url` for
|
|
7275
|
+
* receipt download. Use `invoices.list()` for the transaction history page.
|
|
7276
|
+
*/
|
|
7277
|
+
invoices: {
|
|
7278
|
+
/**
|
|
7279
|
+
* Returns a single page of invoices for the current workspace.
|
|
7280
|
+
*
|
|
7281
|
+
* Each invoice includes `pdf_url` for receipt download.
|
|
7282
|
+
*
|
|
7283
|
+
* @example
|
|
7284
|
+
* ```typescript
|
|
7285
|
+
* const invoices = await client.billing.wallet.invoices.list();
|
|
7286
|
+
* const paidInvoices = invoices.filter(inv => inv.attributes?.status === "paid");
|
|
7287
|
+
* ```
|
|
7288
|
+
*/
|
|
7289
|
+
list: async (options) => {
|
|
7290
|
+
return rb.execute(
|
|
7291
|
+
getWalletInvoices,
|
|
7292
|
+
buildPageQuery(options?.page, options?.pageSize),
|
|
7293
|
+
options
|
|
7294
|
+
);
|
|
7295
|
+
},
|
|
7296
|
+
/**
|
|
7297
|
+
* Fetches all invoices by automatically paginating through every page.
|
|
7298
|
+
*
|
|
7299
|
+
* @example
|
|
7300
|
+
* ```typescript
|
|
7301
|
+
* const all = await client.billing.wallet.invoices.listAll();
|
|
7302
|
+
* const downloadUrl = all[0].attributes?.pdf_url;
|
|
7303
|
+
* ```
|
|
7304
|
+
*/
|
|
7305
|
+
listAll: async (options) => {
|
|
7306
|
+
return paginateToArray(
|
|
7307
|
+
rb.createPaginatedFetcher(
|
|
7308
|
+
getWalletInvoices,
|
|
7309
|
+
(page, pageSize) => ({
|
|
7310
|
+
query: { page: { number: page, size: pageSize } }
|
|
7311
|
+
}),
|
|
7312
|
+
options
|
|
7313
|
+
)
|
|
7314
|
+
);
|
|
7315
|
+
}
|
|
7153
7316
|
}
|
|
7154
7317
|
},
|
|
7155
7318
|
/**
|
|
@@ -7537,6 +7700,27 @@ function createBillingNamespace(rb) {
|
|
|
7537
7700
|
options
|
|
7538
7701
|
);
|
|
7539
7702
|
},
|
|
7703
|
+
/**
|
|
7704
|
+
* Tokenizes a raw card server-side and saves the resulting payment method.
|
|
7705
|
+
*
|
|
7706
|
+
* Use this for direct card collection flows where your server handles card
|
|
7707
|
+
* data (PCI-DSS scope applies). The platform tokenizes the card with QorPay
|
|
7708
|
+
* and stores only the token — raw card data is never persisted.
|
|
7709
|
+
*
|
|
7710
|
+
* For hosted-fields flows where the client tokenizes the card, use
|
|
7711
|
+
* `paymentMethods.create({ provider_token })` instead.
|
|
7712
|
+
*
|
|
7713
|
+
* @param cardDetails - Raw card fields including number, CVC, expiry, and billing address.
|
|
7714
|
+
*/
|
|
7715
|
+
tokenize: async (cardDetails, options) => {
|
|
7716
|
+
return rb.execute(
|
|
7717
|
+
postPaymentMethodsTokenize,
|
|
7718
|
+
{
|
|
7719
|
+
body: { data: { type: "payment_method", attributes: cardDetails } }
|
|
7720
|
+
},
|
|
7721
|
+
options
|
|
7722
|
+
);
|
|
7723
|
+
},
|
|
7540
7724
|
/**
|
|
7541
7725
|
* Updates the mutable attributes of an existing payment method, such as
|
|
7542
7726
|
* the billing name or expiry date override.
|