@zyphr-dev/node-sdk 0.1.37 → 0.1.39
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/README.md +39 -0
- package/dist/index.cjs +762 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +720 -59
- package/dist/index.d.ts +720 -59
- package/dist/index.js +726 -47
- package/dist/index.js.map +1 -1
- package/package.json +8 -3
- package/src/.openapi-generator/FILES +7 -0
- package/src/clientAuth.ts +182 -0
- package/src/errors.ts +29 -16
- package/src/index.ts +4 -1
- package/src/src/apis/AuthOAuthApi.ts +27 -24
- package/src/src/apis/AuthRegistrationApi.ts +134 -4
- package/src/src/apis/AuthUserDirectoryApi.ts +596 -0
- package/src/src/apis/AuthUserProfileApi.ts +0 -62
- package/src/src/apis/index.ts +1 -0
- package/src/src/models/InviteEndUserRequest.ts +110 -0
- package/src/src/models/OAuthProviderName.ts +56 -0
- package/src/src/models/SetEndUserClaimsRequest.ts +65 -0
- package/src/src/models/SignInAnonymouslyRequest.ts +16 -0
- package/src/src/models/SignInWithGameCenterRequest.ts +111 -0
- package/src/src/models/SignInWithGooglePlayGamesRequest.ts +66 -0
- package/src/src/models/UpdateEndUserByApplicationRequest.ts +97 -0
- package/src/src/models/index.ts +6 -0
package/dist/index.cjs
CHANGED
|
@@ -163,6 +163,7 @@ __export(index_exports, {
|
|
|
163
163
|
AuthTokensFromJSONTyped: () => AuthTokensFromJSONTyped,
|
|
164
164
|
AuthTokensToJSON: () => AuthTokensToJSON,
|
|
165
165
|
AuthTokensToJSONTyped: () => AuthTokensToJSONTyped,
|
|
166
|
+
AuthUserDirectoryApi: () => AuthUserDirectoryApi,
|
|
166
167
|
AuthUserFromJSON: () => AuthUserFromJSON,
|
|
167
168
|
AuthUserFromJSONTyped: () => AuthUserFromJSONTyped,
|
|
168
169
|
AuthUserProfileApi: () => AuthUserProfileApi,
|
|
@@ -577,10 +578,16 @@ __export(index_exports, {
|
|
|
577
578
|
InboxNotificationResponseFromJSONTyped: () => InboxNotificationResponseFromJSONTyped,
|
|
578
579
|
InboxNotificationResponseToJSON: () => InboxNotificationResponseToJSON,
|
|
579
580
|
InboxNotificationResponseToJSONTyped: () => InboxNotificationResponseToJSONTyped,
|
|
581
|
+
InviteEndUserRequestFromJSON: () => InviteEndUserRequestFromJSON,
|
|
582
|
+
InviteEndUserRequestFromJSONTyped: () => InviteEndUserRequestFromJSONTyped,
|
|
583
|
+
InviteEndUserRequestSendLinkEnum: () => InviteEndUserRequestSendLinkEnum,
|
|
584
|
+
InviteEndUserRequestToJSON: () => InviteEndUserRequestToJSON,
|
|
585
|
+
InviteEndUserRequestToJSONTyped: () => InviteEndUserRequestToJSONTyped,
|
|
580
586
|
JSONApiResponse: () => JSONApiResponse,
|
|
581
587
|
ListAllInboxStatusEnum: () => ListAllInboxStatusEnum,
|
|
582
588
|
ListDevicesPlatformEnum: () => ListDevicesPlatformEnum,
|
|
583
589
|
ListEmailsStatusEnum: () => ListEmailsStatusEnum,
|
|
590
|
+
ListEndUsersEnvironmentEnum: () => ListEndUsersEnvironmentEnum,
|
|
584
591
|
ListInboundEmailsStatusEnum: () => ListInboundEmailsStatusEnum,
|
|
585
592
|
ListPushStatusEnum: () => ListPushStatusEnum,
|
|
586
593
|
ListSlackMessagesStatusEnum: () => ListSlackMessagesStatusEnum,
|
|
@@ -767,6 +774,11 @@ __export(index_exports, {
|
|
|
767
774
|
OAuthProviderInfoFromJSONTyped: () => OAuthProviderInfoFromJSONTyped,
|
|
768
775
|
OAuthProviderInfoToJSON: () => OAuthProviderInfoToJSON,
|
|
769
776
|
OAuthProviderInfoToJSONTyped: () => OAuthProviderInfoToJSONTyped,
|
|
777
|
+
OAuthProviderName: () => OAuthProviderName,
|
|
778
|
+
OAuthProviderNameFromJSON: () => OAuthProviderNameFromJSON,
|
|
779
|
+
OAuthProviderNameFromJSONTyped: () => OAuthProviderNameFromJSONTyped,
|
|
780
|
+
OAuthProviderNameToJSON: () => OAuthProviderNameToJSON,
|
|
781
|
+
OAuthProviderNameToJSONTyped: () => OAuthProviderNameToJSONTyped,
|
|
770
782
|
OAuthProviderToJSON: () => OAuthProviderToJSON,
|
|
771
783
|
OAuthProviderToJSONTyped: () => OAuthProviderToJSONTyped,
|
|
772
784
|
OAuthProvidersResponseDataFromJSON: () => OAuthProvidersResponseDataFromJSON,
|
|
@@ -1196,6 +1208,10 @@ __export(index_exports, {
|
|
|
1196
1208
|
SetDomainInboundRequestFromJSONTyped: () => SetDomainInboundRequestFromJSONTyped,
|
|
1197
1209
|
SetDomainInboundRequestToJSON: () => SetDomainInboundRequestToJSON,
|
|
1198
1210
|
SetDomainInboundRequestToJSONTyped: () => SetDomainInboundRequestToJSONTyped,
|
|
1211
|
+
SetEndUserClaimsRequestFromJSON: () => SetEndUserClaimsRequestFromJSON,
|
|
1212
|
+
SetEndUserClaimsRequestFromJSONTyped: () => SetEndUserClaimsRequestFromJSONTyped,
|
|
1213
|
+
SetEndUserClaimsRequestToJSON: () => SetEndUserClaimsRequestToJSON,
|
|
1214
|
+
SetEndUserClaimsRequestToJSONTyped: () => SetEndUserClaimsRequestToJSONTyped,
|
|
1199
1215
|
SetPreferencesRequestFromJSON: () => SetPreferencesRequestFromJSON,
|
|
1200
1216
|
SetPreferencesRequestFromJSONTyped: () => SetPreferencesRequestFromJSONTyped,
|
|
1201
1217
|
SetPreferencesRequestPreferencesInnerFromJSON: () => SetPreferencesRequestPreferencesInnerFromJSON,
|
|
@@ -1208,6 +1224,14 @@ __export(index_exports, {
|
|
|
1208
1224
|
SignInAnonymouslyRequestFromJSONTyped: () => SignInAnonymouslyRequestFromJSONTyped,
|
|
1209
1225
|
SignInAnonymouslyRequestToJSON: () => SignInAnonymouslyRequestToJSON,
|
|
1210
1226
|
SignInAnonymouslyRequestToJSONTyped: () => SignInAnonymouslyRequestToJSONTyped,
|
|
1227
|
+
SignInWithGameCenterRequestFromJSON: () => SignInWithGameCenterRequestFromJSON,
|
|
1228
|
+
SignInWithGameCenterRequestFromJSONTyped: () => SignInWithGameCenterRequestFromJSONTyped,
|
|
1229
|
+
SignInWithGameCenterRequestToJSON: () => SignInWithGameCenterRequestToJSON,
|
|
1230
|
+
SignInWithGameCenterRequestToJSONTyped: () => SignInWithGameCenterRequestToJSONTyped,
|
|
1231
|
+
SignInWithGooglePlayGamesRequestFromJSON: () => SignInWithGooglePlayGamesRequestFromJSON,
|
|
1232
|
+
SignInWithGooglePlayGamesRequestFromJSONTyped: () => SignInWithGooglePlayGamesRequestFromJSONTyped,
|
|
1233
|
+
SignInWithGooglePlayGamesRequestToJSON: () => SignInWithGooglePlayGamesRequestToJSON,
|
|
1234
|
+
SignInWithGooglePlayGamesRequestToJSONTyped: () => SignInWithGooglePlayGamesRequestToJSONTyped,
|
|
1211
1235
|
SlackApi: () => SlackApi,
|
|
1212
1236
|
SlackMessageFromJSON: () => SlackMessageFromJSON,
|
|
1213
1237
|
SlackMessageFromJSONTyped: () => SlackMessageFromJSONTyped,
|
|
@@ -1441,6 +1465,10 @@ __export(index_exports, {
|
|
|
1441
1465
|
UpdateCategoryRequestFromJSONTyped: () => UpdateCategoryRequestFromJSONTyped,
|
|
1442
1466
|
UpdateCategoryRequestToJSON: () => UpdateCategoryRequestToJSON,
|
|
1443
1467
|
UpdateCategoryRequestToJSONTyped: () => UpdateCategoryRequestToJSONTyped,
|
|
1468
|
+
UpdateEndUserByApplicationRequestFromJSON: () => UpdateEndUserByApplicationRequestFromJSON,
|
|
1469
|
+
UpdateEndUserByApplicationRequestFromJSONTyped: () => UpdateEndUserByApplicationRequestFromJSONTyped,
|
|
1470
|
+
UpdateEndUserByApplicationRequestToJSON: () => UpdateEndUserByApplicationRequestToJSON,
|
|
1471
|
+
UpdateEndUserByApplicationRequestToJSONTyped: () => UpdateEndUserByApplicationRequestToJSONTyped,
|
|
1444
1472
|
UpdateEndUserRequestFromJSON: () => UpdateEndUserRequestFromJSON,
|
|
1445
1473
|
UpdateEndUserRequestFromJSONTyped: () => UpdateEndUserRequestFromJSONTyped,
|
|
1446
1474
|
UpdateEndUserRequestToJSON: () => UpdateEndUserRequestToJSON,
|
|
@@ -1858,6 +1886,8 @@ __export(index_exports, {
|
|
|
1858
1886
|
WorkflowStepExecutionToJSONTyped: () => WorkflowStepExecutionToJSONTyped,
|
|
1859
1887
|
Zyphr: () => Zyphr,
|
|
1860
1888
|
ZyphrAuthenticationError: () => ZyphrAuthenticationError,
|
|
1889
|
+
ZyphrClient: () => ZyphrClient,
|
|
1890
|
+
ZyphrClientCredentialError: () => ZyphrClientCredentialError,
|
|
1861
1891
|
ZyphrError: () => ZyphrError,
|
|
1862
1892
|
ZyphrNotFoundError: () => ZyphrNotFoundError,
|
|
1863
1893
|
ZyphrPayloadTooLargeError: () => ZyphrPayloadTooLargeError,
|
|
@@ -1992,6 +2022,7 @@ __export(index_exports, {
|
|
|
1992
2022
|
instanceOfInboxListMeta: () => instanceOfInboxListMeta,
|
|
1993
2023
|
instanceOfInboxListResponse: () => instanceOfInboxListResponse,
|
|
1994
2024
|
instanceOfInboxNotificationResponse: () => instanceOfInboxNotificationResponse,
|
|
2025
|
+
instanceOfInviteEndUserRequest: () => instanceOfInviteEndUserRequest,
|
|
1995
2026
|
instanceOfListWaaSApplications200Response: () => instanceOfListWaaSApplications200Response,
|
|
1996
2027
|
instanceOfListWaaSEndpointDeliveries200Response: () => instanceOfListWaaSEndpointDeliveries200Response,
|
|
1997
2028
|
instanceOfListWaaSEndpoints200Response: () => instanceOfListWaaSEndpoints200Response,
|
|
@@ -2036,6 +2067,7 @@ __export(index_exports, {
|
|
|
2036
2067
|
instanceOfOAuthConnectionsResponseData: () => instanceOfOAuthConnectionsResponseData,
|
|
2037
2068
|
instanceOfOAuthProvider: () => instanceOfOAuthProvider,
|
|
2038
2069
|
instanceOfOAuthProviderInfo: () => instanceOfOAuthProviderInfo,
|
|
2070
|
+
instanceOfOAuthProviderName: () => instanceOfOAuthProviderName,
|
|
2039
2071
|
instanceOfOAuthProvidersResponse: () => instanceOfOAuthProvidersResponse,
|
|
2040
2072
|
instanceOfOAuthProvidersResponseData: () => instanceOfOAuthProvidersResponseData,
|
|
2041
2073
|
instanceOfOAuthTokensRefreshResponse: () => instanceOfOAuthTokensRefreshResponse,
|
|
@@ -2139,9 +2171,12 @@ __export(index_exports, {
|
|
|
2139
2171
|
instanceOfSessionListResponseData: () => instanceOfSessionListResponseData,
|
|
2140
2172
|
instanceOfSessionListResponseDataSessionInfo: () => instanceOfSessionListResponseDataSessionInfo,
|
|
2141
2173
|
instanceOfSetDomainInboundRequest: () => instanceOfSetDomainInboundRequest,
|
|
2174
|
+
instanceOfSetEndUserClaimsRequest: () => instanceOfSetEndUserClaimsRequest,
|
|
2142
2175
|
instanceOfSetPreferencesRequest: () => instanceOfSetPreferencesRequest,
|
|
2143
2176
|
instanceOfSetPreferencesRequestPreferencesInner: () => instanceOfSetPreferencesRequestPreferencesInner,
|
|
2144
2177
|
instanceOfSignInAnonymouslyRequest: () => instanceOfSignInAnonymouslyRequest,
|
|
2178
|
+
instanceOfSignInWithGameCenterRequest: () => instanceOfSignInWithGameCenterRequest,
|
|
2179
|
+
instanceOfSignInWithGooglePlayGamesRequest: () => instanceOfSignInWithGooglePlayGamesRequest,
|
|
2145
2180
|
instanceOfSlackMessage: () => instanceOfSlackMessage,
|
|
2146
2181
|
instanceOfSlackMessageListResponse: () => instanceOfSlackMessageListResponse,
|
|
2147
2182
|
instanceOfSlackMessageListResponseMeta: () => instanceOfSlackMessageListResponseMeta,
|
|
@@ -2197,6 +2232,7 @@ __export(index_exports, {
|
|
|
2197
2232
|
instanceOfUnsubscribeRequest: () => instanceOfUnsubscribeRequest,
|
|
2198
2233
|
instanceOfUnsubscribeResponse: () => instanceOfUnsubscribeResponse,
|
|
2199
2234
|
instanceOfUpdateCategoryRequest: () => instanceOfUpdateCategoryRequest,
|
|
2235
|
+
instanceOfUpdateEndUserByApplicationRequest: () => instanceOfUpdateEndUserByApplicationRequest,
|
|
2200
2236
|
instanceOfUpdateEndUserRequest: () => instanceOfUpdateEndUserRequest,
|
|
2201
2237
|
instanceOfUpdateOrganizationMemberRoleRequest: () => instanceOfUpdateOrganizationMemberRoleRequest,
|
|
2202
2238
|
instanceOfUpdateOrganizationRequest: () => instanceOfUpdateOrganizationRequest,
|
|
@@ -7393,6 +7429,47 @@ function InboxNotificationResponseToJSONTyped(value, ignoreDiscriminator = false
|
|
|
7393
7429
|
};
|
|
7394
7430
|
}
|
|
7395
7431
|
|
|
7432
|
+
// src/src/models/InviteEndUserRequest.ts
|
|
7433
|
+
var InviteEndUserRequestSendLinkEnum = {
|
|
7434
|
+
MAGIC: "magic",
|
|
7435
|
+
PASSWORD_RESET: "password_reset",
|
|
7436
|
+
NONE: "none"
|
|
7437
|
+
};
|
|
7438
|
+
function instanceOfInviteEndUserRequest(value) {
|
|
7439
|
+
if (!("email" in value) || value["email"] === void 0) return false;
|
|
7440
|
+
return true;
|
|
7441
|
+
}
|
|
7442
|
+
function InviteEndUserRequestFromJSON(json) {
|
|
7443
|
+
return InviteEndUserRequestFromJSONTyped(json, false);
|
|
7444
|
+
}
|
|
7445
|
+
function InviteEndUserRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
7446
|
+
if (json == null) {
|
|
7447
|
+
return json;
|
|
7448
|
+
}
|
|
7449
|
+
return {
|
|
7450
|
+
"email": json["email"],
|
|
7451
|
+
"name": json["name"] == null ? void 0 : json["name"],
|
|
7452
|
+
"metadata": json["metadata"] == null ? void 0 : json["metadata"],
|
|
7453
|
+
"sendLink": json["send_link"] == null ? void 0 : json["send_link"],
|
|
7454
|
+
"redirectUrl": json["redirect_url"] == null ? void 0 : json["redirect_url"]
|
|
7455
|
+
};
|
|
7456
|
+
}
|
|
7457
|
+
function InviteEndUserRequestToJSON(json) {
|
|
7458
|
+
return InviteEndUserRequestToJSONTyped(json, false);
|
|
7459
|
+
}
|
|
7460
|
+
function InviteEndUserRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
7461
|
+
if (value == null) {
|
|
7462
|
+
return value;
|
|
7463
|
+
}
|
|
7464
|
+
return {
|
|
7465
|
+
"email": value["email"],
|
|
7466
|
+
"name": value["name"],
|
|
7467
|
+
"metadata": value["metadata"],
|
|
7468
|
+
"send_link": value["sendLink"],
|
|
7469
|
+
"redirect_url": value["redirectUrl"]
|
|
7470
|
+
};
|
|
7471
|
+
}
|
|
7472
|
+
|
|
7396
7473
|
// src/src/models/ListWaaSApplications200Response.ts
|
|
7397
7474
|
function instanceOfListWaaSApplications200Response(value) {
|
|
7398
7475
|
return true;
|
|
@@ -8772,6 +8849,37 @@ function OAuthProviderToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
8772
8849
|
};
|
|
8773
8850
|
}
|
|
8774
8851
|
|
|
8852
|
+
// src/src/models/OAuthProviderName.ts
|
|
8853
|
+
var OAuthProviderName = {
|
|
8854
|
+
GOOGLE: "google",
|
|
8855
|
+
APPLE: "apple",
|
|
8856
|
+
FACEBOOK: "facebook",
|
|
8857
|
+
GITHUB: "github",
|
|
8858
|
+
MICROSOFT: "microsoft"
|
|
8859
|
+
};
|
|
8860
|
+
function instanceOfOAuthProviderName(value) {
|
|
8861
|
+
for (const key in OAuthProviderName) {
|
|
8862
|
+
if (Object.prototype.hasOwnProperty.call(OAuthProviderName, key)) {
|
|
8863
|
+
if (OAuthProviderName[key] === value) {
|
|
8864
|
+
return true;
|
|
8865
|
+
}
|
|
8866
|
+
}
|
|
8867
|
+
}
|
|
8868
|
+
return false;
|
|
8869
|
+
}
|
|
8870
|
+
function OAuthProviderNameFromJSON(json) {
|
|
8871
|
+
return OAuthProviderNameFromJSONTyped(json, false);
|
|
8872
|
+
}
|
|
8873
|
+
function OAuthProviderNameFromJSONTyped(json, ignoreDiscriminator) {
|
|
8874
|
+
return json;
|
|
8875
|
+
}
|
|
8876
|
+
function OAuthProviderNameToJSON(value) {
|
|
8877
|
+
return value;
|
|
8878
|
+
}
|
|
8879
|
+
function OAuthProviderNameToJSONTyped(value, ignoreDiscriminator) {
|
|
8880
|
+
return value;
|
|
8881
|
+
}
|
|
8882
|
+
|
|
8775
8883
|
// src/src/models/OAuthProvidersResponseData.ts
|
|
8776
8884
|
function instanceOfOAuthProvidersResponseData(value) {
|
|
8777
8885
|
return true;
|
|
@@ -12355,6 +12463,33 @@ function SetDomainInboundRequestToJSONTyped(value, ignoreDiscriminator = false)
|
|
|
12355
12463
|
};
|
|
12356
12464
|
}
|
|
12357
12465
|
|
|
12466
|
+
// src/src/models/SetEndUserClaimsRequest.ts
|
|
12467
|
+
function instanceOfSetEndUserClaimsRequest(value) {
|
|
12468
|
+
return true;
|
|
12469
|
+
}
|
|
12470
|
+
function SetEndUserClaimsRequestFromJSON(json) {
|
|
12471
|
+
return SetEndUserClaimsRequestFromJSONTyped(json, false);
|
|
12472
|
+
}
|
|
12473
|
+
function SetEndUserClaimsRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
12474
|
+
if (json == null) {
|
|
12475
|
+
return json;
|
|
12476
|
+
}
|
|
12477
|
+
return {
|
|
12478
|
+
"claims": json["claims"] == null ? void 0 : json["claims"]
|
|
12479
|
+
};
|
|
12480
|
+
}
|
|
12481
|
+
function SetEndUserClaimsRequestToJSON(json) {
|
|
12482
|
+
return SetEndUserClaimsRequestToJSONTyped(json, false);
|
|
12483
|
+
}
|
|
12484
|
+
function SetEndUserClaimsRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
12485
|
+
if (value == null) {
|
|
12486
|
+
return value;
|
|
12487
|
+
}
|
|
12488
|
+
return {
|
|
12489
|
+
"claims": value["claims"]
|
|
12490
|
+
};
|
|
12491
|
+
}
|
|
12492
|
+
|
|
12358
12493
|
// src/src/models/SetPreferencesRequestPreferencesInner.ts
|
|
12359
12494
|
function instanceOfSetPreferencesRequestPreferencesInner(value) {
|
|
12360
12495
|
return true;
|
|
@@ -12429,7 +12564,9 @@ function SignInAnonymouslyRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
12429
12564
|
return {
|
|
12430
12565
|
"deviceId": json["device_id"],
|
|
12431
12566
|
"name": json["name"] == null ? void 0 : json["name"],
|
|
12432
|
-
"metadata": json["metadata"] == null ? void 0 : json["metadata"]
|
|
12567
|
+
"metadata": json["metadata"] == null ? void 0 : json["metadata"],
|
|
12568
|
+
"organizationId": json["organization_id"] == null ? void 0 : json["organization_id"],
|
|
12569
|
+
"organizationRole": json["organization_role"] == null ? void 0 : json["organization_role"]
|
|
12433
12570
|
};
|
|
12434
12571
|
}
|
|
12435
12572
|
function SignInAnonymouslyRequestToJSON(json) {
|
|
@@ -12442,7 +12579,80 @@ function SignInAnonymouslyRequestToJSONTyped(value, ignoreDiscriminator = false)
|
|
|
12442
12579
|
return {
|
|
12443
12580
|
"device_id": value["deviceId"],
|
|
12444
12581
|
"name": value["name"],
|
|
12445
|
-
"metadata": value["metadata"]
|
|
12582
|
+
"metadata": value["metadata"],
|
|
12583
|
+
"organization_id": value["organizationId"],
|
|
12584
|
+
"organization_role": value["organizationRole"]
|
|
12585
|
+
};
|
|
12586
|
+
}
|
|
12587
|
+
|
|
12588
|
+
// src/src/models/SignInWithGameCenterRequest.ts
|
|
12589
|
+
function instanceOfSignInWithGameCenterRequest(value) {
|
|
12590
|
+
if (!("playerId" in value) || value["playerId"] === void 0) return false;
|
|
12591
|
+
if (!("publicKeyUrl" in value) || value["publicKeyUrl"] === void 0) return false;
|
|
12592
|
+
if (!("signature" in value) || value["signature"] === void 0) return false;
|
|
12593
|
+
if (!("salt" in value) || value["salt"] === void 0) return false;
|
|
12594
|
+
if (!("timestamp" in value) || value["timestamp"] === void 0) return false;
|
|
12595
|
+
if (!("bundleId" in value) || value["bundleId"] === void 0) return false;
|
|
12596
|
+
return true;
|
|
12597
|
+
}
|
|
12598
|
+
function SignInWithGameCenterRequestFromJSON(json) {
|
|
12599
|
+
return SignInWithGameCenterRequestFromJSONTyped(json, false);
|
|
12600
|
+
}
|
|
12601
|
+
function SignInWithGameCenterRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
12602
|
+
if (json == null) {
|
|
12603
|
+
return json;
|
|
12604
|
+
}
|
|
12605
|
+
return {
|
|
12606
|
+
"playerId": json["playerId"],
|
|
12607
|
+
"publicKeyUrl": json["publicKeyUrl"],
|
|
12608
|
+
"signature": json["signature"],
|
|
12609
|
+
"salt": json["salt"],
|
|
12610
|
+
"timestamp": json["timestamp"],
|
|
12611
|
+
"bundleId": json["bundleId"]
|
|
12612
|
+
};
|
|
12613
|
+
}
|
|
12614
|
+
function SignInWithGameCenterRequestToJSON(json) {
|
|
12615
|
+
return SignInWithGameCenterRequestToJSONTyped(json, false);
|
|
12616
|
+
}
|
|
12617
|
+
function SignInWithGameCenterRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
12618
|
+
if (value == null) {
|
|
12619
|
+
return value;
|
|
12620
|
+
}
|
|
12621
|
+
return {
|
|
12622
|
+
"playerId": value["playerId"],
|
|
12623
|
+
"publicKeyUrl": value["publicKeyUrl"],
|
|
12624
|
+
"signature": value["signature"],
|
|
12625
|
+
"salt": value["salt"],
|
|
12626
|
+
"timestamp": value["timestamp"],
|
|
12627
|
+
"bundleId": value["bundleId"]
|
|
12628
|
+
};
|
|
12629
|
+
}
|
|
12630
|
+
|
|
12631
|
+
// src/src/models/SignInWithGooglePlayGamesRequest.ts
|
|
12632
|
+
function instanceOfSignInWithGooglePlayGamesRequest(value) {
|
|
12633
|
+
if (!("serverAuthCode" in value) || value["serverAuthCode"] === void 0) return false;
|
|
12634
|
+
return true;
|
|
12635
|
+
}
|
|
12636
|
+
function SignInWithGooglePlayGamesRequestFromJSON(json) {
|
|
12637
|
+
return SignInWithGooglePlayGamesRequestFromJSONTyped(json, false);
|
|
12638
|
+
}
|
|
12639
|
+
function SignInWithGooglePlayGamesRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
12640
|
+
if (json == null) {
|
|
12641
|
+
return json;
|
|
12642
|
+
}
|
|
12643
|
+
return {
|
|
12644
|
+
"serverAuthCode": json["serverAuthCode"]
|
|
12645
|
+
};
|
|
12646
|
+
}
|
|
12647
|
+
function SignInWithGooglePlayGamesRequestToJSON(json) {
|
|
12648
|
+
return SignInWithGooglePlayGamesRequestToJSONTyped(json, false);
|
|
12649
|
+
}
|
|
12650
|
+
function SignInWithGooglePlayGamesRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
12651
|
+
if (value == null) {
|
|
12652
|
+
return value;
|
|
12653
|
+
}
|
|
12654
|
+
return {
|
|
12655
|
+
"serverAuthCode": value["serverAuthCode"]
|
|
12446
12656
|
};
|
|
12447
12657
|
}
|
|
12448
12658
|
|
|
@@ -14101,6 +14311,41 @@ function UpdateCategoryRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
14101
14311
|
};
|
|
14102
14312
|
}
|
|
14103
14313
|
|
|
14314
|
+
// src/src/models/UpdateEndUserByApplicationRequest.ts
|
|
14315
|
+
function instanceOfUpdateEndUserByApplicationRequest(value) {
|
|
14316
|
+
return true;
|
|
14317
|
+
}
|
|
14318
|
+
function UpdateEndUserByApplicationRequestFromJSON(json) {
|
|
14319
|
+
return UpdateEndUserByApplicationRequestFromJSONTyped(json, false);
|
|
14320
|
+
}
|
|
14321
|
+
function UpdateEndUserByApplicationRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
14322
|
+
if (json == null) {
|
|
14323
|
+
return json;
|
|
14324
|
+
}
|
|
14325
|
+
return {
|
|
14326
|
+
"email": json["email"] == null ? void 0 : json["email"],
|
|
14327
|
+
"name": json["name"] == null ? void 0 : json["name"],
|
|
14328
|
+
"avatarUrl": json["avatar_url"] == null ? void 0 : json["avatar_url"],
|
|
14329
|
+
"metadata": json["metadata"] == null ? void 0 : json["metadata"],
|
|
14330
|
+
"status": json["status"] == null ? void 0 : json["status"]
|
|
14331
|
+
};
|
|
14332
|
+
}
|
|
14333
|
+
function UpdateEndUserByApplicationRequestToJSON(json) {
|
|
14334
|
+
return UpdateEndUserByApplicationRequestToJSONTyped(json, false);
|
|
14335
|
+
}
|
|
14336
|
+
function UpdateEndUserByApplicationRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
14337
|
+
if (value == null) {
|
|
14338
|
+
return value;
|
|
14339
|
+
}
|
|
14340
|
+
return {
|
|
14341
|
+
"email": value["email"],
|
|
14342
|
+
"name": value["name"],
|
|
14343
|
+
"avatar_url": value["avatarUrl"],
|
|
14344
|
+
"metadata": value["metadata"],
|
|
14345
|
+
"status": value["status"]
|
|
14346
|
+
};
|
|
14347
|
+
}
|
|
14348
|
+
|
|
14104
14349
|
// src/src/models/UpdateEndUserRequest.ts
|
|
14105
14350
|
function instanceOfUpdateEndUserRequest(value) {
|
|
14106
14351
|
return true;
|
|
@@ -18986,7 +19231,7 @@ var AuthRegistrationApi = class extends BaseAPI {
|
|
|
18986
19231
|
return await response.value();
|
|
18987
19232
|
}
|
|
18988
19233
|
/**
|
|
18989
|
-
* Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert.
|
|
19234
|
+
* Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert. Pass an optional `organization_id` to create the anonymous user directly in an organization; the returned access token then carries `org_id` (and `orgs`), matching the org-scoped register/login flow.
|
|
18990
19235
|
* Sign in anonymously
|
|
18991
19236
|
*/
|
|
18992
19237
|
async signInAnonymouslyRaw(requestParameters, initOverrides) {
|
|
@@ -19012,13 +19257,81 @@ var AuthRegistrationApi = class extends BaseAPI {
|
|
|
19012
19257
|
return new JSONApiResponse(response, (jsonValue) => AuthResultResponseFromJSON(jsonValue));
|
|
19013
19258
|
}
|
|
19014
19259
|
/**
|
|
19015
|
-
* Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert.
|
|
19260
|
+
* Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert. Pass an optional `organization_id` to create the anonymous user directly in an organization; the returned access token then carries `org_id` (and `orgs`), matching the org-scoped register/login flow.
|
|
19016
19261
|
* Sign in anonymously
|
|
19017
19262
|
*/
|
|
19018
19263
|
async signInAnonymously(signInAnonymouslyRequest, initOverrides) {
|
|
19019
19264
|
const response = await this.signInAnonymouslyRaw({ signInAnonymouslyRequest }, initOverrides);
|
|
19020
19265
|
return await response.value();
|
|
19021
19266
|
}
|
|
19267
|
+
/**
|
|
19268
|
+
* Exchange an Apple Game Center identity-verification assertion for a Zyphr end-user session. Zyphr independently re-verifies the assertion server-side (Apple certificate chain, RSA-SHA256 signature, timestamp freshness, single-use replay guard, and bundle-id binding) before provisioning-or-looking-up the user and minting tokens. The user is keyed on the modern scoped `playerId` (gamePlayerID). ## Producing the assertion (Integration) The assertion is produced **on-device by the iOS app** — there is no server-side way to mint it. The app calls GameKit\'s `GKLocalPlayer.fetchItems(forIdentityVerificationSignature:)`, which returns `publicKeyURL`, `signature`, `salt`, and `timestamp`; combine those with the local player\'s `gamePlayerID` and the app\'s bundle identifier and submit them here. Two integration shapes are supported: - **client-direct** — the iOS app holds the Zyphr application public key and calls this endpoint itself. - **backend-relayed** — the app forwards the fetched assertion fields to the customer\'s own backend, which relays them to this endpoint; the app never holds Zyphr keys. (This is the common shape for games.) On any verification failure the response is a single opaque `401` `invalid_assertion` — the specific control that failed is never disclosed.
|
|
19269
|
+
* Sign in with Apple Game Center
|
|
19270
|
+
*/
|
|
19271
|
+
async signInWithGameCenterRaw(requestParameters, initOverrides) {
|
|
19272
|
+
if (requestParameters["signInWithGameCenterRequest"] == null) {
|
|
19273
|
+
throw new RequiredError(
|
|
19274
|
+
"signInWithGameCenterRequest",
|
|
19275
|
+
'Required parameter "signInWithGameCenterRequest" was null or undefined when calling signInWithGameCenter().'
|
|
19276
|
+
);
|
|
19277
|
+
}
|
|
19278
|
+
const queryParameters = {};
|
|
19279
|
+
const headerParameters = {};
|
|
19280
|
+
headerParameters["Content-Type"] = "application/json";
|
|
19281
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
19282
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
|
|
19283
|
+
}
|
|
19284
|
+
const response = await this.request({
|
|
19285
|
+
path: `/auth/game-center`,
|
|
19286
|
+
method: "POST",
|
|
19287
|
+
headers: headerParameters,
|
|
19288
|
+
query: queryParameters,
|
|
19289
|
+
body: SignInWithGameCenterRequestToJSON(requestParameters["signInWithGameCenterRequest"])
|
|
19290
|
+
}, initOverrides);
|
|
19291
|
+
return new JSONApiResponse(response, (jsonValue) => AuthResultResponseFromJSON(jsonValue));
|
|
19292
|
+
}
|
|
19293
|
+
/**
|
|
19294
|
+
* Exchange an Apple Game Center identity-verification assertion for a Zyphr end-user session. Zyphr independently re-verifies the assertion server-side (Apple certificate chain, RSA-SHA256 signature, timestamp freshness, single-use replay guard, and bundle-id binding) before provisioning-or-looking-up the user and minting tokens. The user is keyed on the modern scoped `playerId` (gamePlayerID). ## Producing the assertion (Integration) The assertion is produced **on-device by the iOS app** — there is no server-side way to mint it. The app calls GameKit\'s `GKLocalPlayer.fetchItems(forIdentityVerificationSignature:)`, which returns `publicKeyURL`, `signature`, `salt`, and `timestamp`; combine those with the local player\'s `gamePlayerID` and the app\'s bundle identifier and submit them here. Two integration shapes are supported: - **client-direct** — the iOS app holds the Zyphr application public key and calls this endpoint itself. - **backend-relayed** — the app forwards the fetched assertion fields to the customer\'s own backend, which relays them to this endpoint; the app never holds Zyphr keys. (This is the common shape for games.) On any verification failure the response is a single opaque `401` `invalid_assertion` — the specific control that failed is never disclosed.
|
|
19295
|
+
* Sign in with Apple Game Center
|
|
19296
|
+
*/
|
|
19297
|
+
async signInWithGameCenter(signInWithGameCenterRequest, initOverrides) {
|
|
19298
|
+
const response = await this.signInWithGameCenterRaw({ signInWithGameCenterRequest }, initOverrides);
|
|
19299
|
+
return await response.value();
|
|
19300
|
+
}
|
|
19301
|
+
/**
|
|
19302
|
+
* Exchange a Google Play Games Services (GPGS) **server auth code** for a Zyphr end-user session. Unlike Game Center (which submits an Apple-signed assertion), GPGS is verified by Google: Zyphr exchanges the single-use server auth code at Google\'s OAuth2 token endpoint, then calls the Play Games REST API (`players/me`) server-side to obtain the trusted, tamper-proof `playerId`. The user is provisioned-or-looked-up on that server-fetched `playerId` and tokens are minted. ## Producing the server auth code (Integration) The server auth code is obtained **on-device by the Android app** — there is no server-side way to mint it. The app calls `GamesSignInClient.requestServerSideAccess(serverClientId, …)` using the Google Cloud **web (server) client id** configured for the game, which returns a single-use auth code string. Submit that string here as `serverAuthCode`. The **backend-relayed** shape is the common one: the app forwards the auth code to the customer\'s own backend, which relays it to this endpoint; the app never holds Zyphr keys. ## Security The `playerId` is derived **only** from Zyphr\'s own server-side call to Google after the token exchange — a client-supplied player id is never accepted or trusted. On any verification failure the response is a single opaque `401` `invalid_auth_code`; the specific control that failed is never disclosed.
|
|
19303
|
+
* Sign in with Google Play Games Services
|
|
19304
|
+
*/
|
|
19305
|
+
async signInWithGooglePlayGamesRaw(requestParameters, initOverrides) {
|
|
19306
|
+
if (requestParameters["signInWithGooglePlayGamesRequest"] == null) {
|
|
19307
|
+
throw new RequiredError(
|
|
19308
|
+
"signInWithGooglePlayGamesRequest",
|
|
19309
|
+
'Required parameter "signInWithGooglePlayGamesRequest" was null or undefined when calling signInWithGooglePlayGames().'
|
|
19310
|
+
);
|
|
19311
|
+
}
|
|
19312
|
+
const queryParameters = {};
|
|
19313
|
+
const headerParameters = {};
|
|
19314
|
+
headerParameters["Content-Type"] = "application/json";
|
|
19315
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
19316
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
|
|
19317
|
+
}
|
|
19318
|
+
const response = await this.request({
|
|
19319
|
+
path: `/auth/google-play-games`,
|
|
19320
|
+
method: "POST",
|
|
19321
|
+
headers: headerParameters,
|
|
19322
|
+
query: queryParameters,
|
|
19323
|
+
body: SignInWithGooglePlayGamesRequestToJSON(requestParameters["signInWithGooglePlayGamesRequest"])
|
|
19324
|
+
}, initOverrides);
|
|
19325
|
+
return new JSONApiResponse(response, (jsonValue) => AuthResultResponseFromJSON(jsonValue));
|
|
19326
|
+
}
|
|
19327
|
+
/**
|
|
19328
|
+
* Exchange a Google Play Games Services (GPGS) **server auth code** for a Zyphr end-user session. Unlike Game Center (which submits an Apple-signed assertion), GPGS is verified by Google: Zyphr exchanges the single-use server auth code at Google\'s OAuth2 token endpoint, then calls the Play Games REST API (`players/me`) server-side to obtain the trusted, tamper-proof `playerId`. The user is provisioned-or-looked-up on that server-fetched `playerId` and tokens are minted. ## Producing the server auth code (Integration) The server auth code is obtained **on-device by the Android app** — there is no server-side way to mint it. The app calls `GamesSignInClient.requestServerSideAccess(serverClientId, …)` using the Google Cloud **web (server) client id** configured for the game, which returns a single-use auth code string. Submit that string here as `serverAuthCode`. The **backend-relayed** shape is the common one: the app forwards the auth code to the customer\'s own backend, which relays it to this endpoint; the app never holds Zyphr keys. ## Security The `playerId` is derived **only** from Zyphr\'s own server-side call to Google after the token exchange — a client-supplied player id is never accepted or trusted. On any verification failure the response is a single opaque `401` `invalid_auth_code`; the specific control that failed is never disclosed.
|
|
19329
|
+
* Sign in with Google Play Games Services
|
|
19330
|
+
*/
|
|
19331
|
+
async signInWithGooglePlayGames(signInWithGooglePlayGamesRequest, initOverrides) {
|
|
19332
|
+
const response = await this.signInWithGooglePlayGamesRaw({ signInWithGooglePlayGamesRequest }, initOverrides);
|
|
19333
|
+
return await response.value();
|
|
19334
|
+
}
|
|
19022
19335
|
};
|
|
19023
19336
|
|
|
19024
19337
|
// src/src/apis/AuthSessionsApi.ts
|
|
@@ -19168,50 +19481,88 @@ var AuthSessionsApi = class extends BaseAPI {
|
|
|
19168
19481
|
}
|
|
19169
19482
|
};
|
|
19170
19483
|
|
|
19171
|
-
// src/src/apis/
|
|
19172
|
-
var
|
|
19484
|
+
// src/src/apis/AuthUserDirectoryApi.ts
|
|
19485
|
+
var AuthUserDirectoryApi = class extends BaseAPI {
|
|
19173
19486
|
/**
|
|
19174
|
-
*
|
|
19175
|
-
* Delete
|
|
19487
|
+
* Secret-key-scoped admin soft-delete for an arbitrary end user in the authenticating application. Works in both test and live environments. Scoped to the application via the application_id filter — a caller can never delete a user belonging to another application. Mirrors the self-service `DELETE /auth/users/me` flow: revokes all sessions, soft-deletes the row (status=\'deleted\'), and emits a `user.deleted` webhook with `method=\'application_admin\'`. The audit log row survives (no FK to end_users), so org-history queries still resolve.
|
|
19488
|
+
* Delete an end user (server-side admin)
|
|
19176
19489
|
*/
|
|
19177
|
-
async
|
|
19490
|
+
async deleteEndUserByApplicationRaw(requestParameters, initOverrides) {
|
|
19491
|
+
if (requestParameters["userId"] == null) {
|
|
19492
|
+
throw new RequiredError(
|
|
19493
|
+
"userId",
|
|
19494
|
+
'Required parameter "userId" was null or undefined when calling deleteEndUserByApplication().'
|
|
19495
|
+
);
|
|
19496
|
+
}
|
|
19178
19497
|
const queryParameters = {};
|
|
19179
19498
|
const headerParameters = {};
|
|
19180
|
-
if (this.configuration && this.configuration.
|
|
19181
|
-
|
|
19182
|
-
const tokenString = await token("EndUserToken", []);
|
|
19183
|
-
if (tokenString) {
|
|
19184
|
-
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
19185
|
-
}
|
|
19499
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
19500
|
+
headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
|
|
19186
19501
|
}
|
|
19187
19502
|
if (this.configuration && this.configuration.apiKey) {
|
|
19188
19503
|
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
|
|
19189
19504
|
}
|
|
19190
19505
|
const response = await this.request({
|
|
19191
|
-
path: `/auth/users/
|
|
19506
|
+
path: `/auth/users/{user_id}`.replace(`{${"user_id"}}`, encodeURIComponent(String(requestParameters["userId"]))),
|
|
19192
19507
|
method: "DELETE",
|
|
19193
19508
|
headers: headerParameters,
|
|
19194
19509
|
query: queryParameters
|
|
19195
19510
|
}, initOverrides);
|
|
19196
|
-
return new
|
|
19511
|
+
return new VoidApiResponse(response);
|
|
19197
19512
|
}
|
|
19198
19513
|
/**
|
|
19199
|
-
*
|
|
19200
|
-
* Delete
|
|
19514
|
+
* Secret-key-scoped admin soft-delete for an arbitrary end user in the authenticating application. Works in both test and live environments. Scoped to the application via the application_id filter — a caller can never delete a user belonging to another application. Mirrors the self-service `DELETE /auth/users/me` flow: revokes all sessions, soft-deletes the row (status=\'deleted\'), and emits a `user.deleted` webhook with `method=\'application_admin\'`. The audit log row survives (no FK to end_users), so org-history queries still resolve.
|
|
19515
|
+
* Delete an end user (server-side admin)
|
|
19201
19516
|
*/
|
|
19202
|
-
async
|
|
19203
|
-
|
|
19204
|
-
return await response.value();
|
|
19517
|
+
async deleteEndUserByApplication(userId, initOverrides) {
|
|
19518
|
+
await this.deleteEndUserByApplicationRaw({ userId }, initOverrides);
|
|
19205
19519
|
}
|
|
19206
19520
|
/**
|
|
19207
|
-
*
|
|
19208
|
-
*
|
|
19521
|
+
* Secret-key-scoped lookup of a single end user by email address within the authenticating application. Scoped to the application — never resolves a user from another application. Does not return the password hash.
|
|
19522
|
+
* Look up an end user by email (server-side admin)
|
|
19209
19523
|
*/
|
|
19210
|
-
async
|
|
19524
|
+
async getEndUserByEmailRaw(requestParameters, initOverrides) {
|
|
19525
|
+
if (requestParameters["email"] == null) {
|
|
19526
|
+
throw new RequiredError(
|
|
19527
|
+
"email",
|
|
19528
|
+
'Required parameter "email" was null or undefined when calling getEndUserByEmail().'
|
|
19529
|
+
);
|
|
19530
|
+
}
|
|
19531
|
+
const queryParameters = {};
|
|
19532
|
+
if (requestParameters["email"] != null) {
|
|
19533
|
+
queryParameters["email"] = requestParameters["email"];
|
|
19534
|
+
}
|
|
19535
|
+
const headerParameters = {};
|
|
19536
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
19537
|
+
headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
|
|
19538
|
+
}
|
|
19539
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
19540
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
|
|
19541
|
+
}
|
|
19542
|
+
const response = await this.request({
|
|
19543
|
+
path: `/auth/users/by-email`,
|
|
19544
|
+
method: "GET",
|
|
19545
|
+
headers: headerParameters,
|
|
19546
|
+
query: queryParameters
|
|
19547
|
+
}, initOverrides);
|
|
19548
|
+
return new VoidApiResponse(response);
|
|
19549
|
+
}
|
|
19550
|
+
/**
|
|
19551
|
+
* Secret-key-scoped lookup of a single end user by email address within the authenticating application. Scoped to the application — never resolves a user from another application. Does not return the password hash.
|
|
19552
|
+
* Look up an end user by email (server-side admin)
|
|
19553
|
+
*/
|
|
19554
|
+
async getEndUserByEmail(email, initOverrides) {
|
|
19555
|
+
await this.getEndUserByEmailRaw({ email }, initOverrides);
|
|
19556
|
+
}
|
|
19557
|
+
/**
|
|
19558
|
+
* Secret-key-scoped fetch of a single end user by id within the authenticating application. Scoped to the application — a caller can never read a user belonging to another application.
|
|
19559
|
+
* Get an end user by id (server-side admin)
|
|
19560
|
+
*/
|
|
19561
|
+
async getEndUserByIdRaw(requestParameters, initOverrides) {
|
|
19211
19562
|
if (requestParameters["userId"] == null) {
|
|
19212
19563
|
throw new RequiredError(
|
|
19213
19564
|
"userId",
|
|
19214
|
-
'Required parameter "userId" was null or undefined when calling
|
|
19565
|
+
'Required parameter "userId" was null or undefined when calling getEndUserById().'
|
|
19215
19566
|
);
|
|
19216
19567
|
}
|
|
19217
19568
|
const queryParameters = {};
|
|
@@ -19224,18 +19575,253 @@ var AuthUserProfileApi = class extends BaseAPI {
|
|
|
19224
19575
|
}
|
|
19225
19576
|
const response = await this.request({
|
|
19226
19577
|
path: `/auth/users/{user_id}`.replace(`{${"user_id"}}`, encodeURIComponent(String(requestParameters["userId"]))),
|
|
19227
|
-
method: "
|
|
19578
|
+
method: "GET",
|
|
19228
19579
|
headers: headerParameters,
|
|
19229
19580
|
query: queryParameters
|
|
19230
19581
|
}, initOverrides);
|
|
19231
19582
|
return new VoidApiResponse(response);
|
|
19232
19583
|
}
|
|
19233
19584
|
/**
|
|
19234
|
-
*
|
|
19235
|
-
*
|
|
19585
|
+
* Secret-key-scoped fetch of a single end user by id within the authenticating application. Scoped to the application — a caller can never read a user belonging to another application.
|
|
19586
|
+
* Get an end user by id (server-side admin)
|
|
19236
19587
|
*/
|
|
19237
|
-
async
|
|
19238
|
-
await this.
|
|
19588
|
+
async getEndUserById(userId, initOverrides) {
|
|
19589
|
+
await this.getEndUserByIdRaw({ userId }, initOverrides);
|
|
19590
|
+
}
|
|
19591
|
+
/**
|
|
19592
|
+
* Secret-key-scoped read of the authoritative custom_claims stored for an end user. These are the TRUSTED claims embedded into the user\'s JWTs on login/refresh — use them (not the client-writable `metadata` field) for authorization decisions. Returns an empty object when none are set.
|
|
19593
|
+
* Get an end user\'s stored custom claims (server-side admin)
|
|
19594
|
+
*/
|
|
19595
|
+
async getEndUserClaimsRaw(requestParameters, initOverrides) {
|
|
19596
|
+
if (requestParameters["userId"] == null) {
|
|
19597
|
+
throw new RequiredError(
|
|
19598
|
+
"userId",
|
|
19599
|
+
'Required parameter "userId" was null or undefined when calling getEndUserClaims().'
|
|
19600
|
+
);
|
|
19601
|
+
}
|
|
19602
|
+
const queryParameters = {};
|
|
19603
|
+
const headerParameters = {};
|
|
19604
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
19605
|
+
headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
|
|
19606
|
+
}
|
|
19607
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
19608
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
|
|
19609
|
+
}
|
|
19610
|
+
const response = await this.request({
|
|
19611
|
+
path: `/auth/users/{user_id}/claims`.replace(`{${"user_id"}}`, encodeURIComponent(String(requestParameters["userId"]))),
|
|
19612
|
+
method: "GET",
|
|
19613
|
+
headers: headerParameters,
|
|
19614
|
+
query: queryParameters
|
|
19615
|
+
}, initOverrides);
|
|
19616
|
+
return new VoidApiResponse(response);
|
|
19617
|
+
}
|
|
19618
|
+
/**
|
|
19619
|
+
* Secret-key-scoped read of the authoritative custom_claims stored for an end user. These are the TRUSTED claims embedded into the user\'s JWTs on login/refresh — use them (not the client-writable `metadata` field) for authorization decisions. Returns an empty object when none are set.
|
|
19620
|
+
* Get an end user\'s stored custom claims (server-side admin)
|
|
19621
|
+
*/
|
|
19622
|
+
async getEndUserClaims(userId, initOverrides) {
|
|
19623
|
+
await this.getEndUserClaimsRaw({ userId }, initOverrides);
|
|
19624
|
+
}
|
|
19625
|
+
/**
|
|
19626
|
+
* Secret-key-scoped pre-provisioning for an end user. Creates a passwordless user in the authenticating application (idempotent on email — an existing, non-deleted user is reused, not duplicated) and, when `send_link` is set, sends a first-login link so the user can set up their account without self-registration. - `send_link: \"magic\"` sends a magic-link sign-in email. - `send_link: \"password_reset\"` sends a set-password email. - `send_link: \"none\"` (default) creates the user with no email. A `redirect_url` is required when `send_link` is \"magic\" or \"password_reset\"; it must match the application\'s redirect_uris allowlist (custom schemes such as yourapp://path are permitted).
|
|
19627
|
+
* Pre-provision (invite) an end user (server-side admin)
|
|
19628
|
+
*/
|
|
19629
|
+
async inviteEndUserRaw(requestParameters, initOverrides) {
|
|
19630
|
+
if (requestParameters["inviteEndUserRequest"] == null) {
|
|
19631
|
+
throw new RequiredError(
|
|
19632
|
+
"inviteEndUserRequest",
|
|
19633
|
+
'Required parameter "inviteEndUserRequest" was null or undefined when calling inviteEndUser().'
|
|
19634
|
+
);
|
|
19635
|
+
}
|
|
19636
|
+
const queryParameters = {};
|
|
19637
|
+
const headerParameters = {};
|
|
19638
|
+
headerParameters["Content-Type"] = "application/json";
|
|
19639
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
19640
|
+
headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
|
|
19641
|
+
}
|
|
19642
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
19643
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
|
|
19644
|
+
}
|
|
19645
|
+
const response = await this.request({
|
|
19646
|
+
path: `/auth/users/invite`,
|
|
19647
|
+
method: "POST",
|
|
19648
|
+
headers: headerParameters,
|
|
19649
|
+
query: queryParameters,
|
|
19650
|
+
body: InviteEndUserRequestToJSON(requestParameters["inviteEndUserRequest"])
|
|
19651
|
+
}, initOverrides);
|
|
19652
|
+
return new VoidApiResponse(response);
|
|
19653
|
+
}
|
|
19654
|
+
/**
|
|
19655
|
+
* Secret-key-scoped pre-provisioning for an end user. Creates a passwordless user in the authenticating application (idempotent on email — an existing, non-deleted user is reused, not duplicated) and, when `send_link` is set, sends a first-login link so the user can set up their account without self-registration. - `send_link: \"magic\"` sends a magic-link sign-in email. - `send_link: \"password_reset\"` sends a set-password email. - `send_link: \"none\"` (default) creates the user with no email. A `redirect_url` is required when `send_link` is \"magic\" or \"password_reset\"; it must match the application\'s redirect_uris allowlist (custom schemes such as yourapp://path are permitted).
|
|
19656
|
+
* Pre-provision (invite) an end user (server-side admin)
|
|
19657
|
+
*/
|
|
19658
|
+
async inviteEndUser(inviteEndUserRequest, initOverrides) {
|
|
19659
|
+
await this.inviteEndUserRaw({ inviteEndUserRequest }, initOverrides);
|
|
19660
|
+
}
|
|
19661
|
+
/**
|
|
19662
|
+
* Secret-key-scoped directory listing of end users in the authenticating application. Supports substring search over email, name, and phone, an optional environment filter (test/live), and pagination. Scoped to the application — never returns users from another application.
|
|
19663
|
+
* List / search end users (server-side admin)
|
|
19664
|
+
*/
|
|
19665
|
+
async listEndUsersRaw(requestParameters, initOverrides) {
|
|
19666
|
+
const queryParameters = {};
|
|
19667
|
+
if (requestParameters["page"] != null) {
|
|
19668
|
+
queryParameters["page"] = requestParameters["page"];
|
|
19669
|
+
}
|
|
19670
|
+
if (requestParameters["perPage"] != null) {
|
|
19671
|
+
queryParameters["per_page"] = requestParameters["perPage"];
|
|
19672
|
+
}
|
|
19673
|
+
if (requestParameters["search"] != null) {
|
|
19674
|
+
queryParameters["search"] = requestParameters["search"];
|
|
19675
|
+
}
|
|
19676
|
+
if (requestParameters["environment"] != null) {
|
|
19677
|
+
queryParameters["environment"] = requestParameters["environment"];
|
|
19678
|
+
}
|
|
19679
|
+
const headerParameters = {};
|
|
19680
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
19681
|
+
headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
|
|
19682
|
+
}
|
|
19683
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
19684
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
|
|
19685
|
+
}
|
|
19686
|
+
const response = await this.request({
|
|
19687
|
+
path: `/auth/users`,
|
|
19688
|
+
method: "GET",
|
|
19689
|
+
headers: headerParameters,
|
|
19690
|
+
query: queryParameters
|
|
19691
|
+
}, initOverrides);
|
|
19692
|
+
return new VoidApiResponse(response);
|
|
19693
|
+
}
|
|
19694
|
+
/**
|
|
19695
|
+
* Secret-key-scoped directory listing of end users in the authenticating application. Supports substring search over email, name, and phone, an optional environment filter (test/live), and pagination. Scoped to the application — never returns users from another application.
|
|
19696
|
+
* List / search end users (server-side admin)
|
|
19697
|
+
*/
|
|
19698
|
+
async listEndUsers(page, perPage, search, environment, initOverrides) {
|
|
19699
|
+
await this.listEndUsersRaw({ page, perPage, search, environment }, initOverrides);
|
|
19700
|
+
}
|
|
19701
|
+
/**
|
|
19702
|
+
* Secret-key-scoped upsert of the authoritative custom_claims for an end user. Set server-side only — clients cannot write these, which is what makes them safe for authorization (e.g. an account-type/admin flag). Claims are embedded into the user\'s JWTs on the next login/refresh. Max 4KB; reserved JWT/Zyphr claim names are rejected. To make a change take effect immediately on already-issued tokens (e.g. revoking admin), call POST /auth/sessions/revoke-all for the user after updating claims — that bumps the revocation epoch so outstanding access tokens stop verifying.
|
|
19703
|
+
* Set an end user\'s stored custom claims (server-side admin)
|
|
19704
|
+
*/
|
|
19705
|
+
async setEndUserClaimsRaw(requestParameters, initOverrides) {
|
|
19706
|
+
if (requestParameters["userId"] == null) {
|
|
19707
|
+
throw new RequiredError(
|
|
19708
|
+
"userId",
|
|
19709
|
+
'Required parameter "userId" was null or undefined when calling setEndUserClaims().'
|
|
19710
|
+
);
|
|
19711
|
+
}
|
|
19712
|
+
if (requestParameters["setEndUserClaimsRequest"] == null) {
|
|
19713
|
+
throw new RequiredError(
|
|
19714
|
+
"setEndUserClaimsRequest",
|
|
19715
|
+
'Required parameter "setEndUserClaimsRequest" was null or undefined when calling setEndUserClaims().'
|
|
19716
|
+
);
|
|
19717
|
+
}
|
|
19718
|
+
const queryParameters = {};
|
|
19719
|
+
const headerParameters = {};
|
|
19720
|
+
headerParameters["Content-Type"] = "application/json";
|
|
19721
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
19722
|
+
headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
|
|
19723
|
+
}
|
|
19724
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
19725
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
|
|
19726
|
+
}
|
|
19727
|
+
const response = await this.request({
|
|
19728
|
+
path: `/auth/users/{user_id}/claims`.replace(`{${"user_id"}}`, encodeURIComponent(String(requestParameters["userId"]))),
|
|
19729
|
+
method: "PUT",
|
|
19730
|
+
headers: headerParameters,
|
|
19731
|
+
query: queryParameters,
|
|
19732
|
+
body: SetEndUserClaimsRequestToJSON(requestParameters["setEndUserClaimsRequest"])
|
|
19733
|
+
}, initOverrides);
|
|
19734
|
+
return new VoidApiResponse(response);
|
|
19735
|
+
}
|
|
19736
|
+
/**
|
|
19737
|
+
* Secret-key-scoped upsert of the authoritative custom_claims for an end user. Set server-side only — clients cannot write these, which is what makes them safe for authorization (e.g. an account-type/admin flag). Claims are embedded into the user\'s JWTs on the next login/refresh. Max 4KB; reserved JWT/Zyphr claim names are rejected. To make a change take effect immediately on already-issued tokens (e.g. revoking admin), call POST /auth/sessions/revoke-all for the user after updating claims — that bumps the revocation epoch so outstanding access tokens stop verifying.
|
|
19738
|
+
* Set an end user\'s stored custom claims (server-side admin)
|
|
19739
|
+
*/
|
|
19740
|
+
async setEndUserClaims(userId, setEndUserClaimsRequest, initOverrides) {
|
|
19741
|
+
await this.setEndUserClaimsRaw({ userId, setEndUserClaimsRequest }, initOverrides);
|
|
19742
|
+
}
|
|
19743
|
+
/**
|
|
19744
|
+
* Secret-key-scoped update of an arbitrary end user in the authenticating application. Updatable fields: email, name, avatar_url, metadata, status. Scoped to the application — a caller can never modify a user belonging to another application.
|
|
19745
|
+
* Update an end user (server-side admin)
|
|
19746
|
+
*/
|
|
19747
|
+
async updateEndUserByApplicationRaw(requestParameters, initOverrides) {
|
|
19748
|
+
if (requestParameters["userId"] == null) {
|
|
19749
|
+
throw new RequiredError(
|
|
19750
|
+
"userId",
|
|
19751
|
+
'Required parameter "userId" was null or undefined when calling updateEndUserByApplication().'
|
|
19752
|
+
);
|
|
19753
|
+
}
|
|
19754
|
+
if (requestParameters["updateEndUserByApplicationRequest"] == null) {
|
|
19755
|
+
throw new RequiredError(
|
|
19756
|
+
"updateEndUserByApplicationRequest",
|
|
19757
|
+
'Required parameter "updateEndUserByApplicationRequest" was null or undefined when calling updateEndUserByApplication().'
|
|
19758
|
+
);
|
|
19759
|
+
}
|
|
19760
|
+
const queryParameters = {};
|
|
19761
|
+
const headerParameters = {};
|
|
19762
|
+
headerParameters["Content-Type"] = "application/json";
|
|
19763
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
19764
|
+
headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
|
|
19765
|
+
}
|
|
19766
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
19767
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
|
|
19768
|
+
}
|
|
19769
|
+
const response = await this.request({
|
|
19770
|
+
path: `/auth/users/{user_id}`.replace(`{${"user_id"}}`, encodeURIComponent(String(requestParameters["userId"]))),
|
|
19771
|
+
method: "PATCH",
|
|
19772
|
+
headers: headerParameters,
|
|
19773
|
+
query: queryParameters,
|
|
19774
|
+
body: UpdateEndUserByApplicationRequestToJSON(requestParameters["updateEndUserByApplicationRequest"])
|
|
19775
|
+
}, initOverrides);
|
|
19776
|
+
return new VoidApiResponse(response);
|
|
19777
|
+
}
|
|
19778
|
+
/**
|
|
19779
|
+
* Secret-key-scoped update of an arbitrary end user in the authenticating application. Updatable fields: email, name, avatar_url, metadata, status. Scoped to the application — a caller can never modify a user belonging to another application.
|
|
19780
|
+
* Update an end user (server-side admin)
|
|
19781
|
+
*/
|
|
19782
|
+
async updateEndUserByApplication(userId, updateEndUserByApplicationRequest, initOverrides) {
|
|
19783
|
+
await this.updateEndUserByApplicationRaw({ userId, updateEndUserByApplicationRequest }, initOverrides);
|
|
19784
|
+
}
|
|
19785
|
+
};
|
|
19786
|
+
var ListEndUsersEnvironmentEnum = {
|
|
19787
|
+
TEST: "test",
|
|
19788
|
+
LIVE: "live"
|
|
19789
|
+
};
|
|
19790
|
+
|
|
19791
|
+
// src/src/apis/AuthUserProfileApi.ts
|
|
19792
|
+
var AuthUserProfileApi = class extends BaseAPI {
|
|
19793
|
+
/**
|
|
19794
|
+
* Delete the current end user account (GDPR right to erasure). This is a soft delete — the account is marked as deleted but data is retained for a period to allow for recovery or legal requirements.
|
|
19795
|
+
* Delete current end user account
|
|
19796
|
+
*/
|
|
19797
|
+
async deleteEndUserRaw(initOverrides) {
|
|
19798
|
+
const queryParameters = {};
|
|
19799
|
+
const headerParameters = {};
|
|
19800
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
19801
|
+
const token = this.configuration.accessToken;
|
|
19802
|
+
const tokenString = await token("EndUserToken", []);
|
|
19803
|
+
if (tokenString) {
|
|
19804
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
19805
|
+
}
|
|
19806
|
+
}
|
|
19807
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
19808
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
|
|
19809
|
+
}
|
|
19810
|
+
const response = await this.request({
|
|
19811
|
+
path: `/auth/users/me`,
|
|
19812
|
+
method: "DELETE",
|
|
19813
|
+
headers: headerParameters,
|
|
19814
|
+
query: queryParameters
|
|
19815
|
+
}, initOverrides);
|
|
19816
|
+
return new JSONApiResponse(response, (jsonValue) => EndUserDeleteResponseFromJSON(jsonValue));
|
|
19817
|
+
}
|
|
19818
|
+
/**
|
|
19819
|
+
* Delete the current end user account (GDPR right to erasure). This is a soft delete — the account is marked as deleted but data is retained for a period to allow for recovery or legal requirements.
|
|
19820
|
+
* Delete current end user account
|
|
19821
|
+
*/
|
|
19822
|
+
async deleteEndUser(initOverrides) {
|
|
19823
|
+
const response = await this.deleteEndUserRaw(initOverrides);
|
|
19824
|
+
return await response.value();
|
|
19239
19825
|
}
|
|
19240
19826
|
/**
|
|
19241
19827
|
* Retrieve the profile of the currently authenticated end user.
|
|
@@ -25406,34 +25992,34 @@ var ZyphrError = class extends Error {
|
|
|
25406
25992
|
}
|
|
25407
25993
|
};
|
|
25408
25994
|
var ZyphrValidationError = class extends ZyphrError {
|
|
25409
|
-
constructor(message, details) {
|
|
25410
|
-
super({ message, status: 422, code
|
|
25995
|
+
constructor(message, details, code = "validation_error") {
|
|
25996
|
+
super({ message, status: 422, code, details });
|
|
25411
25997
|
this.name = "ZyphrValidationError";
|
|
25412
25998
|
}
|
|
25413
25999
|
};
|
|
25414
26000
|
var ZyphrAuthenticationError = class extends ZyphrError {
|
|
25415
|
-
constructor(message) {
|
|
25416
|
-
super({ message, status: 401, code
|
|
26001
|
+
constructor(message, code = "authentication_error") {
|
|
26002
|
+
super({ message, status: 401, code });
|
|
25417
26003
|
this.name = "ZyphrAuthenticationError";
|
|
25418
26004
|
}
|
|
25419
26005
|
};
|
|
25420
26006
|
var ZyphrRateLimitError = class extends ZyphrError {
|
|
25421
26007
|
retryAfter;
|
|
25422
|
-
constructor(message, retryAfter) {
|
|
25423
|
-
super({ message, status: 429, code
|
|
26008
|
+
constructor(message, retryAfter, code = "rate_limit_exceeded") {
|
|
26009
|
+
super({ message, status: 429, code });
|
|
25424
26010
|
this.name = "ZyphrRateLimitError";
|
|
25425
26011
|
this.retryAfter = retryAfter;
|
|
25426
26012
|
}
|
|
25427
26013
|
};
|
|
25428
26014
|
var ZyphrNotFoundError = class extends ZyphrError {
|
|
25429
|
-
constructor(message) {
|
|
25430
|
-
super({ message, status: 404, code
|
|
26015
|
+
constructor(message, code = "not_found") {
|
|
26016
|
+
super({ message, status: 404, code });
|
|
25431
26017
|
this.name = "ZyphrNotFoundError";
|
|
25432
26018
|
}
|
|
25433
26019
|
};
|
|
25434
26020
|
var ZyphrPayloadTooLargeError = class extends ZyphrError {
|
|
25435
|
-
constructor(message, details, requestId) {
|
|
25436
|
-
super({ message, status: 413, code
|
|
26021
|
+
constructor(message, details, requestId, code = "payload_too_large") {
|
|
26022
|
+
super({ message, status: 413, code, details, requestId });
|
|
25437
26023
|
this.name = "ZyphrPayloadTooLargeError";
|
|
25438
26024
|
}
|
|
25439
26025
|
/** Maximum allowed request body size in bytes (server-enforced). */
|
|
@@ -25463,24 +26049,24 @@ async function parseErrorResponse(response) {
|
|
|
25463
26049
|
const error = body.error ?? {};
|
|
25464
26050
|
const meta = body.meta ?? {};
|
|
25465
26051
|
const message = error.message ?? response.statusText ?? "Unknown error";
|
|
25466
|
-
const code = error.code;
|
|
26052
|
+
const code = error.code || void 0;
|
|
25467
26053
|
const requestId = meta.request_id;
|
|
25468
26054
|
const details = error.details;
|
|
25469
26055
|
switch (response.status) {
|
|
25470
26056
|
case 400:
|
|
25471
26057
|
case 422:
|
|
25472
|
-
return new ZyphrValidationError(message, details);
|
|
26058
|
+
return new ZyphrValidationError(message, details, code);
|
|
25473
26059
|
case 401:
|
|
25474
26060
|
case 403:
|
|
25475
|
-
return new ZyphrAuthenticationError(message);
|
|
26061
|
+
return new ZyphrAuthenticationError(message, code);
|
|
25476
26062
|
case 404:
|
|
25477
|
-
return new ZyphrNotFoundError(message);
|
|
26063
|
+
return new ZyphrNotFoundError(message, code);
|
|
25478
26064
|
case 413:
|
|
25479
|
-
return new ZyphrPayloadTooLargeError(message, details, requestId);
|
|
26065
|
+
return new ZyphrPayloadTooLargeError(message, details, requestId, code);
|
|
25480
26066
|
case 429: {
|
|
25481
26067
|
const retryAfterHeader = response.headers.get("Retry-After");
|
|
25482
26068
|
const retryAfter = retryAfterHeader ? parseInt(retryAfterHeader, 10) : void 0;
|
|
25483
|
-
return new ZyphrRateLimitError(message, retryAfter);
|
|
26069
|
+
return new ZyphrRateLimitError(message, retryAfter, code);
|
|
25484
26070
|
}
|
|
25485
26071
|
default:
|
|
25486
26072
|
return new ZyphrError({ message, status: response.status, code, requestId, details });
|
|
@@ -25591,6 +26177,99 @@ var Zyphr = class {
|
|
|
25591
26177
|
}
|
|
25592
26178
|
};
|
|
25593
26179
|
|
|
26180
|
+
// src/clientAuth.ts
|
|
26181
|
+
var errorMiddleware2 = {
|
|
26182
|
+
async post(context) {
|
|
26183
|
+
if (context.response.status >= 200 && context.response.status < 300) {
|
|
26184
|
+
return;
|
|
26185
|
+
}
|
|
26186
|
+
throw await parseErrorResponse(context.response);
|
|
26187
|
+
}
|
|
26188
|
+
};
|
|
26189
|
+
var ZyphrClientCredentialError = class extends Error {
|
|
26190
|
+
constructor(message) {
|
|
26191
|
+
super(message);
|
|
26192
|
+
this.name = "ZyphrClientCredentialError";
|
|
26193
|
+
}
|
|
26194
|
+
};
|
|
26195
|
+
var SECRET_KEY_PREFIXES = ["za_sec_", "zy_live_", "zy_test_"];
|
|
26196
|
+
var ZyphrClient = class {
|
|
26197
|
+
auth;
|
|
26198
|
+
/** Device registration for push (takes an OS-acquired token). */
|
|
26199
|
+
devices;
|
|
26200
|
+
applicationKey;
|
|
26201
|
+
accessToken;
|
|
26202
|
+
constructor(options) {
|
|
26203
|
+
if (!options.applicationKey) {
|
|
26204
|
+
throw new ZyphrClientCredentialError("applicationKey (za_pub_*) is required");
|
|
26205
|
+
}
|
|
26206
|
+
if (SECRET_KEY_PREFIXES.some((p) => options.applicationKey.startsWith(p))) {
|
|
26207
|
+
throw new ZyphrClientCredentialError(
|
|
26208
|
+
"ZyphrClient must be constructed with a publishable application key (za_pub_*), never a secret key. Secret keys must stay server-side."
|
|
26209
|
+
);
|
|
26210
|
+
}
|
|
26211
|
+
if (!options.applicationKey.startsWith("za_pub_")) {
|
|
26212
|
+
throw new ZyphrClientCredentialError(
|
|
26213
|
+
"applicationKey must be a publishable application key (za_pub_*)."
|
|
26214
|
+
);
|
|
26215
|
+
}
|
|
26216
|
+
this.applicationKey = options.applicationKey;
|
|
26217
|
+
this.accessToken = options.accessToken;
|
|
26218
|
+
const config = new Configuration({
|
|
26219
|
+
basePath: options.baseUrl,
|
|
26220
|
+
// The only credential this client sends automatically is the publishable
|
|
26221
|
+
// application key. End-user Bearer tokens are attached per-request via
|
|
26222
|
+
// authedRequest() so token rotation doesn't require rebuilding the client.
|
|
26223
|
+
apiKey: (name) => name === "X-Application-Key" ? this.applicationKey : "",
|
|
26224
|
+
middleware: [errorMiddleware2]
|
|
26225
|
+
});
|
|
26226
|
+
this.auth = {
|
|
26227
|
+
login: new AuthLoginApi(config),
|
|
26228
|
+
registration: new AuthRegistrationApi(config),
|
|
26229
|
+
sessions: new AuthSessionsApi(config),
|
|
26230
|
+
emailVerification: new AuthEmailVerificationApi(config),
|
|
26231
|
+
passwordReset: new AuthPasswordResetApi(config),
|
|
26232
|
+
mfa: new AuthMFAApi(config),
|
|
26233
|
+
magicLinks: new AuthMagicLinksApi(config),
|
|
26234
|
+
oauth: new AuthOAuthApi(config),
|
|
26235
|
+
organizations: new AuthOrganizationsApi(config),
|
|
26236
|
+
phone: new AuthPhoneApi(config),
|
|
26237
|
+
emailOtp: new AuthEmailOTPApi(config),
|
|
26238
|
+
profile: new AuthUserProfileApi(config),
|
|
26239
|
+
webauthn: new AuthWebAuthnApi(config)
|
|
26240
|
+
};
|
|
26241
|
+
this.devices = new DevicesApi(config);
|
|
26242
|
+
}
|
|
26243
|
+
/** Store the end-user access token for subsequent authedRequest() calls. */
|
|
26244
|
+
setAccessToken(accessToken) {
|
|
26245
|
+
this.accessToken = accessToken;
|
|
26246
|
+
}
|
|
26247
|
+
/** True when an end-user access token is currently set. */
|
|
26248
|
+
get isAuthenticated() {
|
|
26249
|
+
return Boolean(this.accessToken);
|
|
26250
|
+
}
|
|
26251
|
+
/**
|
|
26252
|
+
* Build request overrides that authenticate as the current end user: the
|
|
26253
|
+
* stored Bearer token plus the publishable application key required by
|
|
26254
|
+
* user-scoped endpoints. Pass an explicit token to override the stored one.
|
|
26255
|
+
*
|
|
26256
|
+
* @example
|
|
26257
|
+
* ```ts
|
|
26258
|
+
* const me = await zyphr.auth.profile.getEndUser(zyphr.authedRequest());
|
|
26259
|
+
* ```
|
|
26260
|
+
*/
|
|
26261
|
+
authedRequest(accessToken) {
|
|
26262
|
+
const token = accessToken ?? this.accessToken;
|
|
26263
|
+
const headers = {
|
|
26264
|
+
"X-Application-Key": this.applicationKey
|
|
26265
|
+
};
|
|
26266
|
+
if (token) {
|
|
26267
|
+
headers.Authorization = `Bearer ${token}`;
|
|
26268
|
+
}
|
|
26269
|
+
return { headers };
|
|
26270
|
+
}
|
|
26271
|
+
};
|
|
26272
|
+
|
|
25594
26273
|
// src/index.ts
|
|
25595
26274
|
var SDK_VERSION = "0.1.0";
|
|
25596
26275
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -25738,6 +26417,7 @@ var SDK_VERSION = "0.1.0";
|
|
|
25738
26417
|
AuthTokensFromJSONTyped,
|
|
25739
26418
|
AuthTokensToJSON,
|
|
25740
26419
|
AuthTokensToJSONTyped,
|
|
26420
|
+
AuthUserDirectoryApi,
|
|
25741
26421
|
AuthUserFromJSON,
|
|
25742
26422
|
AuthUserFromJSONTyped,
|
|
25743
26423
|
AuthUserProfileApi,
|
|
@@ -26152,10 +26832,16 @@ var SDK_VERSION = "0.1.0";
|
|
|
26152
26832
|
InboxNotificationResponseFromJSONTyped,
|
|
26153
26833
|
InboxNotificationResponseToJSON,
|
|
26154
26834
|
InboxNotificationResponseToJSONTyped,
|
|
26835
|
+
InviteEndUserRequestFromJSON,
|
|
26836
|
+
InviteEndUserRequestFromJSONTyped,
|
|
26837
|
+
InviteEndUserRequestSendLinkEnum,
|
|
26838
|
+
InviteEndUserRequestToJSON,
|
|
26839
|
+
InviteEndUserRequestToJSONTyped,
|
|
26155
26840
|
JSONApiResponse,
|
|
26156
26841
|
ListAllInboxStatusEnum,
|
|
26157
26842
|
ListDevicesPlatformEnum,
|
|
26158
26843
|
ListEmailsStatusEnum,
|
|
26844
|
+
ListEndUsersEnvironmentEnum,
|
|
26159
26845
|
ListInboundEmailsStatusEnum,
|
|
26160
26846
|
ListPushStatusEnum,
|
|
26161
26847
|
ListSlackMessagesStatusEnum,
|
|
@@ -26342,6 +27028,11 @@ var SDK_VERSION = "0.1.0";
|
|
|
26342
27028
|
OAuthProviderInfoFromJSONTyped,
|
|
26343
27029
|
OAuthProviderInfoToJSON,
|
|
26344
27030
|
OAuthProviderInfoToJSONTyped,
|
|
27031
|
+
OAuthProviderName,
|
|
27032
|
+
OAuthProviderNameFromJSON,
|
|
27033
|
+
OAuthProviderNameFromJSONTyped,
|
|
27034
|
+
OAuthProviderNameToJSON,
|
|
27035
|
+
OAuthProviderNameToJSONTyped,
|
|
26345
27036
|
OAuthProviderToJSON,
|
|
26346
27037
|
OAuthProviderToJSONTyped,
|
|
26347
27038
|
OAuthProvidersResponseDataFromJSON,
|
|
@@ -26771,6 +27462,10 @@ var SDK_VERSION = "0.1.0";
|
|
|
26771
27462
|
SetDomainInboundRequestFromJSONTyped,
|
|
26772
27463
|
SetDomainInboundRequestToJSON,
|
|
26773
27464
|
SetDomainInboundRequestToJSONTyped,
|
|
27465
|
+
SetEndUserClaimsRequestFromJSON,
|
|
27466
|
+
SetEndUserClaimsRequestFromJSONTyped,
|
|
27467
|
+
SetEndUserClaimsRequestToJSON,
|
|
27468
|
+
SetEndUserClaimsRequestToJSONTyped,
|
|
26774
27469
|
SetPreferencesRequestFromJSON,
|
|
26775
27470
|
SetPreferencesRequestFromJSONTyped,
|
|
26776
27471
|
SetPreferencesRequestPreferencesInnerFromJSON,
|
|
@@ -26783,6 +27478,14 @@ var SDK_VERSION = "0.1.0";
|
|
|
26783
27478
|
SignInAnonymouslyRequestFromJSONTyped,
|
|
26784
27479
|
SignInAnonymouslyRequestToJSON,
|
|
26785
27480
|
SignInAnonymouslyRequestToJSONTyped,
|
|
27481
|
+
SignInWithGameCenterRequestFromJSON,
|
|
27482
|
+
SignInWithGameCenterRequestFromJSONTyped,
|
|
27483
|
+
SignInWithGameCenterRequestToJSON,
|
|
27484
|
+
SignInWithGameCenterRequestToJSONTyped,
|
|
27485
|
+
SignInWithGooglePlayGamesRequestFromJSON,
|
|
27486
|
+
SignInWithGooglePlayGamesRequestFromJSONTyped,
|
|
27487
|
+
SignInWithGooglePlayGamesRequestToJSON,
|
|
27488
|
+
SignInWithGooglePlayGamesRequestToJSONTyped,
|
|
26786
27489
|
SlackApi,
|
|
26787
27490
|
SlackMessageFromJSON,
|
|
26788
27491
|
SlackMessageFromJSONTyped,
|
|
@@ -27016,6 +27719,10 @@ var SDK_VERSION = "0.1.0";
|
|
|
27016
27719
|
UpdateCategoryRequestFromJSONTyped,
|
|
27017
27720
|
UpdateCategoryRequestToJSON,
|
|
27018
27721
|
UpdateCategoryRequestToJSONTyped,
|
|
27722
|
+
UpdateEndUserByApplicationRequestFromJSON,
|
|
27723
|
+
UpdateEndUserByApplicationRequestFromJSONTyped,
|
|
27724
|
+
UpdateEndUserByApplicationRequestToJSON,
|
|
27725
|
+
UpdateEndUserByApplicationRequestToJSONTyped,
|
|
27019
27726
|
UpdateEndUserRequestFromJSON,
|
|
27020
27727
|
UpdateEndUserRequestFromJSONTyped,
|
|
27021
27728
|
UpdateEndUserRequestToJSON,
|
|
@@ -27433,6 +28140,8 @@ var SDK_VERSION = "0.1.0";
|
|
|
27433
28140
|
WorkflowStepExecutionToJSONTyped,
|
|
27434
28141
|
Zyphr,
|
|
27435
28142
|
ZyphrAuthenticationError,
|
|
28143
|
+
ZyphrClient,
|
|
28144
|
+
ZyphrClientCredentialError,
|
|
27436
28145
|
ZyphrError,
|
|
27437
28146
|
ZyphrNotFoundError,
|
|
27438
28147
|
ZyphrPayloadTooLargeError,
|
|
@@ -27567,6 +28276,7 @@ var SDK_VERSION = "0.1.0";
|
|
|
27567
28276
|
instanceOfInboxListMeta,
|
|
27568
28277
|
instanceOfInboxListResponse,
|
|
27569
28278
|
instanceOfInboxNotificationResponse,
|
|
28279
|
+
instanceOfInviteEndUserRequest,
|
|
27570
28280
|
instanceOfListWaaSApplications200Response,
|
|
27571
28281
|
instanceOfListWaaSEndpointDeliveries200Response,
|
|
27572
28282
|
instanceOfListWaaSEndpoints200Response,
|
|
@@ -27611,6 +28321,7 @@ var SDK_VERSION = "0.1.0";
|
|
|
27611
28321
|
instanceOfOAuthConnectionsResponseData,
|
|
27612
28322
|
instanceOfOAuthProvider,
|
|
27613
28323
|
instanceOfOAuthProviderInfo,
|
|
28324
|
+
instanceOfOAuthProviderName,
|
|
27614
28325
|
instanceOfOAuthProvidersResponse,
|
|
27615
28326
|
instanceOfOAuthProvidersResponseData,
|
|
27616
28327
|
instanceOfOAuthTokensRefreshResponse,
|
|
@@ -27714,9 +28425,12 @@ var SDK_VERSION = "0.1.0";
|
|
|
27714
28425
|
instanceOfSessionListResponseData,
|
|
27715
28426
|
instanceOfSessionListResponseDataSessionInfo,
|
|
27716
28427
|
instanceOfSetDomainInboundRequest,
|
|
28428
|
+
instanceOfSetEndUserClaimsRequest,
|
|
27717
28429
|
instanceOfSetPreferencesRequest,
|
|
27718
28430
|
instanceOfSetPreferencesRequestPreferencesInner,
|
|
27719
28431
|
instanceOfSignInAnonymouslyRequest,
|
|
28432
|
+
instanceOfSignInWithGameCenterRequest,
|
|
28433
|
+
instanceOfSignInWithGooglePlayGamesRequest,
|
|
27720
28434
|
instanceOfSlackMessage,
|
|
27721
28435
|
instanceOfSlackMessageListResponse,
|
|
27722
28436
|
instanceOfSlackMessageListResponseMeta,
|
|
@@ -27772,6 +28486,7 @@ var SDK_VERSION = "0.1.0";
|
|
|
27772
28486
|
instanceOfUnsubscribeRequest,
|
|
27773
28487
|
instanceOfUnsubscribeResponse,
|
|
27774
28488
|
instanceOfUpdateCategoryRequest,
|
|
28489
|
+
instanceOfUpdateEndUserByApplicationRequest,
|
|
27775
28490
|
instanceOfUpdateEndUserRequest,
|
|
27776
28491
|
instanceOfUpdateOrganizationMemberRoleRequest,
|
|
27777
28492
|
instanceOfUpdateOrganizationRequest,
|