@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.ts CHANGED
@@ -575,7 +575,7 @@ declare class BrowserApiKeyError extends Error {
575
575
  }
576
576
 
577
577
  /** SDK version — updated automatically by mix update.sdks */
578
- declare const SDK_VERSION = "0.4.1";
578
+ declare const SDK_VERSION = "0.4.2";
579
579
  /** Default API version sent in every request — updated automatically by mix update.sdks */
580
580
  declare const DEFAULT_API_VERSION = "2026-02-27";
581
581
 
@@ -1308,6 +1308,131 @@ type CrmRelationshipType = {
1308
1308
  };
1309
1309
  type: string;
1310
1310
  };
1311
+ /**
1312
+ * A "Resource object" representing a wallet
1313
+ */
1314
+ type Wallet = {
1315
+ /**
1316
+ * An attributes object for a wallet
1317
+ */
1318
+ attributes?: {
1319
+ /**
1320
+ * Field included by default.
1321
+ */
1322
+ accounts?: Array<{
1323
+ [key: string]: unknown;
1324
+ }> | null | unknown;
1325
+ /**
1326
+ * Field included by default.
1327
+ */
1328
+ addons?: Array<{
1329
+ [key: string]: unknown;
1330
+ }> | null | unknown;
1331
+ /**
1332
+ * Optional application context - wallets belong to tenants, not applications. Field included by default.
1333
+ */
1334
+ application_id?: string | null | unknown;
1335
+ /**
1336
+ * Amount in credits. Field included by default.
1337
+ */
1338
+ auto_top_up_amount?: number | null | unknown;
1339
+ /**
1340
+ * Field included by default.
1341
+ */
1342
+ auto_top_up_enabled: boolean;
1343
+ /**
1344
+ * Threshold in credits. Field included by default.
1345
+ */
1346
+ auto_top_up_threshold?: number | null | unknown;
1347
+ /**
1348
+ * Field included by default.
1349
+ */
1350
+ credits: number;
1351
+ /**
1352
+ * Field included by default.
1353
+ */
1354
+ credits_free?: number | null | unknown;
1355
+ /**
1356
+ * Field included by default.
1357
+ */
1358
+ credits_paid?: number | null | unknown;
1359
+ /**
1360
+ * Total promotional credits ever allocated to this tenant. Field included by default.
1361
+ */
1362
+ credits_promotional_allocated?: number | null | unknown;
1363
+ /**
1364
+ * Total purchased credits ever allocated to this tenant. Field included by default.
1365
+ */
1366
+ credits_purchased_allocated?: number | null | unknown;
1367
+ /**
1368
+ * Field included by default.
1369
+ */
1370
+ credits_subscription?: number | null | unknown;
1371
+ /**
1372
+ * Total subscription credits ever allocated to this tenant. Field included by default.
1373
+ */
1374
+ credits_subscription_allocated?: number | null | unknown;
1375
+ /**
1376
+ * Field included by default.
1377
+ */
1378
+ payment_methods?: Array<{
1379
+ [key: string]: unknown;
1380
+ }> | null | unknown;
1381
+ /**
1382
+ * Field included by default.
1383
+ */
1384
+ plan_id?: string | null | unknown;
1385
+ /**
1386
+ * Field included by default.
1387
+ */
1388
+ plan_slug?: string | null | unknown;
1389
+ /**
1390
+ * Field included by default.
1391
+ */
1392
+ storage_quota_bytes: number;
1393
+ /**
1394
+ * Field included by default.
1395
+ */
1396
+ storage_used_bytes: number;
1397
+ /**
1398
+ * Daily usage history entries. Field included by default.
1399
+ */
1400
+ usage_history?: Array<{
1401
+ [key: string]: unknown;
1402
+ }> | null | unknown;
1403
+ /**
1404
+ * Storage breakdown by workspace (Top 3 + Others). Field included by default.
1405
+ */
1406
+ workspace_storage?: Array<{
1407
+ [key: string]: unknown;
1408
+ }> | null | unknown;
1409
+ /**
1410
+ * Usage breakdown by workspace (Top 3 + Others). Field included by default.
1411
+ */
1412
+ workspace_usage?: Array<{
1413
+ [key: string]: unknown;
1414
+ }> | null | unknown;
1415
+ };
1416
+ id: string;
1417
+ /**
1418
+ * A relationships object for a wallet
1419
+ */
1420
+ relationships?: {
1421
+ plan?: {
1422
+ /**
1423
+ * An identifier for plan
1424
+ */
1425
+ data?: {
1426
+ id: string;
1427
+ meta?: {
1428
+ [key: string]: unknown;
1429
+ };
1430
+ type: string;
1431
+ } | null;
1432
+ };
1433
+ };
1434
+ type: string;
1435
+ };
1311
1436
  /**
1312
1437
  * A "Resource object" representing a email-marketing-sender-profile
1313
1438
  */
