@gpt-platform/client 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.js CHANGED
@@ -24,6 +24,7 @@ __export(index_exports, {
24
24
  AuthenticationError: () => AuthenticationError,
25
25
  AuthorizationError: () => AuthorizationError,
26
26
  BrowserApiKeyError: () => BrowserApiKeyError,
27
+ CardDeclinedError: () => CardDeclinedError,
27
28
  ConflictError: () => ConflictError,
28
29
  DEFAULT_API_VERSION: () => DEFAULT_API_VERSION,
29
30
  DEFAULT_RETRY_CONFIG: () => DEFAULT_RETRY_CONFIG,
@@ -33,12 +34,14 @@ __export(index_exports, {
33
34
  LOG_LEVELS: () => LOG_LEVELS,
34
35
  NetworkError: () => NetworkError,
35
36
  NotFoundError: () => NotFoundError,
37
+ PaymentRequiredError: () => PaymentRequiredError,
36
38
  RateLimitError: () => RateLimitError,
37
39
  RequestBuilder: () => RequestBuilder,
38
40
  RetryTimeoutError: () => RetryTimeoutError,
39
41
  SDK_VERSION: () => SDK_VERSION,
40
42
  SdkEventEmitter: () => SdkEventEmitter,
41
43
  ServerError: () => ServerError,
44
+ SubscriptionConflictError: () => SubscriptionConflictError,
42
45
  TimeoutError: () => TimeoutError,
43
46
  ValidationError: () => ValidationError,
44
47
  WebhookSignatureError: () => WebhookSignatureError,
@@ -962,6 +965,34 @@ var ConflictError = class extends GptCoreError {
962
965
  super(message, { statusCode: 409, code: "conflict_error", ...options });
963
966
  }
964
967
  };
968
+ var PaymentRequiredError = class extends GptCoreError {
969
+ constructor(message = "Payment required", options) {
970
+ super(message, {
971
+ statusCode: 402,
972
+ code: "payment_required",
973
+ ...options
974
+ });
975
+ }
976
+ };
977
+ var CardDeclinedError = class extends GptCoreError {
978
+ constructor(message = "Card declined", declineCode, options) {
979
+ super(message, {
980
+ statusCode: 402,
981
+ code: "card_declined",
982
+ ...options
983
+ });
984
+ this.declineCode = declineCode;
985
+ }
986
+ };
987
+ var SubscriptionConflictError = class extends GptCoreError {
988
+ constructor(message = "Subscription conflict", options) {
989
+ super(message, {
990
+ statusCode: 409,
991
+ code: "subscription_conflict",
992
+ ...options
993
+ });
994
+ }
995
+ };
965
996
  function handleApiError(error) {
966
997
  if (typeof error !== "object" || error === null) {
967
998
  throw new NetworkError(
@@ -970,7 +1001,7 @@ function handleApiError(error) {
970
1001
  }
971
1002
  const err = error;
972
1003
  const response = err.response || err;
973
- const statusCode = response.status || err.status || err.statusCode;
1004
+ let statusCode = response.status || err.status || err.statusCode;
974
1005
  const headers = response.headers || err.headers;
975
1006
  const requestId = (headers && typeof headers === "object" && "get" in headers ? headers.get("x-request-id") : headers?.["x-request-id"]) || void 0;
976
1007
  const body = response.body || response.data || err.body || err.data || err;
@@ -984,6 +1015,10 @@ function handleApiError(error) {
984
1015
  field: err2.source?.pointer?.split("/").pop(),
985
1016
  message: err2.detail || err2.title || "Unknown error"
986
1017
  }));
1018
+ if (!statusCode && firstError?.status) {
1019
+ const parsed = parseInt(firstError.status, 10);
1020
+ if (!isNaN(parsed)) statusCode = parsed;
1021
+ }
987
1022
  } else if (typeof body === "object" && body !== null && "message" in body && typeof body.message === "string") {
988
1023
  message = body.message;
989
1024
  } else if (typeof body === "string") {
@@ -1030,8 +1065,21 @@ function handleApiError(error) {
1030
1065
  throw new AuthorizationError(message, errorOptions);
1031
1066
  case 404:
1032
1067
  throw new NotFoundError(message, errorOptions);
1033
- case 409:
1068
+ case 402: {
1069
+ const bodyCode = typeof body === "object" && body !== null && "code" in body ? body.code : void 0;
1070
+ const declineCode = typeof body === "object" && body !== null && "decline_code" in body ? body.decline_code : void 0;
1071
+ if (bodyCode === "card_declined") {
1072
+ throw new CardDeclinedError(message, declineCode, errorOptions);
1073
+ }
1074
+ throw new PaymentRequiredError(message, errorOptions);
1075
+ }
1076
+ case 409: {
1077
+ const bodyCode409 = typeof body === "object" && body !== null && "code" in body ? body.code : void 0;
1078
+ if (bodyCode409 === "subscription_conflict") {
1079
+ throw new SubscriptionConflictError(message, errorOptions);
1080
+ }
1034
1081
  throw new ConflictError(message, errorOptions);
1082
+ }
1035
1083
  case 400:
1036
1084
  case 422:
1037
1085
  throw new ValidationError(message, errors, errorOptions);
@@ -1285,7 +1333,7 @@ function buildUserAgent(sdkVersion, appInfo) {
1285
1333
  }
1286
1334
 
1287
1335
  // src/version.ts
1288
- var SDK_VERSION = "0.4.2";
1336
+ var SDK_VERSION = "0.4.3";
1289
1337
  var DEFAULT_API_VERSION = "2026-02-27";
1290
1338
 
1291
1339
  // src/base-client.ts
@@ -1798,6 +1846,11 @@ var patchApiKeysByIdRotate = (options) => (options.client ?? client).patch({
1798
1846
  ...options.headers
1799
1847
  }
1800
1848
  });
1849
+ var getApplicationsCurrent = (options) => (options.client ?? client).get({
1850
+ security: [{ scheme: "bearer", type: "http" }],
1851
+ url: "/applications/current",
1852
+ ...options
1853
+ });
1801
1854
  var patchWorkspaceMembershipsByWorkspaceIdByUserIdProfile = (options) => (options.client ?? client).patch({
1802
1855
  security: [{ scheme: "bearer", type: "http" }],
1803
1856
  url: "/workspace-memberships/{workspace_id}/{user_id}/profile",
@@ -1807,6 +1860,15 @@ var patchWorkspaceMembershipsByWorkspaceIdByUserIdProfile = (options) => (option
1807
1860
  ...options.headers
1808
1861
  }
1809
1862
  });
1863
+ var postInvitationsAcceptByToken = (options) => (options.client ?? client).post({
1864
+ security: [{ scheme: "bearer", type: "http" }],
1865
+ url: "/invitations/accept-by-token",
1866
+ ...options,
1867
+ headers: {
1868
+ "Content-Type": "application/vnd.api+json",
1869
+ ...options.headers
1870
+ }
1871
+ });
1810
1872
  var getWorkspaces = (options) => (options.client ?? client).get({
1811
1873
  security: [{ scheme: "bearer", type: "http" }],
1812
1874
  url: "/workspaces",
@@ -1845,6 +1907,11 @@ var getAgentsByIdStats = (options) => (options.client ?? client).get({
1845
1907
  url: "/agents/{id}/stats",
1846
1908
  ...options
1847
1909
  });
1910
+ var getSchedulingEventsByParticipant = (options) => (options.client ?? client).get({
1911
+ security: [{ scheme: "bearer", type: "http" }],
1912
+ url: "/scheduling/events/by_participant",
1913
+ ...options
1914
+ });
1848
1915
  var getEmailTrackingEventsById = (options) => (options.client ?? client).get({
1849
1916
  security: [{ scheme: "bearer", type: "http" }],
1850
1917
  url: "/email/tracking-events/{id}",
@@ -1898,15 +1965,6 @@ var patchCrmDealsById = (options) => (options.client ?? client).patch({
1898
1965
  ...options.headers
1899
1966
  }
1900
1967
  });
1901
- var postUsersAuthResetPasswordRequest = (options) => (options.client ?? client).post({
1902
- security: [{ scheme: "bearer", type: "http" }],
1903
- url: "/users/auth/reset-password/request",
1904
- ...options,
1905
- headers: {
1906
- "Content-Type": "application/vnd.api+json",
1907
- ...options.headers
1908
- }
1909
- });
1910
1968
  var getSupportTagsWorkspaceByWorkspaceId = (options) => (options.client ?? client).get({
1911
1969
  security: [{ scheme: "bearer", type: "http" }],
1912
1970
  url: "/support/tags/workspace/{workspace_id}",
@@ -2038,6 +2096,11 @@ var getAgentsByIdTrainingExamples = (options) => (options.client ?? client).get(
2038
2096
  url: "/agents/{id}/training-examples",
2039
2097
  ...options
2040
2098
  });
2099
+ var getInvitationsConsumeByToken = (options) => (options.client ?? client).get({
2100
+ security: [{ scheme: "bearer", type: "http" }],
2101
+ url: "/invitations/consume/{token}",
2102
+ ...options
2103
+ });
2041
2104
  var postEmailMarketingCampaignsByIdOptimizeSendTimes = (options) => (options.client ?? client).post({
2042
2105
  security: [{ scheme: "bearer", type: "http" }],
2043
2106
  url: "/email-marketing/campaigns/{id}/optimize-send-times",
@@ -2104,6 +2167,15 @@ var patchRetentionPoliciesById = (options) => (options.client ?? client).patch({
2104
2167
  ...options.headers
2105
2168
  }
2106
2169
  });
2170
+ var patchInvitationsByIdRevoke = (options) => (options.client ?? client).patch({
2171
+ security: [{ scheme: "bearer", type: "http" }],
2172
+ url: "/invitations/{id}/revoke",
2173
+ ...options,
2174
+ headers: {
2175
+ "Content-Type": "application/vnd.api+json",
2176
+ ...options.headers
2177
+ }
2178
+ });
2107
2179
  var getCatalogTaxonomiesApplicationByApplicationId = (options) => (options.client ?? client).get({
2108
2180
  security: [{ scheme: "bearer", type: "http" }],
2109
2181
  url: "/catalog/taxonomies/application/{application_id}",
@@ -2409,6 +2481,15 @@ var getEmailMarketingUnsubscribersWorkspaceByWorkspaceId = (options) => (options
2409
2481
  url: "/email-marketing/unsubscribers/workspace/{workspace_id}",
2410
2482
  ...options
2411
2483
  });
2484
+ var patchInvitationsByIdResend = (options) => (options.client ?? client).patch({
2485
+ security: [{ scheme: "bearer", type: "http" }],
2486
+ url: "/invitations/{id}/resend",
2487
+ ...options,
2488
+ headers: {
2489
+ "Content-Type": "application/vnd.api+json",
2490
+ ...options.headers
2491
+ }
2492
+ });
2412
2493
  var getSearchSaved = (options) => (options.client ?? client).get({
2413
2494
  security: [{ scheme: "bearer", type: "http" }],
2414
2495
  url: "/search/saved",
@@ -2654,6 +2735,15 @@ var postSupportTickets = (options) => (options.client ?? client).post({
2654
2735
  ...options.headers
2655
2736
  }
2656
2737
  });
2738
+ var patchInvitationsByIdAccept = (options) => (options.client ?? client).patch({
2739
+ security: [{ scheme: "bearer", type: "http" }],
2740
+ url: "/invitations/{id}/accept",
2741
+ ...options,
2742
+ headers: {
2743
+ "Content-Type": "application/vnd.api+json",
2744
+ ...options.headers
2745
+ }
2746
+ });
2657
2747
  var getCreditPackagesById = (options) => (options.client ?? client).get({
2658
2748
  security: [{ scheme: "bearer", type: "http" }],
2659
2749
  url: "/credit-packages/{id}",
@@ -2847,6 +2937,20 @@ var getSchedulingBookingsById = (options) => (options.client ?? client).get({
2847
2937
  url: "/scheduling/bookings/{id}",
2848
2938
  ...options
2849
2939
  });
2940
+ var getTenantMemberships = (options) => (options.client ?? client).get({
2941
+ security: [{ scheme: "bearer", type: "http" }],
2942
+ url: "/tenant-memberships",
2943
+ ...options
2944
+ });
2945
+ var postTenantMemberships = (options) => (options.client ?? client).post({
2946
+ security: [{ scheme: "bearer", type: "http" }],
2947
+ url: "/tenant-memberships",
2948
+ ...options,
2949
+ headers: {
2950
+ "Content-Type": "application/vnd.api+json",
2951
+ ...options.headers
2952
+ }
2953
+ });
2850
2954
  var getWebhookDeliveriesById = (options) => (options.client ?? client).get({
2851
2955
  security: [{ scheme: "bearer", type: "http" }],
2852
2956
  url: "/webhook-deliveries/{id}",
@@ -3449,6 +3553,11 @@ var getEmailTrackingEventsWorkspaceByWorkspaceId = (options) => (options.client
3449
3553
  url: "/email/tracking-events/workspace/{workspace_id}",
3450
3554
  ...options
3451
3555
  });
3556
+ var getTenants = (options) => (options.client ?? client).get({
3557
+ security: [{ scheme: "bearer", type: "http" }],
3558
+ url: "/tenants",
3559
+ ...options
3560
+ });
3452
3561
  var getExtractionSchemaDiscoveriesById = (options) => (options.client ?? client).get({
3453
3562
  security: [{ scheme: "bearer", type: "http" }],
3454
3563
  url: "/extraction/schema-discoveries/{id}",
@@ -3858,6 +3967,15 @@ var getApplicationsById = (options) => (options.client ?? client).get({
3858
3967
  url: "/applications/{id}",
3859
3968
  ...options
3860
3969
  });
3970
+ var patchApplicationsById = (options) => (options.client ?? client).patch({
3971
+ security: [{ scheme: "bearer", type: "http" }],
3972
+ url: "/applications/{id}",
3973
+ ...options,
3974
+ headers: {
3975
+ "Content-Type": "application/vnd.api+json",
3976
+ ...options.headers
3977
+ }
3978
+ });
3861
3979
  var patchEmailOutboundEmailsByIdSchedule = (options) => (options.client ?? client).patch({
3862
3980
  security: [{ scheme: "bearer", type: "http" }],
3863
3981
  url: "/email/outbound-emails/{id}/schedule",
@@ -4332,15 +4450,6 @@ var getExtractionDocumentsWorkspaceByWorkspaceId = (options) => (options.client
4332
4450
  url: "/extraction/documents/workspace/{workspace_id}",
4333
4451
  ...options
4334
4452
  });
4335
- var patchApplicationsByIdAllocateCredits = (options) => (options.client ?? client).patch({
4336
- security: [{ scheme: "bearer", type: "http" }],
4337
- url: "/applications/{id}/allocate-credits",
4338
- ...options,
4339
- headers: {
4340
- "Content-Type": "application/vnd.api+json",
4341
- ...options.headers
4342
- }
4343
- });
4344
4453
  var postUsersAuthMagicLinkRequest = (options) => (options.client ?? client).post({
4345
4454
  security: [{ scheme: "bearer", type: "http" }],
4346
4455
  url: "/users/auth/magic-link/request",
@@ -4439,6 +4548,25 @@ var getExtractionDocuments = (options) => (options.client ?? client).get({
4439
4548
  url: "/extraction/documents",
4440
4549
  ...options
4441
4550
  });
4551
+ var getDataStoreRecordsByNamespace = (options) => (options.client ?? client).get({
4552
+ security: [{ scheme: "bearer", type: "http" }],
4553
+ url: "/data_store/records/by_namespace",
4554
+ ...options
4555
+ });
4556
+ var deleteTenantMembershipsByTenantIdByUserId = (options) => (options.client ?? client).delete({
4557
+ security: [{ scheme: "bearer", type: "http" }],
4558
+ url: "/tenant-memberships/{tenant_id}/{user_id}",
4559
+ ...options
4560
+ });
4561
+ var patchTenantMembershipsByTenantIdByUserId = (options) => (options.client ?? client).patch({
4562
+ security: [{ scheme: "bearer", type: "http" }],
4563
+ url: "/tenant-memberships/{tenant_id}/{user_id}",
4564
+ ...options,
4565
+ headers: {
4566
+ "Content-Type": "application/vnd.api+json",
4567
+ ...options.headers
4568
+ }
4569
+ });
4442
4570
  var getCrmDealsWorkspaceByWorkspaceId = (options) => (options.client ?? client).get({
4443
4571
  security: [{ scheme: "bearer", type: "http" }],
4444
4572
  url: "/crm/deals/workspace/{workspace_id}",
@@ -4903,6 +5031,11 @@ var deleteWorkspaceMembershipsByWorkspaceIdByUserId = (options) => (options.clie
4903
5031
  url: "/workspace-memberships/{workspace_id}/{user_id}",
4904
5032
  ...options
4905
5033
  });
5034
+ var getWorkspaceMembershipsByWorkspaceIdByUserId = (options) => (options.client ?? client).get({
5035
+ security: [{ scheme: "bearer", type: "http" }],
5036
+ url: "/workspace-memberships/{workspace_id}/{user_id}",
5037
+ ...options
5038
+ });
4906
5039
  var patchWorkspaceMembershipsByWorkspaceIdByUserId = (options) => (options.client ?? client).patch({
4907
5040
  security: [{ scheme: "bearer", type: "http" }],
4908
5041
  url: "/workspace-memberships/{workspace_id}/{user_id}",
@@ -4955,6 +5088,15 @@ var getUsers = (options) => (options.client ?? client).get({
4955
5088
  url: "/users",
4956
5089
  ...options
4957
5090
  });
5091
+ var postDataStoreRecordsUpsert = (options) => (options.client ?? client).post({
5092
+ security: [{ scheme: "bearer", type: "http" }],
5093
+ url: "/data_store/records/upsert",
5094
+ ...options,
5095
+ headers: {
5096
+ "Content-Type": "application/vnd.api+json",
5097
+ ...options.headers
5098
+ }
5099
+ });
4958
5100
  var deleteSupportTicketsById = (options) => (options.client ?? client).delete({
4959
5101
  security: [{ scheme: "bearer", type: "http" }],
4960
5102
  url: "/support/tickets/{id}",
@@ -7249,6 +7391,9 @@ function createBillingNamespace(rb) {
7249
7391
  * Preview the cost and effective date of a plan change before committing.
7250
7392
  *
7251
7393
  * @param planSlug - The slug of the target plan (e.g. `"pro-monthly"`).
7394
+ * @returns A projected `Wallet` representing the hypothetical post-change
7395
+ * state — **not** the caller's current wallet. Do not cache or use this
7396
+ * as live balance data. Call `wallet.get()` for authoritative state.
7252
7397
  */
7253
7398
  previewPlanChange: async (planSlug, options) => {
7254
7399
  return rb.execute(
@@ -7260,14 +7405,41 @@ function createBillingNamespace(rb) {
7260
7405
  /**
7261
7406
  * Change the workspace's subscription plan.
7262
7407
  *
7408
+ * Two call signatures:
7409
+ * - `changePlan(planSlug)` — fetches the wallet automatically (recommended)
7410
+ * - `changePlan(walletId, planSlug)` — use when you already have the wallet ID
7411
+ *
7263
7412
  * Upgrades charge a prorated amount immediately against the default payment
7264
7413
  * method. Downgrades are deferred to the end of the current billing period.
7265
7414
  * Use `previewPlanChange` first to show the user a cost estimate.
7266
7415
  *
7267
- * @param walletId - The wallet UUID from `wallet.get()`.
7268
- * @param planSlug - The slug of the target plan (e.g. `"pro-monthly"`).
7416
+ * @example
7417
+ * ```typescript
7418
+ * // Simple form — no wallet ID needed
7419
+ * await client.billing.wallet.changePlan("pro-monthly");
7420
+ *
7421
+ * // Explicit form — when walletId is already known
7422
+ * await client.billing.wallet.changePlan(wallet.id, "pro-monthly");
7423
+ * ```
7269
7424
  */
7270
- changePlan: async (walletId, planSlug, options) => {
7425
+ changePlan: async (walletIdOrSlug, planSlugOrOptions, options) => {
7426
+ let walletId;
7427
+ let planSlug;
7428
+ let reqOptions;
7429
+ if (typeof planSlugOrOptions === "string") {
7430
+ walletId = walletIdOrSlug;
7431
+ planSlug = planSlugOrOptions;
7432
+ reqOptions = options;
7433
+ } else {
7434
+ const wallet = await rb.execute(
7435
+ getWallet,
7436
+ {},
7437
+ planSlugOrOptions
7438
+ );
7439
+ walletId = wallet.id;
7440
+ planSlug = walletIdOrSlug;
7441
+ reqOptions = planSlugOrOptions;
7442
+ }
7271
7443
  return rb.execute(
7272
7444
  patchWalletPlan,
7273
7445
  {
@@ -7279,7 +7451,7 @@ function createBillingNamespace(rb) {
7279
7451
  }
7280
7452
  }
7281
7453
  },
7282
- options
7454
+ reqOptions
7283
7455
  );
7284
7456
  },
7285
7457
  /**
@@ -7748,8 +7920,12 @@ function createBillingNamespace(rb) {
7748
7920
  * const client = new GptClient({ apiKey: 'sk_app_...' });
7749
7921
  *
7750
7922
  * const method = await client.billing.paymentMethods.create({
7751
- * token: 'tok_visa_4242',
7752
- * billing_name: 'Acme Corp',
7923
+ * provider_token: 'tok_visa_4242',
7924
+ * type: 'card',
7925
+ * last4: '4242',
7926
+ * exp_month: 12,
7927
+ * exp_year: 2027,
7928
+ * brand: 'Visa',
7753
7929
  * });
7754
7930
  * console.log(`Added card ending in ${method.last4}`);
7755
7931
  * ```
@@ -7764,14 +7940,21 @@ function createBillingNamespace(rb) {
7764
7940
  /**
7765
7941
  * Tokenizes a raw card server-side and saves the resulting payment method.
7766
7942
  *
7767
- * Use this for direct card collection flows where your server handles card
7768
- * data (PCI-DSS scope applies). The platform tokenizes the card with QorPay
7769
- * and stores only the token raw card data is never persisted.
7943
+ * @remarks **SERVER-SIDE ONLY PCI-DSS.**
7944
+ * This method transmits raw card numbers (`card_number`, `cvc`) over the
7945
+ * network. It **must only be called from a trusted server context** (Node.js,
7946
+ * server-side rendering). Calling this method from browser/client-side code
7947
+ * (React, Vue, browser fetch) is a **PCI-DSS violation** — raw card numbers
7948
+ * must never pass through browser memory or JavaScript bundles.
7949
+ *
7950
+ * For browser flows, use the payment provider's hosted fields iframe to tokenize
7951
+ * on the client side, then call `paymentMethods.create({ provider_token })` instead.
7770
7952
  *
7771
- * For hosted-fields flows where the client tokenizes the card, use
7772
- * `paymentMethods.create({ provider_token })` instead.
7953
+ * The platform forwards `cardDetails` to the payment gateway over TLS and stores
7954
+ * only the resulting token — raw card data is never persisted.
7773
7955
  *
7774
- * @param cardDetails - Raw card fields including number, CVC, expiry, and billing address.
7956
+ * @param cardDetails - Raw PCI-sensitive card fields. All fields must be treated
7957
+ * as sensitive: do not log, serialize, or pass through error reporters.
7775
7958
  */
7776
7959
  tokenize: async (cardDetails, options) => {
7777
7960
  return rb.execute(
@@ -16205,8 +16388,12 @@ function createIdentityNamespace(rb, baseUrl) {
16205
16388
  );
16206
16389
  },
16207
16390
  /** Resend confirmation email to an unconfirmed user */
16208
- resendConfirmation: async (options) => {
16209
- return rb.execute(postUsersAuthResendConfirmation, {}, options);
16391
+ resendConfirmation: async (email, options) => {
16392
+ return rb.execute(
16393
+ postUsersAuthResendConfirmation,
16394
+ { body: { data: { type: "user", attributes: { email } } } },
16395
+ options
16396
+ );
16210
16397
  },
16211
16398
  /** Confirm an email address using the token from the confirmation email */
16212
16399
  confirmEmail: async (email, confirmationToken, options) => {
@@ -16247,7 +16434,7 @@ function createIdentityNamespace(rb, baseUrl) {
16247
16434
  requestPasswordReset: async (email, options) => {
16248
16435
  RequestPasswordResetSchema.parse({ email });
16249
16436
  return rb.execute(
16250
- postUsersAuthResetPasswordRequest,
16437
+ patchUsersAuthResetPassword,
16251
16438
  {
16252
16439
  body: {
16253
16440
  data: { type: "user", attributes: { email } }
@@ -17125,7 +17312,7 @@ function createPlatformNamespace(rb) {
17125
17312
  */
17126
17313
  update: async (id, attributes, options) => {
17127
17314
  return rb.execute(
17128
- patchApplicationsByIdAllocateCredits,
17315
+ patchApplicationsById,
17129
17316
  {
17130
17317
  path: { id },
17131
17318
  body: { data: { id, type: "application", attributes } }
@@ -17172,7 +17359,7 @@ function createPlatformNamespace(rb) {
17172
17359
  * ```
17173
17360
  */
17174
17361
  readCurrent: async (options) => {
17175
- return rb.execute(postApplications, {}, options);
17362
+ return rb.execute(getApplicationsCurrent, {}, options);
17176
17363
  }
17177
17364
  },
17178
17365
  /**
@@ -17183,6 +17370,21 @@ function createPlatformNamespace(rb) {
17183
17370
  * ISVs provision tenants when onboarding new customers.
17184
17371
  */
17185
17372
  tenants: {
17373
+ /**
17374
+ * List all tenants (paginated).
17375
+ *
17376
+ * Returns tenants accessible to the current actor (application-scoped).
17377
+ *
17378
+ * @param options - Optional page number, page size, and request options.
17379
+ * @returns A page of `Tenant` records.
17380
+ */
17381
+ list: async (options) => {
17382
+ return rb.execute(
17383
+ getTenants,
17384
+ buildPageQuery(options?.page, options?.pageSize),
17385
+ options
17386
+ );
17387
+ },
17186
17388
  /**
17187
17389
  * List document statistics for tenants (paginated).
17188
17390
  *
@@ -17199,30 +17401,35 @@ function createPlatformNamespace(rb) {
17199
17401
  * stats.forEach(s => console.log(s.attributes?.document_count));
17200
17402
  * ```
17201
17403
  */
17202
- listDocumentStats: async (options) => {
17404
+ listDocumentStats: async (tenantId, options) => {
17203
17405
  return rb.execute(
17204
17406
  getTenantsByTenantIdDocumentStats,
17205
- buildPageQuery(options?.page, options?.pageSize),
17407
+ {
17408
+ path: { tenant_id: tenantId },
17409
+ ...buildPageQuery(options?.page, options?.pageSize)
17410
+ },
17206
17411
  options
17207
17412
  );
17208
17413
  },
17209
17414
  /**
17210
17415
  * List all document statistics for tenants, auto-paginating.
17211
17416
  *
17417
+ * @param tenantId - The UUID of the tenant.
17212
17418
  * @param options - Optional request options.
17213
17419
  * @returns All tenant document stat records as a flat array.
17214
17420
  *
17215
17421
  * @example
17216
17422
  * ```typescript
17217
17423
  * const client = new GptClient({ apiKey: 'sk_app_...' });
17218
- * const allStats = await client.platform.tenants.listAllDocumentStats();
17424
+ * const allStats = await client.platform.tenants.listAllDocumentStats('tenant_abc123');
17219
17425
  * ```
17220
17426
  */
17221
- listAllDocumentStats: async (options) => {
17427
+ listAllDocumentStats: async (tenantId, options) => {
17222
17428
  return paginateToArray(
17223
17429
  rb.createPaginatedFetcher(
17224
17430
  getTenantsByTenantIdDocumentStats,
17225
17431
  (page, pageSize) => ({
17432
+ path: { tenant_id: tenantId },
17226
17433
  query: { page: { number: page, size: pageSize } }
17227
17434
  }),
17228
17435
  options
@@ -17247,10 +17454,15 @@ function createPlatformNamespace(rb) {
17247
17454
  * console.log(tenant.attributes?.credit_balance);
17248
17455
  * ```
17249
17456
  */
17250
- credit: async (id, options) => {
17457
+ credit: async (id, amount, description, options) => {
17458
+ const attributes = { amount };
17459
+ if (description !== void 0) attributes.description = description;
17251
17460
  return rb.execute(
17252
17461
  postTenantsByIdCredit,
17253
- { path: { id }, body: {} },
17462
+ {
17463
+ path: { id },
17464
+ body: { data: { type: "tenant", attributes } }
17465
+ },
17254
17466
  options
17255
17467
  );
17256
17468
  },
@@ -17358,24 +17570,6 @@ function createPlatformNamespace(rb) {
17358
17570
  );
17359
17571
  },
17360
17572
  /**
17361
- * Add a payment method to a tenant via raw details (server-to-server proxy).
17362
- *
17363
- * Proxies payment method registration to the underlying payment provider
17364
- * on behalf of the tenant. Used in server-side flows where the payment
17365
- * form is embedded by the ISV rather than the platform.
17366
- *
17367
- * @param options - Optional request options.
17368
- * @returns The updated `Tenant` with new payment method reference.
17369
- *
17370
- * @example
17371
- * ```typescript
17372
- * const client = new GptClient({ apiKey: 'sk_app_...' });
17373
- * const tenant = await client.platform.tenants.addPaymentMethod();
17374
- * ```
17375
- */
17376
- addPaymentMethod: async (options) => {
17377
- return rb.execute(postTenantsIsv, {}, options);
17378
- },
17379
17573
  /**
17380
17574
  * Retrieve a single tenant by its ID.
17381
17575
  *
@@ -17392,6 +17586,33 @@ function createPlatformNamespace(rb) {
17392
17586
  */
17393
17587
  get: async (id, options) => {
17394
17588
  return rb.execute(getTenantsById, { path: { id } }, options);
17589
+ },
17590
+ /**
17591
+ * Transfer ownership of a tenant to another admin member.
17592
+ *
17593
+ * The new owner must already be a tenant admin. The previous owner
17594
+ * retains their admin role. Cannot be used on personal tenants.
17595
+ *
17596
+ * @param tenantId - The UUID of the tenant to transfer.
17597
+ * @param newOwnerId - The UUID of the user to become the new owner.
17598
+ * @param options - Optional request options.
17599
+ * @returns The updated `Tenant`.
17600
+ */
17601
+ transferOwnership: async (tenantId, newOwnerId, options) => {
17602
+ return rb.execute(
17603
+ patchTenantsById,
17604
+ {
17605
+ path: { id: tenantId },
17606
+ body: {
17607
+ data: {
17608
+ id: tenantId,
17609
+ type: "tenant",
17610
+ attributes: { new_owner_id: newOwnerId }
17611
+ }
17612
+ }
17613
+ },
17614
+ options
17615
+ );
17395
17616
  }
17396
17617
  },
17397
17618
  /**
@@ -17399,22 +17620,63 @@ function createPlatformNamespace(rb) {
17399
17620
  */
17400
17621
  invitations: {
17401
17622
  /**
17402
- * Delete (revoke) the current user's pending invitation.
17623
+ * Accept a pending invitation (authenticated user flow).
17403
17624
  *
17404
- * Removes the invitation so it can no longer be accepted or declined.
17405
- * Typically used by the inviting party to cancel an outstanding invite.
17625
+ * Accepts an invitation the current user received, creating
17626
+ * the appropriate membership records.
17406
17627
  *
17628
+ * @param id - The UUID of the invitation to accept.
17407
17629
  * @param options - Optional request options.
17408
- * @returns `true` on successful deletion.
17630
+ * @returns The updated `Invitation`.
17631
+ */
17632
+ accept: async (id, options) => {
17633
+ return rb.execute(
17634
+ patchInvitationsByIdAccept,
17635
+ {
17636
+ path: { id },
17637
+ body: { data: { id, type: "invitation", attributes: {} } }
17638
+ },
17639
+ options
17640
+ );
17641
+ },
17642
+ /**
17643
+ * Decline a pending invitation.
17409
17644
  *
17410
- * @example
17411
- * ```typescript
17412
- * const client = new GptClient({ apiKey: 'sk_app_...' });
17413
- * await client.platform.invitations.delete();
17414
- * ```
17645
+ * The invitation status is set to `:declined` and no membership is created.
17646
+ *
17647
+ * @param id - The UUID of the invitation to decline.
17648
+ * @param options - Optional request options.
17649
+ * @returns The updated `Invitation`.
17415
17650
  */
17416
- delete: async (options) => {
17417
- return rb.executeDelete(getInvitationsMe, { path: {} }, options);
17651
+ decline: async (id, options) => {
17652
+ return rb.execute(
17653
+ patchInvitationsByIdDecline,
17654
+ {
17655
+ path: { id },
17656
+ body: { data: { id, type: "invitation", attributes: {} } }
17657
+ },
17658
+ options
17659
+ );
17660
+ },
17661
+ /**
17662
+ * Revoke a pending invitation (inviter flow).
17663
+ *
17664
+ * Cancels the invitation so it can no longer be accepted or declined.
17665
+ * Callable by the original inviter or a tenant admin.
17666
+ *
17667
+ * @param id - The UUID of the invitation to revoke.
17668
+ * @param options - Optional request options.
17669
+ * @returns The updated `Invitation`.
17670
+ */
17671
+ revoke: async (id, options) => {
17672
+ return rb.execute(
17673
+ patchInvitationsByIdRevoke,
17674
+ {
17675
+ path: { id },
17676
+ body: { data: { id, type: "invitation", attributes: {} } }
17677
+ },
17678
+ options
17679
+ );
17418
17680
  },
17419
17681
  /**
17420
17682
  * List pending invitations for the currently authenticated user (paginated).
@@ -17493,31 +17755,119 @@ function createPlatformNamespace(rb) {
17493
17755
  );
17494
17756
  },
17495
17757
  /**
17496
- * Update an invitation (e.g., decline it).
17758
+ /**
17759
+ * Resend an invitation email with a refreshed token and new 7-day expiry.
17497
17760
  *
17498
- * Used by the invited user to respond to an invitation. Pass
17499
- * `{ status: "declined" }` in attributes to decline. Accepting
17500
- * an invitation is handled separately through the acceptance flow.
17761
+ * Only pending invitations can be resent. Generates a new token (invalidating
17762
+ * the old one) and re-sends the invitation email. Callable by the original
17763
+ * inviter or the tenant owner.
17501
17764
  *
17502
- * @param id - The UUID of the invitation to update.
17503
- * @param attributes - Attribute map, typically `{ status: "declined" }`.
17765
+ * @param id - The UUID of the invitation to resend.
17504
17766
  * @param options - Optional request options.
17505
17767
  * @returns The updated `Invitation`.
17506
17768
  *
17507
17769
  * @example
17508
17770
  * ```typescript
17509
17771
  * const client = new GptClient({ apiKey: 'sk_app_...' });
17510
- * const invite = await client.platform.invitations.update('inv_abc123', {
17511
- * status: 'declined',
17512
- * });
17772
+ * await client.platform.invitations.resend('inv_abc123');
17513
17773
  * ```
17514
17774
  */
17515
- update: async (id, attributes, options) => {
17775
+ resend: async (id, applicationId, options) => {
17516
17776
  return rb.execute(
17517
- patchInvitationsByIdDecline,
17777
+ patchInvitationsByIdResend,
17518
17778
  {
17519
17779
  path: { id },
17520
- body: { data: { id, type: "invitation", attributes } }
17780
+ body: {
17781
+ data: {
17782
+ id,
17783
+ type: "invitation",
17784
+ ...applicationId ? { attributes: { application_id: applicationId } } : {}
17785
+ }
17786
+ }
17787
+ },
17788
+ options
17789
+ );
17790
+ },
17791
+ /**
17792
+ * Look up a pending invitation by its raw token.
17793
+ *
17794
+ * Call this on the `/invite/:token` landing page to display invitation
17795
+ * details before the user accepts. Returns the full invitation record
17796
+ * including `email` (to pre-fill the register form), `role`, `scope_type`,
17797
+ * `scope_id`, `tenant_id`, `expires_at`, and the `inviter` relationship
17798
+ * (pass `include=inviter` via request options to embed inviter email).
17799
+ *
17800
+ * Returns `null` if the token is invalid, already used, or expired —
17801
+ * there is no partial response for consumed tokens.
17802
+ *
17803
+ * **Note:** The response does not include the workspace or tenant name.
17804
+ * Fetch it separately using `platform.workspaces.get(scope_id)` or
17805
+ * `platform.tenants.get(scope_id)` based on `scope_type`.
17806
+ *
17807
+ * @param token - The raw invitation token from the email link (`/invite/:token`).
17808
+ * @param options - Optional request options (e.g., `{ headers: { include: 'inviter' } }`).
17809
+ * @returns The pending `Invitation` record, or `null` if not found.
17810
+ *
17811
+ * @example
17812
+ * ```typescript
17813
+ * // On your /invite/:token page
17814
+ * const invite = await client.platform.invitations.consumeByToken(token);
17815
+ * if (!invite) {
17816
+ * // Token expired or already used
17817
+ * return redirect('/invite/expired');
17818
+ * }
17819
+ * // Pre-fill form
17820
+ * setEmail(invite.attributes?.email);
17821
+ * setRole(invite.attributes?.role);
17822
+ * ```
17823
+ */
17824
+ consumeByToken: async (token, options) => {
17825
+ try {
17826
+ return await rb.execute(
17827
+ getInvitationsConsumeByToken,
17828
+ { path: { token } },
17829
+ options
17830
+ );
17831
+ } catch {
17832
+ return null;
17833
+ }
17834
+ },
17835
+ /**
17836
+ * Accept a pending invitation using only the raw token.
17837
+ *
17838
+ * Call this after the user is authenticated (either via `registerViaInvitation`
17839
+ * or an existing account login). The platform validates the token, creates or
17840
+ * upgrades the user's `TenantMembership` and `WorkspaceMembership`, and returns
17841
+ * the accepted invitation.
17842
+ *
17843
+ * For new users: `registerViaInvitation` accepts the invitation atomically —
17844
+ * do NOT call `acceptByToken` again after registration. Only call this for
17845
+ * existing users accepting a new invite after sign-in.
17846
+ *
17847
+ * @param token - The raw invitation token from the email link.
17848
+ * @param options - Optional request options.
17849
+ * @returns The accepted `Invitation` with `scope_id` and `tenant_id` populated.
17850
+ *
17851
+ * @example
17852
+ * ```typescript
17853
+ * // Existing user accepting an invite after login
17854
+ * const accepted = await client.platform.invitations.acceptByToken(token);
17855
+ * const workspaceId = accepted.attributes?.scope_type === 'workspace'
17856
+ * ? accepted.attributes?.scope_id
17857
+ * : null;
17858
+ * const tenantId = accepted.attributes?.tenant_id;
17859
+ * ```
17860
+ */
17861
+ acceptByToken: async (token, options) => {
17862
+ return rb.execute(
17863
+ postInvitationsAcceptByToken,
17864
+ {
17865
+ body: {
17866
+ data: {
17867
+ type: "invitation",
17868
+ attributes: { token }
17869
+ }
17870
+ }
17521
17871
  },
17522
17872
  options
17523
17873
  );
@@ -17560,6 +17910,42 @@ function createPlatformNamespace(rb) {
17560
17910
  options
17561
17911
  );
17562
17912
  },
17913
+ /**
17914
+ * List workspace members with user profile data (name, email, avatar) included.
17915
+ *
17916
+ * Equivalent to `list()` with `?include=user,user.profile` appended. Each
17917
+ * membership in the response will have `relationships.user` and nested
17918
+ * `user.relationships.profile` populated in the JSON:API `included` array.
17919
+ *
17920
+ * The `RequestBuilder` flattens included relationships automatically, so
17921
+ * each membership object will have `user` and `user.profile` accessible.
17922
+ *
17923
+ * @param workspaceId - The UUID of the workspace to list members for.
17924
+ * @param options - Optional page number, page size, and request options.
17925
+ * @returns A page of `WorkspaceMembership` records with embedded user + profile.
17926
+ *
17927
+ * @example
17928
+ * ```typescript
17929
+ * const members = await client.platform.workspaceMembers.listWithProfiles('ws_abc123');
17930
+ * members.forEach(m => {
17931
+ * console.log(m.attributes?.user_id, m.attributes?.role);
17932
+ * // Profile fields come from included relationships
17933
+ * });
17934
+ * ```
17935
+ */
17936
+ listWithProfiles: async (workspaceId, options) => {
17937
+ return rb.execute(
17938
+ getWorkspaceMemberships,
17939
+ {
17940
+ query: {
17941
+ filter: { workspace_id: workspaceId },
17942
+ include: "user,user.profile",
17943
+ ...buildPageQuery(options?.page, options?.pageSize)?.query
17944
+ }
17945
+ },
17946
+ options
17947
+ );
17948
+ },
17563
17949
  /**
17564
17950
  * Retrieve the membership record for a specific user within a workspace.
17565
17951
  *
@@ -17579,8 +17965,9 @@ function createPlatformNamespace(rb) {
17579
17965
  * ```
17580
17966
  */
17581
17967
  get: async (workspaceId, memberId, options) => {
17582
- return rb.rawGet(
17583
- `/workspace-memberships/${workspaceId}/${memberId}`,
17968
+ return rb.execute(
17969
+ getWorkspaceMembershipsByWorkspaceIdByUserId,
17970
+ { path: { workspace_id: workspaceId, user_id: memberId } },
17584
17971
  options
17585
17972
  );
17586
17973
  },
@@ -17811,6 +18198,95 @@ function createPlatformNamespace(rb) {
17811
18198
  options
17812
18199
  );
17813
18200
  }
18201
+ },
18202
+ /**
18203
+ * Tenant Members — manage tenant-level membership (org roles).
18204
+ *
18205
+ * TenantMembership records represent a user's role within a tenant.
18206
+ * Roles are either `"admin"` or `"member"`.
18207
+ */
18208
+ tenantMembers: {
18209
+ /**
18210
+ * List members of a tenant (paginated).
18211
+ *
18212
+ * @param tenantId - The UUID of the tenant.
18213
+ * @param options - Optional page number, page size, and request options.
18214
+ * @returns A page of `TenantMembership` records.
18215
+ */
18216
+ list: async (tenantId, options) => {
18217
+ return rb.execute(
18218
+ getTenantMemberships,
18219
+ {
18220
+ query: {
18221
+ filter: { tenant_id: tenantId },
18222
+ ...buildPageQuery(options?.page, options?.pageSize).query
18223
+ }
18224
+ },
18225
+ options
18226
+ );
18227
+ },
18228
+ /**
18229
+ * Add a user to a tenant with the given role.
18230
+ *
18231
+ * @param tenantId - The UUID of the tenant.
18232
+ * @param userId - The UUID of the user to add.
18233
+ * @param role - The role to assign (`"admin"` or `"member"`).
18234
+ * @param options - Optional request options.
18235
+ * @returns The created `TenantMembership`.
18236
+ */
18237
+ create: async (tenantId, userId, role, options) => {
18238
+ return rb.execute(
18239
+ postTenantMemberships,
18240
+ {
18241
+ body: {
18242
+ data: {
18243
+ type: "tenant_membership",
18244
+ attributes: { tenant_id: tenantId, user_id: userId, role }
18245
+ }
18246
+ }
18247
+ },
18248
+ options
18249
+ );
18250
+ },
18251
+ /**
18252
+ * Change a member's role within a tenant.
18253
+ *
18254
+ * @param tenantId - The UUID of the tenant.
18255
+ * @param userId - The UUID of the user.
18256
+ * @param role - The new role (`"admin"` or `"member"`).
18257
+ * @param options - Optional request options.
18258
+ * @returns The updated `TenantMembership`.
18259
+ */
18260
+ updateRole: async (tenantId, userId, role, options) => {
18261
+ return rb.execute(
18262
+ patchTenantMembershipsByTenantIdByUserId,
18263
+ {
18264
+ path: { tenant_id: tenantId, user_id: userId },
18265
+ body: {
18266
+ data: {
18267
+ type: "tenant_membership",
18268
+ attributes: { role }
18269
+ }
18270
+ }
18271
+ },
18272
+ options
18273
+ );
18274
+ },
18275
+ /**
18276
+ * Remove a user from a tenant.
18277
+ *
18278
+ * @param tenantId - The UUID of the tenant.
18279
+ * @param userId - The UUID of the user to remove.
18280
+ * @param options - Optional request options.
18281
+ * @returns `true` on success.
18282
+ */
18283
+ remove: async (tenantId, userId, options) => {
18284
+ return rb.executeDelete(
18285
+ deleteTenantMembershipsByTenantIdByUserId,
18286
+ { path: { tenant_id: tenantId, user_id: userId } },
18287
+ options
18288
+ );
18289
+ }
17814
18290
  }
17815
18291
  };
17816
18292
  }
@@ -18099,6 +18575,42 @@ function createSchedulingNamespace(rb) {
18099
18575
  },
18100
18576
  options
18101
18577
  );
18578
+ },
18579
+ /**
18580
+ * List events that include a specific participant by email.
18581
+ *
18582
+ * Use this to retrieve all sessions for a client (e.g., all appointments
18583
+ * for a given patient). Filters events in the workspace where a Participant
18584
+ * record with the given email exists.
18585
+ *
18586
+ * @param email - The participant's email address to filter by.
18587
+ * @param workspaceId - The workspace to scope the query to.
18588
+ * @param options - Optional page number, page size, and request options.
18589
+ * @returns A flat array of `SchedulingEvent` records.
18590
+ *
18591
+ * @example
18592
+ * ```typescript
18593
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
18594
+ * const sessions = await client.scheduling.events.listByParticipant(
18595
+ * 'patient@example.com',
18596
+ * workspaceId,
18597
+ * );
18598
+ * sessions.forEach(s => console.log(s.attributes?.start_time, s.attributes?.status));
18599
+ * ```
18600
+ */
18601
+ listByParticipant: async (email, workspaceId, options) => {
18602
+ return rb.execute(
18603
+ getSchedulingEventsByParticipant,
18604
+ {
18605
+ query: {
18606
+ email,
18607
+ workspace_id: workspaceId,
18608
+ ...options?.pageSize && { "page[size]": options.pageSize },
18609
+ ...options?.page && { "page[number]": options.page }
18610
+ }
18611
+ },
18612
+ options
18613
+ );
18102
18614
  }
18103
18615
  },
18104
18616
  /**
@@ -18659,6 +19171,91 @@ function createSchedulingNamespace(rb) {
18659
19171
  options
18660
19172
  );
18661
19173
  }
19174
+ },
19175
+ /**
19176
+ * Session Notes — clinical notes per appointment, stored in DataStore.
19177
+ *
19178
+ * Notes are keyed by `{eventId}:{noteType}` under the `sessions` namespace.
19179
+ * Each event supports up to 4 note types: `adime`, `soap`, `goals`, `email`.
19180
+ *
19181
+ * Notes are versioned automatically by DataStore — each `upsert` increments
19182
+ * the version counter. Full version history retrieval requires a future
19183
+ * DataStore enhancement.
19184
+ *
19185
+ * @example
19186
+ * ```typescript
19187
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
19188
+ *
19189
+ * // Read an ADIME note
19190
+ * const note = await client.scheduling.sessionNotes.get(sessionId, 'adime');
19191
+ * console.log(note?.attributes?.value?.content);
19192
+ *
19193
+ * // Write/update a SOAP note
19194
+ * await client.scheduling.sessionNotes.upsert(sessionId, 'soap', {
19195
+ * content: 'S: Patient reports...',
19196
+ * reviewed_by_user_id: currentUserId,
19197
+ * reviewed_at: new Date().toISOString(),
19198
+ * });
19199
+ * ```
19200
+ */
19201
+ sessionNotes: {
19202
+ /**
19203
+ * Get the current version of a session note.
19204
+ *
19205
+ * Returns `null` if no note of this type exists for the event yet.
19206
+ *
19207
+ * @param eventId - The UUID of the scheduling event (session).
19208
+ * @param noteType - The note type: `"adime"`, `"soap"`, `"goals"`, or `"email"`.
19209
+ * @param workspaceId - The workspace UUID. Required for application-scoped API keys.
19210
+ * @param options - Optional request options.
19211
+ * @returns The `DataStoreRecord`, or `null` if not found.
19212
+ */
19213
+ get: async (eventId, noteType, workspaceId, options) => {
19214
+ const results = await rb.execute(
19215
+ getDataStoreRecordsByNamespace,
19216
+ {
19217
+ query: {
19218
+ workspace_id: workspaceId,
19219
+ namespace: "sessions",
19220
+ "filter[record_key]": `${eventId}:${noteType}`
19221
+ }
19222
+ },
19223
+ options
19224
+ );
19225
+ return results.length > 0 ? results[0] ?? null : null;
19226
+ },
19227
+ /**
19228
+ * Create or update a session note (auto-versions on update).
19229
+ *
19230
+ * If the note does not exist, it is created. If it exists, its value
19231
+ * is replaced and the version counter is incremented.
19232
+ *
19233
+ * @param eventId - The UUID of the scheduling event (session).
19234
+ * @param noteType - The note type: `"adime"`, `"soap"`, `"goals"`, or `"email"`.
19235
+ * @param workspaceId - The workspace UUID. Required for application-scoped API keys.
19236
+ * @param value - The note content and optional metadata.
19237
+ * @param options - Optional request options.
19238
+ * @returns The upserted `DataStoreRecord`.
19239
+ */
19240
+ upsert: async (eventId, noteType, workspaceId, value, options) => {
19241
+ return rb.execute(
19242
+ postDataStoreRecordsUpsert,
19243
+ {
19244
+ body: {
19245
+ data: {
19246
+ type: "data_store_record",
19247
+ attributes: {
19248
+ namespace: "sessions",
19249
+ record_key: `${eventId}:${noteType}`,
19250
+ workspace_id: workspaceId,
19251
+ value
19252
+ }
19253
+ }
19254
+ }
19255
+ },
19256
+ options
19257
+ );
19258
+ }
18662
19259
  }
18663
19260
  };
18664
19261
  }
@@ -22529,6 +23126,7 @@ var Webhooks = class _Webhooks {
22529
23126
  AuthenticationError,
22530
23127
  AuthorizationError,
22531
23128
  BrowserApiKeyError,
23129
+ CardDeclinedError,
22532
23130
  ConflictError,
22533
23131
  DEFAULT_API_VERSION,
22534
23132
  DEFAULT_RETRY_CONFIG,
@@ -22538,12 +23136,14 @@ var Webhooks = class _Webhooks {
22538
23136
  LOG_LEVELS,
22539
23137
  NetworkError,
22540
23138
  NotFoundError,
23139
+ PaymentRequiredError,
22541
23140
  RateLimitError,
22542
23141
  RequestBuilder,
22543
23142
  RetryTimeoutError,
22544
23143
  SDK_VERSION,
22545
23144
  SdkEventEmitter,
22546
23145
  ServerError,
23146
+ SubscriptionConflictError,
22547
23147
  TimeoutError,
22548
23148
  ValidationError,
22549
23149
  WebhookSignatureError,