@gpt-platform/client 0.4.1 → 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 +8093 -7217
- package/dist/index.d.ts +8093 -7217
- package/dist/index.js +879 -95
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +876 -95
- package/dist/index.mjs.map +1 -1
- package/llms.txt +25 -0
- package/package.json +1 -1
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
|
-
|
|
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
|
|
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.
|
|
1336
|
+
var SDK_VERSION = "0.4.3";
|
|
1289
1337
|
var DEFAULT_API_VERSION = "2026-02-27";
|
|
1290
1338
|
|
|
1291
1339
|
// src/base-client.ts
|
|
@@ -1751,6 +1799,15 @@ var postEmailOutboundEmails = (options) => (options.client ?? client).post({
|
|
|
1751
1799
|
...options.headers
|
|
1752
1800
|
}
|
|
1753
1801
|
});
|
|
1802
|
+
var patchWalletCredits = (options) => (options.client ?? client).patch({
|
|
1803
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1804
|
+
url: "/wallet/credits",
|
|
1805
|
+
...options,
|
|
1806
|
+
headers: {
|
|
1807
|
+
"Content-Type": "application/vnd.api+json",
|
|
1808
|
+
...options.headers
|
|
1809
|
+
}
|
|
1810
|
+
});
|
|
1754
1811
|
var getCrmCustomEntitiesWorkspaceByWorkspaceId = (options) => (options.client ?? client).get({
|
|
1755
1812
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1756
1813
|
url: "/crm/custom-entities/workspace/{workspace_id}",
|
|
@@ -1789,6 +1846,11 @@ var patchApiKeysByIdRotate = (options) => (options.client ?? client).patch({
|
|
|
1789
1846
|
...options.headers
|
|
1790
1847
|
}
|
|
1791
1848
|
});
|
|
1849
|
+
var getApplicationsCurrent = (options) => (options.client ?? client).get({
|
|
1850
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1851
|
+
url: "/applications/current",
|
|
1852
|
+
...options
|
|
1853
|
+
});
|
|
1792
1854
|
var patchWorkspaceMembershipsByWorkspaceIdByUserIdProfile = (options) => (options.client ?? client).patch({
|
|
1793
1855
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1794
1856
|
url: "/workspace-memberships/{workspace_id}/{user_id}/profile",
|
|
@@ -1798,6 +1860,15 @@ var patchWorkspaceMembershipsByWorkspaceIdByUserIdProfile = (options) => (option
|
|
|
1798
1860
|
...options.headers
|
|
1799
1861
|
}
|
|
1800
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
|
+
});
|
|
1801
1872
|
var getWorkspaces = (options) => (options.client ?? client).get({
|
|
1802
1873
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1803
1874
|
url: "/workspaces",
|
|
@@ -1836,6 +1907,11 @@ var getAgentsByIdStats = (options) => (options.client ?? client).get({
|
|
|
1836
1907
|
url: "/agents/{id}/stats",
|
|
1837
1908
|
...options
|
|
1838
1909
|
});
|
|
1910
|
+
var getSchedulingEventsByParticipant = (options) => (options.client ?? client).get({
|
|
1911
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1912
|
+
url: "/scheduling/events/by_participant",
|
|
1913
|
+
...options
|
|
1914
|
+
});
|
|
1839
1915
|
var getEmailTrackingEventsById = (options) => (options.client ?? client).get({
|
|
1840
1916
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1841
1917
|
url: "/email/tracking-events/{id}",
|
|
@@ -1889,15 +1965,6 @@ var patchCrmDealsById = (options) => (options.client ?? client).patch({
|
|
|
1889
1965
|
...options.headers
|
|
1890
1966
|
}
|
|
1891
1967
|
});
|
|
1892
|
-
var postUsersAuthResetPasswordRequest = (options) => (options.client ?? client).post({
|
|
1893
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1894
|
-
url: "/users/auth/reset-password/request",
|
|
1895
|
-
...options,
|
|
1896
|
-
headers: {
|
|
1897
|
-
"Content-Type": "application/vnd.api+json",
|
|
1898
|
-
...options.headers
|
|
1899
|
-
}
|
|
1900
|
-
});
|
|
1901
1968
|
var getSupportTagsWorkspaceByWorkspaceId = (options) => (options.client ?? client).get({
|
|
1902
1969
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1903
1970
|
url: "/support/tags/workspace/{workspace_id}",
|
|
@@ -2029,6 +2096,11 @@ var getAgentsByIdTrainingExamples = (options) => (options.client ?? client).get(
|
|
|
2029
2096
|
url: "/agents/{id}/training-examples",
|
|
2030
2097
|
...options
|
|
2031
2098
|
});
|
|
2099
|
+
var getInvitationsConsumeByToken = (options) => (options.client ?? client).get({
|
|
2100
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2101
|
+
url: "/invitations/consume/{token}",
|
|
2102
|
+
...options
|
|
2103
|
+
});
|
|
2032
2104
|
var postEmailMarketingCampaignsByIdOptimizeSendTimes = (options) => (options.client ?? client).post({
|
|
2033
2105
|
security: [{ scheme: "bearer", type: "http" }],
|
|
2034
2106
|
url: "/email-marketing/campaigns/{id}/optimize-send-times",
|
|
@@ -2095,6 +2167,15 @@ var patchRetentionPoliciesById = (options) => (options.client ?? client).patch({
|
|
|
2095
2167
|
...options.headers
|
|
2096
2168
|
}
|
|
2097
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
|
+
});
|
|
2098
2179
|
var getCatalogTaxonomiesApplicationByApplicationId = (options) => (options.client ?? client).get({
|
|
2099
2180
|
security: [{ scheme: "bearer", type: "http" }],
|
|
2100
2181
|
url: "/catalog/taxonomies/application/{application_id}",
|
|
@@ -2233,6 +2314,15 @@ var postAgentsByIdRestoreVersion = (options) => (options.client ?? client).post(
|
|
|
2233
2314
|
...options.headers
|
|
2234
2315
|
}
|
|
2235
2316
|
});
|
|
2317
|
+
var patchWalletAutoTopUp = (options) => (options.client ?? client).patch({
|
|
2318
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2319
|
+
url: "/wallet/auto-top-up",
|
|
2320
|
+
...options,
|
|
2321
|
+
headers: {
|
|
2322
|
+
"Content-Type": "application/vnd.api+json",
|
|
2323
|
+
...options.headers
|
|
2324
|
+
}
|
|
2325
|
+
});
|
|
2236
2326
|
var postTokens = (options) => (options.client ?? client).post({
|
|
2237
2327
|
security: [{ scheme: "bearer", type: "http" }],
|
|
2238
2328
|
url: "/tokens",
|
|
@@ -2391,6 +2481,15 @@ var getEmailMarketingUnsubscribersWorkspaceByWorkspaceId = (options) => (options
|
|
|
2391
2481
|
url: "/email-marketing/unsubscribers/workspace/{workspace_id}",
|
|
2392
2482
|
...options
|
|
2393
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
|
+
});
|
|
2394
2493
|
var getSearchSaved = (options) => (options.client ?? client).get({
|
|
2395
2494
|
security: [{ scheme: "bearer", type: "http" }],
|
|
2396
2495
|
url: "/search/saved",
|
|
@@ -2636,6 +2735,15 @@ var postSupportTickets = (options) => (options.client ?? client).post({
|
|
|
2636
2735
|
...options.headers
|
|
2637
2736
|
}
|
|
2638
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
|
+
});
|
|
2639
2747
|
var getCreditPackagesById = (options) => (options.client ?? client).get({
|
|
2640
2748
|
security: [{ scheme: "bearer", type: "http" }],
|
|
2641
2749
|
url: "/credit-packages/{id}",
|
|
@@ -2829,6 +2937,20 @@ var getSchedulingBookingsById = (options) => (options.client ?? client).get({
|
|
|
2829
2937
|
url: "/scheduling/bookings/{id}",
|
|
2830
2938
|
...options
|
|
2831
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
|
+
});
|
|
2832
2954
|
var getWebhookDeliveriesById = (options) => (options.client ?? client).get({
|
|
2833
2955
|
security: [{ scheme: "bearer", type: "http" }],
|
|
2834
2956
|
url: "/webhook-deliveries/{id}",
|
|
@@ -3431,11 +3553,21 @@ var getEmailTrackingEventsWorkspaceByWorkspaceId = (options) => (options.client
|
|
|
3431
3553
|
url: "/email/tracking-events/workspace/{workspace_id}",
|
|
3432
3554
|
...options
|
|
3433
3555
|
});
|
|
3556
|
+
var getTenants = (options) => (options.client ?? client).get({
|
|
3557
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
3558
|
+
url: "/tenants",
|
|
3559
|
+
...options
|
|
3560
|
+
});
|
|
3434
3561
|
var getExtractionSchemaDiscoveriesById = (options) => (options.client ?? client).get({
|
|
3435
3562
|
security: [{ scheme: "bearer", type: "http" }],
|
|
3436
3563
|
url: "/extraction/schema-discoveries/{id}",
|
|
3437
3564
|
...options
|
|
3438
3565
|
});
|
|
3566
|
+
var getWalletInvoices = (options) => (options.client ?? client).get({
|
|
3567
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
3568
|
+
url: "/wallet/invoices",
|
|
3569
|
+
...options
|
|
3570
|
+
});
|
|
3439
3571
|
var getFieldTemplates = (options) => (options.client ?? client).get({
|
|
3440
3572
|
security: [{ scheme: "bearer", type: "http" }],
|
|
3441
3573
|
url: "/field-templates",
|
|
@@ -3521,6 +3653,15 @@ var postDocumentsPresignedUpload = (options) => (options.client ?? client).post(
|
|
|
3521
3653
|
...options.headers
|
|
3522
3654
|
}
|
|
3523
3655
|
});
|
|
3656
|
+
var postPaymentMethodsTokenize = (options) => (options.client ?? client).post({
|
|
3657
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
3658
|
+
url: "/payment-methods/tokenize",
|
|
3659
|
+
...options,
|
|
3660
|
+
headers: {
|
|
3661
|
+
"Content-Type": "application/vnd.api+json",
|
|
3662
|
+
...options.headers
|
|
3663
|
+
}
|
|
3664
|
+
});
|
|
3524
3665
|
var getCrmContactsWorkspaceByWorkspaceIdArchived = (options) => (options.client ?? client).get({
|
|
3525
3666
|
security: [{ scheme: "bearer", type: "http" }],
|
|
3526
3667
|
url: "/crm/contacts/workspace/{workspace_id}/archived",
|
|
@@ -3826,6 +3967,15 @@ var getApplicationsById = (options) => (options.client ?? client).get({
|
|
|
3826
3967
|
url: "/applications/{id}",
|
|
3827
3968
|
...options
|
|
3828
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
|
+
});
|
|
3829
3979
|
var patchEmailOutboundEmailsByIdSchedule = (options) => (options.client ?? client).patch({
|
|
3830
3980
|
security: [{ scheme: "bearer", type: "http" }],
|
|
3831
3981
|
url: "/email/outbound-emails/{id}/schedule",
|
|
@@ -3890,6 +4040,15 @@ var postSearchSavedByIdRun = (options) => (options.client ?? client).post({
|
|
|
3890
4040
|
...options.headers
|
|
3891
4041
|
}
|
|
3892
4042
|
});
|
|
4043
|
+
var patchWalletPlan = (options) => (options.client ?? client).patch({
|
|
4044
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
4045
|
+
url: "/wallet/plan",
|
|
4046
|
+
...options,
|
|
4047
|
+
headers: {
|
|
4048
|
+
"Content-Type": "application/vnd.api+json",
|
|
4049
|
+
...options.headers
|
|
4050
|
+
}
|
|
4051
|
+
});
|
|
3893
4052
|
var deleteCatalogProductsById = (options) => (options.client ?? client).delete({
|
|
3894
4053
|
security: [{ scheme: "bearer", type: "http" }],
|
|
3895
4054
|
url: "/catalog/products/{id}",
|
|
@@ -4291,15 +4450,6 @@ var getExtractionDocumentsWorkspaceByWorkspaceId = (options) => (options.client
|
|
|
4291
4450
|
url: "/extraction/documents/workspace/{workspace_id}",
|
|
4292
4451
|
...options
|
|
4293
4452
|
});
|
|
4294
|
-
var patchApplicationsByIdAllocateCredits = (options) => (options.client ?? client).patch({
|
|
4295
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
4296
|
-
url: "/applications/{id}/allocate-credits",
|
|
4297
|
-
...options,
|
|
4298
|
-
headers: {
|
|
4299
|
-
"Content-Type": "application/vnd.api+json",
|
|
4300
|
-
...options.headers
|
|
4301
|
-
}
|
|
4302
|
-
});
|
|
4303
4453
|
var postUsersAuthMagicLinkRequest = (options) => (options.client ?? client).post({
|
|
4304
4454
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4305
4455
|
url: "/users/auth/magic-link/request",
|
|
@@ -4398,6 +4548,25 @@ var getExtractionDocuments = (options) => (options.client ?? client).get({
|
|
|
4398
4548
|
url: "/extraction/documents",
|
|
4399
4549
|
...options
|
|
4400
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
|
+
});
|
|
4401
4570
|
var getCrmDealsWorkspaceByWorkspaceId = (options) => (options.client ?? client).get({
|
|
4402
4571
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4403
4572
|
url: "/crm/deals/workspace/{workspace_id}",
|
|
@@ -4500,6 +4669,11 @@ var postSupportTags = (options) => (options.client ?? client).post({
|
|
|
4500
4669
|
...options.headers
|
|
4501
4670
|
}
|
|
4502
4671
|
});
|
|
4672
|
+
var getWalletPlanPreview = (options) => (options.client ?? client).get({
|
|
4673
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
4674
|
+
url: "/wallet/plan/preview",
|
|
4675
|
+
...options
|
|
4676
|
+
});
|
|
4503
4677
|
var postAgentVersionsByIdSetSystemFields = (options) => (options.client ?? client).post({
|
|
4504
4678
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4505
4679
|
url: "/agent-versions/{id}/set-system-fields",
|
|
@@ -4857,6 +5031,11 @@ var deleteWorkspaceMembershipsByWorkspaceIdByUserId = (options) => (options.clie
|
|
|
4857
5031
|
url: "/workspace-memberships/{workspace_id}/{user_id}",
|
|
4858
5032
|
...options
|
|
4859
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
|
+
});
|
|
4860
5039
|
var patchWorkspaceMembershipsByWorkspaceIdByUserId = (options) => (options.client ?? client).patch({
|
|
4861
5040
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4862
5041
|
url: "/workspace-memberships/{workspace_id}/{user_id}",
|
|
@@ -4909,6 +5088,15 @@ var getUsers = (options) => (options.client ?? client).get({
|
|
|
4909
5088
|
url: "/users",
|
|
4910
5089
|
...options
|
|
4911
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
|
+
});
|
|
4912
5100
|
var deleteSupportTicketsById = (options) => (options.client ?? client).delete({
|
|
4913
5101
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4914
5102
|
url: "/support/tickets/{id}",
|
|
@@ -7195,22 +7383,169 @@ function createBillingNamespace(rb) {
|
|
|
7195
7383
|
/**
|
|
7196
7384
|
* Retrieves the current workspace wallet, including the available credit
|
|
7197
7385
|
* balance, usage totals, and any pending charges.
|
|
7386
|
+
*/
|
|
7387
|
+
get: async (options) => {
|
|
7388
|
+
return rb.execute(getWallet, {}, options);
|
|
7389
|
+
},
|
|
7390
|
+
/**
|
|
7391
|
+
* Preview the cost and effective date of a plan change before committing.
|
|
7198
7392
|
*
|
|
7199
|
-
* @param
|
|
7200
|
-
*
|
|
7201
|
-
*
|
|
7202
|
-
*
|
|
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.
|
|
7397
|
+
*/
|
|
7398
|
+
previewPlanChange: async (planSlug, options) => {
|
|
7399
|
+
return rb.execute(
|
|
7400
|
+
getWalletPlanPreview,
|
|
7401
|
+
{ query: { plan_slug: planSlug } },
|
|
7402
|
+
options
|
|
7403
|
+
);
|
|
7404
|
+
},
|
|
7405
|
+
/**
|
|
7406
|
+
* Change the workspace's subscription plan.
|
|
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
|
+
*
|
|
7412
|
+
* Upgrades charge a prorated amount immediately against the default payment
|
|
7413
|
+
* method. Downgrades are deferred to the end of the current billing period.
|
|
7414
|
+
* Use `previewPlanChange` first to show the user a cost estimate.
|
|
7203
7415
|
*
|
|
7204
7416
|
* @example
|
|
7205
7417
|
* ```typescript
|
|
7206
|
-
*
|
|
7418
|
+
* // Simple form — no wallet ID needed
|
|
7419
|
+
* await client.billing.wallet.changePlan("pro-monthly");
|
|
7207
7420
|
*
|
|
7208
|
-
*
|
|
7209
|
-
*
|
|
7421
|
+
* // Explicit form — when walletId is already known
|
|
7422
|
+
* await client.billing.wallet.changePlan(wallet.id, "pro-monthly");
|
|
7210
7423
|
* ```
|
|
7211
7424
|
*/
|
|
7212
|
-
|
|
7213
|
-
|
|
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
|
+
}
|
|
7443
|
+
return rb.execute(
|
|
7444
|
+
patchWalletPlan,
|
|
7445
|
+
{
|
|
7446
|
+
body: {
|
|
7447
|
+
data: {
|
|
7448
|
+
id: walletId,
|
|
7449
|
+
type: "wallet",
|
|
7450
|
+
attributes: { plan_slug: planSlug }
|
|
7451
|
+
}
|
|
7452
|
+
}
|
|
7453
|
+
},
|
|
7454
|
+
reqOptions
|
|
7455
|
+
);
|
|
7456
|
+
},
|
|
7457
|
+
/**
|
|
7458
|
+
* Purchase a credit package to top up the workspace wallet immediately.
|
|
7459
|
+
*
|
|
7460
|
+
* Charges the specified (or default) payment method. Credits are added to
|
|
7461
|
+
* the `purchased` bucket and never expire.
|
|
7462
|
+
*
|
|
7463
|
+
* @param walletId - The wallet UUID from `wallet.get()`.
|
|
7464
|
+
* @param packageSlug - The slug of the credit package to purchase.
|
|
7465
|
+
* @param paymentMethodId - Optional payment method UUID. Uses the default if omitted.
|
|
7466
|
+
*/
|
|
7467
|
+
buyCredits: async (walletId, packageSlug, paymentMethodId, options) => {
|
|
7468
|
+
const attributes = {
|
|
7469
|
+
package_slug: packageSlug
|
|
7470
|
+
};
|
|
7471
|
+
if (paymentMethodId !== void 0) {
|
|
7472
|
+
attributes.payment_method_id = paymentMethodId;
|
|
7473
|
+
}
|
|
7474
|
+
return rb.execute(
|
|
7475
|
+
patchWalletCredits,
|
|
7476
|
+
{ body: { data: { id: walletId, type: "wallet", attributes } } },
|
|
7477
|
+
options
|
|
7478
|
+
);
|
|
7479
|
+
},
|
|
7480
|
+
/**
|
|
7481
|
+
* Update the workspace's auto top-up settings.
|
|
7482
|
+
*
|
|
7483
|
+
* When enabled, the platform automatically purchases the specified credit
|
|
7484
|
+
* package whenever the balance drops below `threshold`.
|
|
7485
|
+
*
|
|
7486
|
+
* @param walletId - The wallet UUID from `wallet.get()`.
|
|
7487
|
+
* @param opts.enabled - Enable or disable auto top-up.
|
|
7488
|
+
* @param opts.threshold - Credit balance floor that triggers a purchase.
|
|
7489
|
+
* @param opts.amount - Credits to purchase per top-up event.
|
|
7490
|
+
* @param opts.packageId - Credit package UUID to auto-purchase.
|
|
7491
|
+
*/
|
|
7492
|
+
updateAutoTopUp: async (walletId, opts, options) => {
|
|
7493
|
+
const attributes = { enabled: opts.enabled };
|
|
7494
|
+
if (opts.threshold !== void 0) attributes.threshold = opts.threshold;
|
|
7495
|
+
if (opts.amount !== void 0) attributes.amount = opts.amount;
|
|
7496
|
+
if (opts.packageId !== void 0)
|
|
7497
|
+
attributes.package_id = opts.packageId;
|
|
7498
|
+
return rb.execute(
|
|
7499
|
+
patchWalletAutoTopUp,
|
|
7500
|
+
{ body: { data: { id: walletId, type: "wallet", attributes } } },
|
|
7501
|
+
options
|
|
7502
|
+
);
|
|
7503
|
+
},
|
|
7504
|
+
/**
|
|
7505
|
+
* Sub-namespace for invoice operations.
|
|
7506
|
+
*
|
|
7507
|
+
* Invoices are generated per billing period and carry a `pdf_url` for
|
|
7508
|
+
* receipt download. Use `invoices.list()` for the transaction history page.
|
|
7509
|
+
*/
|
|
7510
|
+
invoices: {
|
|
7511
|
+
/**
|
|
7512
|
+
* Returns a single page of invoices for the current workspace.
|
|
7513
|
+
*
|
|
7514
|
+
* Each invoice includes `pdf_url` for receipt download.
|
|
7515
|
+
*
|
|
7516
|
+
* @example
|
|
7517
|
+
* ```typescript
|
|
7518
|
+
* const invoices = await client.billing.wallet.invoices.list();
|
|
7519
|
+
* const paidInvoices = invoices.filter(inv => inv.attributes?.status === "paid");
|
|
7520
|
+
* ```
|
|
7521
|
+
*/
|
|
7522
|
+
list: async (options) => {
|
|
7523
|
+
return rb.execute(
|
|
7524
|
+
getWalletInvoices,
|
|
7525
|
+
buildPageQuery(options?.page, options?.pageSize),
|
|
7526
|
+
options
|
|
7527
|
+
);
|
|
7528
|
+
},
|
|
7529
|
+
/**
|
|
7530
|
+
* Fetches all invoices by automatically paginating through every page.
|
|
7531
|
+
*
|
|
7532
|
+
* @example
|
|
7533
|
+
* ```typescript
|
|
7534
|
+
* const all = await client.billing.wallet.invoices.listAll();
|
|
7535
|
+
* const downloadUrl = all[0].attributes?.pdf_url;
|
|
7536
|
+
* ```
|
|
7537
|
+
*/
|
|
7538
|
+
listAll: async (options) => {
|
|
7539
|
+
return paginateToArray(
|
|
7540
|
+
rb.createPaginatedFetcher(
|
|
7541
|
+
getWalletInvoices,
|
|
7542
|
+
(page, pageSize) => ({
|
|
7543
|
+
query: { page: { number: page, size: pageSize } }
|
|
7544
|
+
}),
|
|
7545
|
+
options
|
|
7546
|
+
)
|
|
7547
|
+
);
|
|
7548
|
+
}
|
|
7214
7549
|
}
|
|
7215
7550
|
},
|
|
7216
7551
|
/**
|
|
@@ -7585,8 +7920,12 @@ function createBillingNamespace(rb) {
|
|
|
7585
7920
|
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
7586
7921
|
*
|
|
7587
7922
|
* const method = await client.billing.paymentMethods.create({
|
|
7588
|
-
*
|
|
7589
|
-
*
|
|
7923
|
+
* provider_token: 'tok_visa_4242',
|
|
7924
|
+
* type: 'card',
|
|
7925
|
+
* last4: '4242',
|
|
7926
|
+
* exp_month: 12,
|
|
7927
|
+
* exp_year: 2027,
|
|
7928
|
+
* brand: 'Visa',
|
|
7590
7929
|
* });
|
|
7591
7930
|
* console.log(`Added card ending in ${method.last4}`);
|
|
7592
7931
|
* ```
|
|
@@ -7598,6 +7937,34 @@ function createBillingNamespace(rb) {
|
|
|
7598
7937
|
options
|
|
7599
7938
|
);
|
|
7600
7939
|
},
|
|
7940
|
+
/**
|
|
7941
|
+
* Tokenizes a raw card server-side and saves the resulting payment method.
|
|
7942
|
+
*
|
|
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.
|
|
7952
|
+
*
|
|
7953
|
+
* The platform forwards `cardDetails` to the payment gateway over TLS and stores
|
|
7954
|
+
* only the resulting token — raw card data is never persisted.
|
|
7955
|
+
*
|
|
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.
|
|
7958
|
+
*/
|
|
7959
|
+
tokenize: async (cardDetails, options) => {
|
|
7960
|
+
return rb.execute(
|
|
7961
|
+
postPaymentMethodsTokenize,
|
|
7962
|
+
{
|
|
7963
|
+
body: { data: { type: "payment_method", attributes: cardDetails } }
|
|
7964
|
+
},
|
|
7965
|
+
options
|
|
7966
|
+
);
|
|
7967
|
+
},
|
|
7601
7968
|
/**
|
|
7602
7969
|
* Updates the mutable attributes of an existing payment method, such as
|
|
7603
7970
|
* the billing name or expiry date override.
|
|
@@ -16021,8 +16388,12 @@ function createIdentityNamespace(rb, baseUrl) {
|
|
|
16021
16388
|
);
|
|
16022
16389
|
},
|
|
16023
16390
|
/** Resend confirmation email to an unconfirmed user */
|
|
16024
|
-
resendConfirmation: async (options) => {
|
|
16025
|
-
return rb.execute(
|
|
16391
|
+
resendConfirmation: async (email, options) => {
|
|
16392
|
+
return rb.execute(
|
|
16393
|
+
postUsersAuthResendConfirmation,
|
|
16394
|
+
{ body: { data: { type: "user", attributes: { email } } } },
|
|
16395
|
+
options
|
|
16396
|
+
);
|
|
16026
16397
|
},
|
|
16027
16398
|
/** Confirm an email address using the token from the confirmation email */
|
|
16028
16399
|
confirmEmail: async (email, confirmationToken, options) => {
|
|
@@ -16063,7 +16434,7 @@ function createIdentityNamespace(rb, baseUrl) {
|
|
|
16063
16434
|
requestPasswordReset: async (email, options) => {
|
|
16064
16435
|
RequestPasswordResetSchema.parse({ email });
|
|
16065
16436
|
return rb.execute(
|
|
16066
|
-
|
|
16437
|
+
patchUsersAuthResetPassword,
|
|
16067
16438
|
{
|
|
16068
16439
|
body: {
|
|
16069
16440
|
data: { type: "user", attributes: { email } }
|
|
@@ -16941,7 +17312,7 @@ function createPlatformNamespace(rb) {
|
|
|
16941
17312
|
*/
|
|
16942
17313
|
update: async (id, attributes, options) => {
|
|
16943
17314
|
return rb.execute(
|
|
16944
|
-
|
|
17315
|
+
patchApplicationsById,
|
|
16945
17316
|
{
|
|
16946
17317
|
path: { id },
|
|
16947
17318
|
body: { data: { id, type: "application", attributes } }
|
|
@@ -16988,7 +17359,7 @@ function createPlatformNamespace(rb) {
|
|
|
16988
17359
|
* ```
|
|
16989
17360
|
*/
|
|
16990
17361
|
readCurrent: async (options) => {
|
|
16991
|
-
return rb.execute(
|
|
17362
|
+
return rb.execute(getApplicationsCurrent, {}, options);
|
|
16992
17363
|
}
|
|
16993
17364
|
},
|
|
16994
17365
|
/**
|
|
@@ -17000,45 +17371,65 @@ function createPlatformNamespace(rb) {
|
|
|
17000
17371
|
*/
|
|
17001
17372
|
tenants: {
|
|
17002
17373
|
/**
|
|
17003
|
-
* List
|
|
17374
|
+
* List all tenants (paginated).
|
|
17004
17375
|
*
|
|
17005
|
-
* Returns
|
|
17006
|
-
* dashboards and usage monitoring at the ISV level.
|
|
17376
|
+
* Returns tenants accessible to the current actor (application-scoped).
|
|
17007
17377
|
*
|
|
17008
17378
|
* @param options - Optional page number, page size, and request options.
|
|
17009
|
-
* @returns A page of
|
|
17010
|
-
|
|
17011
|
-
|
|
17012
|
-
|
|
17013
|
-
|
|
17014
|
-
|
|
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
|
+
},
|
|
17388
|
+
/**
|
|
17389
|
+
* List document statistics for tenants (paginated).
|
|
17390
|
+
*
|
|
17391
|
+
* Returns per-tenant document usage metrics, useful for billing
|
|
17392
|
+
* dashboards and usage monitoring at the ISV level.
|
|
17393
|
+
*
|
|
17394
|
+
* @param options - Optional page number, page size, and request options.
|
|
17395
|
+
* @returns A page of tenant document stat records (typed as `Tenant[]`).
|
|
17396
|
+
*
|
|
17397
|
+
* @example
|
|
17398
|
+
* ```typescript
|
|
17399
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
17400
|
+
* const stats = await client.platform.tenants.listDocumentStats();
|
|
17015
17401
|
* stats.forEach(s => console.log(s.attributes?.document_count));
|
|
17016
17402
|
* ```
|
|
17017
17403
|
*/
|
|
17018
|
-
listDocumentStats: async (options) => {
|
|
17404
|
+
listDocumentStats: async (tenantId, options) => {
|
|
17019
17405
|
return rb.execute(
|
|
17020
17406
|
getTenantsByTenantIdDocumentStats,
|
|
17021
|
-
|
|
17407
|
+
{
|
|
17408
|
+
path: { tenant_id: tenantId },
|
|
17409
|
+
...buildPageQuery(options?.page, options?.pageSize)
|
|
17410
|
+
},
|
|
17022
17411
|
options
|
|
17023
17412
|
);
|
|
17024
17413
|
},
|
|
17025
17414
|
/**
|
|
17026
17415
|
* List all document statistics for tenants, auto-paginating.
|
|
17027
17416
|
*
|
|
17417
|
+
* @param tenantId - The UUID of the tenant.
|
|
17028
17418
|
* @param options - Optional request options.
|
|
17029
17419
|
* @returns All tenant document stat records as a flat array.
|
|
17030
17420
|
*
|
|
17031
17421
|
* @example
|
|
17032
17422
|
* ```typescript
|
|
17033
17423
|
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
17034
|
-
* const allStats = await client.platform.tenants.listAllDocumentStats();
|
|
17424
|
+
* const allStats = await client.platform.tenants.listAllDocumentStats('tenant_abc123');
|
|
17035
17425
|
* ```
|
|
17036
17426
|
*/
|
|
17037
|
-
listAllDocumentStats: async (options) => {
|
|
17427
|
+
listAllDocumentStats: async (tenantId, options) => {
|
|
17038
17428
|
return paginateToArray(
|
|
17039
17429
|
rb.createPaginatedFetcher(
|
|
17040
17430
|
getTenantsByTenantIdDocumentStats,
|
|
17041
17431
|
(page, pageSize) => ({
|
|
17432
|
+
path: { tenant_id: tenantId },
|
|
17042
17433
|
query: { page: { number: page, size: pageSize } }
|
|
17043
17434
|
}),
|
|
17044
17435
|
options
|
|
@@ -17063,10 +17454,15 @@ function createPlatformNamespace(rb) {
|
|
|
17063
17454
|
* console.log(tenant.attributes?.credit_balance);
|
|
17064
17455
|
* ```
|
|
17065
17456
|
*/
|
|
17066
|
-
credit: async (id, options) => {
|
|
17457
|
+
credit: async (id, amount, description, options) => {
|
|
17458
|
+
const attributes = { amount };
|
|
17459
|
+
if (description !== void 0) attributes.description = description;
|
|
17067
17460
|
return rb.execute(
|
|
17068
17461
|
postTenantsByIdCredit,
|
|
17069
|
-
{
|
|
17462
|
+
{
|
|
17463
|
+
path: { id },
|
|
17464
|
+
body: { data: { type: "tenant", attributes } }
|
|
17465
|
+
},
|
|
17070
17466
|
options
|
|
17071
17467
|
);
|
|
17072
17468
|
},
|
|
@@ -17174,24 +17570,6 @@ function createPlatformNamespace(rb) {
|
|
|
17174
17570
|
);
|
|
17175
17571
|
},
|
|
17176
17572
|
/**
|
|
17177
|
-
* Add a payment method to a tenant via raw details (server-to-server proxy).
|
|
17178
|
-
*
|
|
17179
|
-
* Proxies payment method registration to the underlying payment provider
|
|
17180
|
-
* on behalf of the tenant. Used in server-side flows where the payment
|
|
17181
|
-
* form is embedded by the ISV rather than the platform.
|
|
17182
|
-
*
|
|
17183
|
-
* @param options - Optional request options.
|
|
17184
|
-
* @returns The updated `Tenant` with new payment method reference.
|
|
17185
|
-
*
|
|
17186
|
-
* @example
|
|
17187
|
-
* ```typescript
|
|
17188
|
-
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
17189
|
-
* const tenant = await client.platform.tenants.addPaymentMethod();
|
|
17190
|
-
* ```
|
|
17191
|
-
*/
|
|
17192
|
-
addPaymentMethod: async (options) => {
|
|
17193
|
-
return rb.execute(postTenantsIsv, {}, options);
|
|
17194
|
-
},
|
|
17195
17573
|
/**
|
|
17196
17574
|
* Retrieve a single tenant by its ID.
|
|
17197
17575
|
*
|
|
@@ -17208,6 +17586,33 @@ function createPlatformNamespace(rb) {
|
|
|
17208
17586
|
*/
|
|
17209
17587
|
get: async (id, options) => {
|
|
17210
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
|
+
);
|
|
17211
17616
|
}
|
|
17212
17617
|
},
|
|
17213
17618
|
/**
|
|
@@ -17215,22 +17620,63 @@ function createPlatformNamespace(rb) {
|
|
|
17215
17620
|
*/
|
|
17216
17621
|
invitations: {
|
|
17217
17622
|
/**
|
|
17218
|
-
*
|
|
17623
|
+
* Accept a pending invitation (authenticated user flow).
|
|
17219
17624
|
*
|
|
17220
|
-
*
|
|
17221
|
-
*
|
|
17625
|
+
* Accepts an invitation the current user received, creating
|
|
17626
|
+
* the appropriate membership records.
|
|
17222
17627
|
*
|
|
17628
|
+
* @param id - The UUID of the invitation to accept.
|
|
17223
17629
|
* @param options - Optional request options.
|
|
17224
|
-
* @returns
|
|
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.
|
|
17225
17644
|
*
|
|
17226
|
-
*
|
|
17227
|
-
*
|
|
17228
|
-
*
|
|
17229
|
-
*
|
|
17230
|
-
*
|
|
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`.
|
|
17231
17650
|
*/
|
|
17232
|
-
|
|
17233
|
-
return rb.
|
|
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
|
+
);
|
|
17234
17680
|
},
|
|
17235
17681
|
/**
|
|
17236
17682
|
* List pending invitations for the currently authenticated user (paginated).
|
|
@@ -17309,31 +17755,119 @@ function createPlatformNamespace(rb) {
|
|
|
17309
17755
|
);
|
|
17310
17756
|
},
|
|
17311
17757
|
/**
|
|
17312
|
-
|
|
17758
|
+
/**
|
|
17759
|
+
* Resend an invitation email with a refreshed token and new 7-day expiry.
|
|
17313
17760
|
*
|
|
17314
|
-
*
|
|
17315
|
-
*
|
|
17316
|
-
*
|
|
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.
|
|
17317
17764
|
*
|
|
17318
|
-
* @param id - The UUID of the invitation to
|
|
17319
|
-
* @param attributes - Attribute map, typically `{ status: "declined" }`.
|
|
17765
|
+
* @param id - The UUID of the invitation to resend.
|
|
17320
17766
|
* @param options - Optional request options.
|
|
17321
17767
|
* @returns The updated `Invitation`.
|
|
17322
17768
|
*
|
|
17323
17769
|
* @example
|
|
17324
17770
|
* ```typescript
|
|
17325
17771
|
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
17326
|
-
*
|
|
17327
|
-
* status: 'declined',
|
|
17328
|
-
* });
|
|
17772
|
+
* await client.platform.invitations.resend('inv_abc123');
|
|
17329
17773
|
* ```
|
|
17330
17774
|
*/
|
|
17331
|
-
|
|
17775
|
+
resend: async (id, applicationId, options) => {
|
|
17332
17776
|
return rb.execute(
|
|
17333
|
-
|
|
17777
|
+
patchInvitationsByIdResend,
|
|
17334
17778
|
{
|
|
17335
17779
|
path: { id },
|
|
17336
|
-
body: {
|
|
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
|
+
}
|
|
17337
17871
|
},
|
|
17338
17872
|
options
|
|
17339
17873
|
);
|
|
@@ -17376,6 +17910,42 @@ function createPlatformNamespace(rb) {
|
|
|
17376
17910
|
options
|
|
17377
17911
|
);
|
|
17378
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
|
+
},
|
|
17379
17949
|
/**
|
|
17380
17950
|
* Retrieve the membership record for a specific user within a workspace.
|
|
17381
17951
|
*
|
|
@@ -17395,8 +17965,9 @@ function createPlatformNamespace(rb) {
|
|
|
17395
17965
|
* ```
|
|
17396
17966
|
*/
|
|
17397
17967
|
get: async (workspaceId, memberId, options) => {
|
|
17398
|
-
return rb.
|
|
17399
|
-
|
|
17968
|
+
return rb.execute(
|
|
17969
|
+
getWorkspaceMembershipsByWorkspaceIdByUserId,
|
|
17970
|
+
{ path: { workspace_id: workspaceId, user_id: memberId } },
|
|
17400
17971
|
options
|
|
17401
17972
|
);
|
|
17402
17973
|
},
|
|
@@ -17627,6 +18198,95 @@ function createPlatformNamespace(rb) {
|
|
|
17627
18198
|
options
|
|
17628
18199
|
);
|
|
17629
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
|
+
}
|
|
17630
18290
|
}
|
|
17631
18291
|
};
|
|
17632
18292
|
}
|
|
@@ -17915,6 +18575,42 @@ function createSchedulingNamespace(rb) {
|
|
|
17915
18575
|
},
|
|
17916
18576
|
options
|
|
17917
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
|
+
);
|
|
17918
18614
|
}
|
|
17919
18615
|
},
|
|
17920
18616
|
/**
|
|
@@ -18475,6 +19171,91 @@ function createSchedulingNamespace(rb) {
|
|
|
18475
19171
|
options
|
|
18476
19172
|
);
|
|
18477
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
|
+
}
|
|
18478
19259
|
}
|
|
18479
19260
|
};
|
|
18480
19261
|
}
|
|
@@ -22345,6 +23126,7 @@ var Webhooks = class _Webhooks {
|
|
|
22345
23126
|
AuthenticationError,
|
|
22346
23127
|
AuthorizationError,
|
|
22347
23128
|
BrowserApiKeyError,
|
|
23129
|
+
CardDeclinedError,
|
|
22348
23130
|
ConflictError,
|
|
22349
23131
|
DEFAULT_API_VERSION,
|
|
22350
23132
|
DEFAULT_RETRY_CONFIG,
|
|
@@ -22354,12 +23136,14 @@ var Webhooks = class _Webhooks {
|
|
|
22354
23136
|
LOG_LEVELS,
|
|
22355
23137
|
NetworkError,
|
|
22356
23138
|
NotFoundError,
|
|
23139
|
+
PaymentRequiredError,
|
|
22357
23140
|
RateLimitError,
|
|
22358
23141
|
RequestBuilder,
|
|
22359
23142
|
RetryTimeoutError,
|
|
22360
23143
|
SDK_VERSION,
|
|
22361
23144
|
SdkEventEmitter,
|
|
22362
23145
|
ServerError,
|
|
23146
|
+
SubscriptionConflictError,
|
|
22363
23147
|
TimeoutError,
|
|
22364
23148
|
ValidationError,
|
|
22365
23149
|
WebhookSignatureError,
|