@@ -1811,6 +1936,12 @@ type EmailOutboundEmail = {
1811
1936
  * Field included by default.
1812
1937
  */
1813
1938
  ai_generated?: boolean | null | unknown;
1939
+ /**
1940
+ * Field included by default.
1941
+ */
1942
+ attachments?: Array<{
1943
+ [key: string]: unknown;
1944
+ }> | null | unknown;
1814
1945
  /**
1815
1946
  * Field included by default.
1816
1947
  */
@@ -3312,6 +3443,62 @@ type CrmCustomEntity = {
3312
3443
  };
3313
3444
  type: string;
3314
3445
  };
3446
+ /**
3447
+ * A "Resource object" representing a invoice
3448
+ */
3449
+ type Invoice = {
3450
+ /**
3451
+ * An attributes object for a invoice
3452
+ */
3453
+ attributes?: {
3454
+ /**
3455
+ * Field included by default.
3456
+ */
3457
+ amount_due?: number | null | unknown;
3458
+ /**
3459
+ * Field included by default.
3460
+ */
3461
+ amount_paid?: number | null | unknown;
3462
+ /**
3463
+ * Field included by default.
3464
+ */
3465
+ created_at?: unknown;
3466
+ /**
3467
+ * Field included by default.
3468
+ */
3469
+ currency?: string | null | unknown;
3470
+ /**
3471
+ * Field included by default.
3472
+ */
3473
+ due_date?: unknown;
3474
+ /**
3475
+ * Field included by default.
3476
+ */
3477
+ invoice_number?: string | null | unknown;
3478
+ /**
3479
+ * Field included by default.
3480
+ */
3481
+ line_items?: Array<{
3482
+ [key: string]: unknown;
3483
+ }> | null | unknown;
3484
+ /**
3485
+ * Field included by default.
3486
+ */
3487
+ pdf_url?: string | null | unknown;
3488
+ /**
3489
+ * Field included by default.
3490
+ */
3491
+ status?: "draft" | "open" | "paid" | "void" | unknown;
3492
+ };
3493
+ id: string;
3494
+ /**
3495
+ * A relationships object for a invoice
3496
+ */
3497
+ relationships?: {
3498
+ [key: string]: never;
3499
+ };
3500
+ type: string;
3501
+ };
3315
3502
  /**
3316
3503
  * A "Resource object" representing a transaction
3317
3504
  */
@@ -4901,19 +5088,27 @@ type ConsentRecord = {
4901
5088
  /**
4902
5089
  * Field included by default.
4903
5090
  */
4904
- purpose: "ai_document_processing" | "data_analytics" | "marketing_communications" | "third_party_sharing";
5091
+ purpose: "ai_document_processing" | "data_analytics" | "marketing_communications" | "third_party_sharing" | "session_recording";
4905
5092
  /**
4906
5093
  * Field included by default.
4907
5094
  */
4908
5095
  status: "granted" | "withdrawn";
5096
+ /**
5097
+ * Non-user subject identifier for consent (e.g., CRM contact UUID for HIPAA recording consent). Field included by default.
5098
+ */
5099
+ subject_id?: string | null | unknown;
4909
5100
  /**
4910
5101
  * Field included by default.
4911
5102
  */
4912
- user_id: string;
5103
+ user_id?: string | null | unknown;
4913
5104
  /**
4914
5105
  * Field included by default.
4915
5106
  */
4916
5107
  withdrawn_at?: unknown;
5108
+ /**
5109
+ * Workspace scope for subject-based consent records. Field included by default.
5110
+ */
5111
+ workspace_id?: string | null | unknown;
4917
5112
  };
4918
5113
  id: string;
4919
5114
  /**
@@ -6139,6 +6334,15 @@ type Workspace = {
6139
6334
  * Explicitly enabled AI features for this workspace. Field included by default.
6140
6335
  */
6141
6336
  enabled_capabilities?: Array<string> | null | unknown;
6337
+ /**
6338
+ * Maps diarization speaker IDs to role labels for transcript formatting.
6339
+ * E.g.: %{"SPEAKER_00" => "RD", "SPEAKER_01" => "Client"}
6340
+ * ISV-configured. The platform normalizes transcripts to these labels before passing to agents.
6341
+ * . Field included by default.
6342
+ */
6343
+ speaker_role_map: {
6344
+ [key: string]: unknown;
6345
+ };
6142
6346
  /**
6143
6347
  * Agent that validates extracted data post-extraction. Field included by default.
6144
6348
  */
@@ -11155,7 +11359,23 @@ declare class GptClient extends BaseClient {
11155
11359
  /** Wallet, plans, transactions, and payment methods */
11156
11360
  readonly billing: {
11157
11361
  wallet: {
11158
- get: (options?: RequestOptions) => Promise<Record<string, unknown>>;
11362
+ get: (options?: RequestOptions) => Promise<Wallet>;
11363
+ previewPlanChange: (planSlug: string, options?: RequestOptions) => Promise<Wallet>;
11364
+ changePlan: (walletId: string, planSlug: string, options?: RequestOptions) => Promise<Wallet>;
11365
+ buyCredits: (walletId: string, packageSlug: string, paymentMethodId?: string, options?: RequestOptions) => Promise<Wallet>;
11366
+ updateAutoTopUp: (walletId: string, opts: {
11367
+ enabled: boolean;
11368
+ threshold?: number;
11369
+ amount?: number;
11370
+ packageId?: string;
11371
+ }, options?: RequestOptions) => Promise<Wallet>;
11372
+ invoices: {
11373
+ list: (options?: {
11374
+ page?: number;
11375
+ pageSize?: number;
11376
+ } & RequestOptions) => Promise<Invoice[]>;
11377
+ listAll: (options?: RequestOptions) => Promise<Invoice[]>;
11378
+ };
11159
11379
  };
11160
11380
  plans: {
11161
11381
  list: (options?: {
@@ -11188,7 +11408,29 @@ declare class GptClient extends BaseClient {
11188
11408
  pageSize?: number;
11189
11409
  } & RequestOptions) => Promise<PaymentMethod[]>;
11190
11410
  listAll: (options?: RequestOptions) => Promise<PaymentMethod[]>;
11191
- create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<PaymentMethod>;
11411
+ create: (attributes: {
11412
+ provider_token: string;
11413
+ type?: "card" | "bank_account";
11414
+ last4?: string;
11415
+ exp_month?: number;
11416
+ exp_year?: number;
11417
+ brand?: string;
11418
+ nickname?: string;
11419
+ }, options?: RequestOptions) => Promise<PaymentMethod>;
11420
+ tokenize: (cardDetails: {
11421
+ card_number: string;
11422
+ exp_month: number;
11423
+ exp_year: number;
11424
+ cvc: string;
11425
+ holder_name: string;
11426
+ billing_address: string;
11427
+ billing_city: string;
11428
+ billing_state: string;
11429
+ zip_code: string;
11430
+ phone?: string;
11431
+ nickname?: string;
11432
+ customer_id?: string;
11433
+ }, options?: RequestOptions) => Promise<PaymentMethod>;
11192
11434
  update: (id: string, attributes: Record<string, unknown>, options?: RequestOptions) => Promise<PaymentMethod>;
11193
11435
  get: (id: string, options?: RequestOptions) => Promise<PaymentMethod>;
11194
11436
  setDefault: (id: string, options?: RequestOptions) => Promise<PaymentMethod>;
@@ -12987,6 +13229,32 @@ declare function createSearchNamespace(rb: RequestBuilder): {
12987
13229
  };
12988
13230
  };
12989
13231
 
13232
+ /** Attributes for saving a pre-tokenized payment method. */
13233
+ type PaymentMethodCreateAttributes = {
13234
+ /** Provider token from a hosted fields flow (e.g. QorPay hosted iframe). Never pass raw card numbers here. */
13235
+ provider_token: string;
13236
+ type?: "card" | "bank_account";
13237
+ last4?: string;
13238
+ exp_month?: number;
13239
+ exp_year?: number;
13240
+ brand?: string;
13241
+ nickname?: string;
13242
+ };
13243
+ /** Attributes for S2S card tokenization (raw card details). Server tokenizes with QorPay. */
13244
+ type PaymentMethodTokenizeAttributes = {
13245
+ card_number: string;
13246
+ exp_month: number;
13247
+ exp_year: number;
13248
+ cvc: string;
13249
+ holder_name: string;
13250
+ billing_address: string;
13251
+ billing_city: string;
13252
+ billing_state: string;
13253
+ zip_code: string;
13254
+ phone?: string;
13255
+ nickname?: string;
13256
+ customer_id?: string;
13257
+ };
12990
13258
  /**
12991
13259
  * Creates the billing namespace, providing access to wallet balances, subscription
12992
13260
  * plans, transaction history, credit packages, and payment methods for the
@@ -13012,21 +13280,87 @@ declare function createBillingNamespace(rb: RequestBuilder): {
13012
13280
  /**
13013
13281
  * Retrieves the current workspace wallet, including the available credit
13014
13282
  * balance, usage totals, and any pending charges.
13283
+ */
13284
+ get: (options?: RequestOptions) => Promise<Wallet>;
13285
+ /**
13286
+ * Preview the cost and effective date of a plan change before committing.
13015
13287
  *
13016
- * @param options - Optional request options such as custom headers or an
13017
- * abort signal.
13018
- * @returns A promise resolving to a record containing wallet fields such as
13019
- * `balance`, `currency`, and usage metadata.
13288
+ * @param planSlug - The slug of the target plan (e.g. `"pro-monthly"`).
13289
+ */
13290
+ previewPlanChange: (planSlug: string, options?: RequestOptions) => Promise<Wallet>;
13291
+ /**
13292
+ * Change the workspace's subscription plan.
13020
13293
  *
13021
- * @example
13022
- * ```typescript
13023
- * const client = new GptClient({ apiKey: 'sk_app_...' });
13294
+ * Upgrades charge a prorated amount immediately against the default payment
13295
+ * method. Downgrades are deferred to the end of the current billing period.
13296
+ * Use `previewPlanChange` first to show the user a cost estimate.
13024
13297
  *
13025
- * const wallet = await client.billing.wallet.get();
13026
- * console.log(`Available credits: ${wallet.balance}`);
13027
- * ```
13298
+ * @param walletId - The wallet UUID from `wallet.get()`.
13299
+ * @param planSlug - The slug of the target plan (e.g. `"pro-monthly"`).
13300
+ */
13301
+ changePlan: (walletId: string, planSlug: string, options?: RequestOptions) => Promise<Wallet>;
13302
+ /**
13303
+ * Purchase a credit package to top up the workspace wallet immediately.
13304
+ *
13305
+ * Charges the specified (or default) payment method. Credits are added to
13306
+ * the `purchased` bucket and never expire.
13307
+ *
13308
+ * @param walletId - The wallet UUID from `wallet.get()`.
13309
+ * @param packageSlug - The slug of the credit package to purchase.
13310
+ * @param paymentMethodId - Optional payment method UUID. Uses the default if omitted.
13311
+ */
13312
+ buyCredits: (walletId: string, packageSlug: string, paymentMethodId?: string, options?: RequestOptions) => Promise<Wallet>;
13313
+ /**
13314
+ * Update the workspace's auto top-up settings.
13315
+ *
13316
+ * When enabled, the platform automatically purchases the specified credit
13317
+ * package whenever the balance drops below `threshold`.
13318
+ *
13319
+ * @param walletId - The wallet UUID from `wallet.get()`.
13320
+ * @param opts.enabled - Enable or disable auto top-up.
13321
+ * @param opts.threshold - Credit balance floor that triggers a purchase.
13322
+ * @param opts.amount - Credits to purchase per top-up event.
13323
+ * @param opts.packageId - Credit package UUID to auto-purchase.
13028
13324
  */
13029
- get: (options?: RequestOptions) => Promise<Record<string, unknown>>;
13325
+ updateAutoTopUp: (walletId: string, opts: {
13326
+ enabled: boolean;
13327
+ threshold?: number;
13328
+ amount?: number;
13329
+ packageId?: string;
13330
+ }, options?: RequestOptions) => Promise<Wallet>;
13331
+ /**
13332
+ * Sub-namespace for invoice operations.
13333
+ *
13334
+ * Invoices are generated per billing period and carry a `pdf_url` for
13335
+ * receipt download. Use `invoices.list()` for the transaction history page.
13336
+ */
13337
+ invoices: {
13338
+ /**
13339
+ * Returns a single page of invoices for the current workspace.
13340
+ *
13341
+ * Each invoice includes `pdf_url` for receipt download.
13342
+ *
13343
+ * @example
13344
+ * ```typescript
13345
+ * const invoices = await client.billing.wallet.invoices.list();
13346
+ * const paidInvoices = invoices.filter(inv => inv.attributes?.status === "paid");
13347
+ * ```
13348
+ */
13349
+ list: (options?: {
13350
+ page?: number;
13351
+ pageSize?: number;
13352
+ } & RequestOptions) => Promise<Invoice[]>;
13353
+ /**
13354
+ * Fetches all invoices by automatically paginating through every page.
13355
+ *
13356
+ * @example
13357
+ * ```typescript
13358
+ * const all = await client.billing.wallet.invoices.listAll();
13359
+ * const downloadUrl = all[0].attributes?.pdf_url;
13360
+ * ```
13361
+ */
13362
+ listAll: (options?: RequestOptions) => Promise<Invoice[]>;
13363
+ };
13030
13364
  };
13031
13365
  /**
13032
13366
  * Sub-namespace for subscription plan operations.
@@ -13334,7 +13668,20 @@ declare function createBillingNamespace(rb: RequestBuilder): {
13334
13668
  * console.log(`Added card ending in ${method.last4}`);
13335
13669
  * ```
13336
13670
  */
13337
- create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<PaymentMethod>;
13671
+ create: (attributes: PaymentMethodCreateAttributes, options?: RequestOptions) => Promise<PaymentMethod>;
13672
+ /**
13673
+ * Tokenizes a raw card server-side and saves the resulting payment method.
13674
+ *
13675
+ * Use this for direct card collection flows where your server handles card
13676
+ * data (PCI-DSS scope applies). The platform tokenizes the card with QorPay
13677
+ * and stores only the token — raw card data is never persisted.
13678
+ *
13679
+ * For hosted-fields flows where the client tokenizes the card, use
13680
+ * `paymentMethods.create({ provider_token })` instead.
13681
+ *
13682
+ * @param cardDetails - Raw card fields including number, CVC, expiry, and billing address.
13683
+ */
13684
+ tokenize: (cardDetails: PaymentMethodTokenizeAttributes, options?: RequestOptions) => Promise<PaymentMethod>;
13338
13685
  /**
13339
13686
  * Updates the mutable attributes of an existing payment method, such as
13340
13687
  * the billing name or expiry date override.