@zyphr-dev/node-sdk 0.1.34 → 0.1.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -8999,6 +8999,34 @@ function SendBatchSmsResponseToJSONTyped(value, ignoreDiscriminator = false) {
8999
8999
  };
9000
9000
  }
9001
9001
 
9002
+ // src/src/models/SendEmailOtpRegistrationRequest.ts
9003
+ function instanceOfSendEmailOtpRegistrationRequest(value) {
9004
+ if (!("email" in value) || value["email"] === void 0) return false;
9005
+ return true;
9006
+ }
9007
+ function SendEmailOtpRegistrationRequestFromJSON(json) {
9008
+ return SendEmailOtpRegistrationRequestFromJSONTyped(json, false);
9009
+ }
9010
+ function SendEmailOtpRegistrationRequestFromJSONTyped(json, ignoreDiscriminator) {
9011
+ if (json == null) {
9012
+ return json;
9013
+ }
9014
+ return {
9015
+ "email": json["email"]
9016
+ };
9017
+ }
9018
+ function SendEmailOtpRegistrationRequestToJSON(json) {
9019
+ return SendEmailOtpRegistrationRequestToJSONTyped(json, false);
9020
+ }
9021
+ function SendEmailOtpRegistrationRequestToJSONTyped(value, ignoreDiscriminator = false) {
9022
+ if (value == null) {
9023
+ return value;
9024
+ }
9025
+ return {
9026
+ "email": value["email"]
9027
+ };
9028
+ }
9029
+
9002
9030
  // src/src/models/SendEmailRequest.ts
9003
9031
  function instanceOfSendEmailRequest(value) {
9004
9032
  if (!("to" in value) || value["to"] === void 0) return false;
@@ -12532,6 +12560,74 @@ function VerifyDomainResponseToJSONTyped(value, ignoreDiscriminator = false) {
12532
12560
  };
12533
12561
  }
12534
12562
 
12563
+ // src/src/models/VerifyEmailOtpLoginRequest.ts
12564
+ function instanceOfVerifyEmailOtpLoginRequest(value) {
12565
+ if (!("email" in value) || value["email"] === void 0) return false;
12566
+ if (!("code" in value) || value["code"] === void 0) return false;
12567
+ return true;
12568
+ }
12569
+ function VerifyEmailOtpLoginRequestFromJSON(json) {
12570
+ return VerifyEmailOtpLoginRequestFromJSONTyped(json, false);
12571
+ }
12572
+ function VerifyEmailOtpLoginRequestFromJSONTyped(json, ignoreDiscriminator) {
12573
+ if (json == null) {
12574
+ return json;
12575
+ }
12576
+ return {
12577
+ "email": json["email"],
12578
+ "code": json["code"],
12579
+ "customClaims": json["custom_claims"] == null ? void 0 : json["custom_claims"]
12580
+ };
12581
+ }
12582
+ function VerifyEmailOtpLoginRequestToJSON(json) {
12583
+ return VerifyEmailOtpLoginRequestToJSONTyped(json, false);
12584
+ }
12585
+ function VerifyEmailOtpLoginRequestToJSONTyped(value, ignoreDiscriminator = false) {
12586
+ if (value == null) {
12587
+ return value;
12588
+ }
12589
+ return {
12590
+ "email": value["email"],
12591
+ "code": value["code"],
12592
+ "custom_claims": value["customClaims"]
12593
+ };
12594
+ }
12595
+
12596
+ // src/src/models/VerifyEmailOtpRegistrationRequest.ts
12597
+ function instanceOfVerifyEmailOtpRegistrationRequest(value) {
12598
+ if (!("email" in value) || value["email"] === void 0) return false;
12599
+ if (!("code" in value) || value["code"] === void 0) return false;
12600
+ return true;
12601
+ }
12602
+ function VerifyEmailOtpRegistrationRequestFromJSON(json) {
12603
+ return VerifyEmailOtpRegistrationRequestFromJSONTyped(json, false);
12604
+ }
12605
+ function VerifyEmailOtpRegistrationRequestFromJSONTyped(json, ignoreDiscriminator) {
12606
+ if (json == null) {
12607
+ return json;
12608
+ }
12609
+ return {
12610
+ "email": json["email"],
12611
+ "code": json["code"],
12612
+ "name": json["name"] == null ? void 0 : json["name"],
12613
+ "metadata": json["metadata"] == null ? void 0 : json["metadata"]
12614
+ };
12615
+ }
12616
+ function VerifyEmailOtpRegistrationRequestToJSON(json) {
12617
+ return VerifyEmailOtpRegistrationRequestToJSONTyped(json, false);
12618
+ }
12619
+ function VerifyEmailOtpRegistrationRequestToJSONTyped(value, ignoreDiscriminator = false) {
12620
+ if (value == null) {
12621
+ return value;
12622
+ }
12623
+ return {
12624
+ "email": value["email"],
12625
+ "code": value["code"],
12626
+ "name": value["name"],
12627
+ "metadata": value["metadata"]
12628
+ };
12629
+ }
12630
+
12535
12631
  // src/src/models/VerifySmsConfigData.ts
12536
12632
  function instanceOfVerifySmsConfigData(value) {
12537
12633
  return true;
@@ -14416,6 +14512,184 @@ function WithdrawSubscriberConsentRequestToJSONTyped(value, ignoreDiscriminator
14416
14512
  };
14417
14513
  }
14418
14514
 
14515
+ // src/src/apis/AuthEmailOTPApi.ts
14516
+ var AuthEmailOTPApi = class extends BaseAPI {
14517
+ /**
14518
+ * Check if numeric email OTP authentication is available for this application. Requires a verified sending domain on the project.
14519
+ * Check email OTP availability
14520
+ */
14521
+ async checkEmailOtpAvailabilityRaw(initOverrides) {
14522
+ const queryParameters = {};
14523
+ const headerParameters = {};
14524
+ if (this.configuration && this.configuration.apiKey) {
14525
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
14526
+ }
14527
+ const response = await this.request({
14528
+ path: `/auth/email-otp/available`,
14529
+ method: "GET",
14530
+ headers: headerParameters,
14531
+ query: queryParameters
14532
+ }, initOverrides);
14533
+ return new JSONApiResponse(response, (jsonValue) => PhoneAuthAvailabilityResponseFromJSON(jsonValue));
14534
+ }
14535
+ /**
14536
+ * Check if numeric email OTP authentication is available for this application. Requires a verified sending domain on the project.
14537
+ * Check email OTP availability
14538
+ */
14539
+ async checkEmailOtpAvailability(initOverrides) {
14540
+ const response = await this.checkEmailOtpAvailabilityRaw(initOverrides);
14541
+ return await response.value();
14542
+ }
14543
+ /**
14544
+ * Send a numeric verification code to an existing user\'s email address for login.
14545
+ * Send email OTP for login
14546
+ */
14547
+ async sendEmailOtpLoginRaw(requestParameters, initOverrides) {
14548
+ if (requestParameters["sendEmailOtpRegistrationRequest"] == null) {
14549
+ throw new RequiredError(
14550
+ "sendEmailOtpRegistrationRequest",
14551
+ 'Required parameter "sendEmailOtpRegistrationRequest" was null or undefined when calling sendEmailOtpLogin().'
14552
+ );
14553
+ }
14554
+ const queryParameters = {};
14555
+ const headerParameters = {};
14556
+ headerParameters["Content-Type"] = "application/json";
14557
+ if (this.configuration && this.configuration.apiKey) {
14558
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
14559
+ }
14560
+ if (this.configuration && this.configuration.apiKey) {
14561
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
14562
+ }
14563
+ const response = await this.request({
14564
+ path: `/auth/email-otp/login/send`,
14565
+ method: "POST",
14566
+ headers: headerParameters,
14567
+ query: queryParameters,
14568
+ body: SendEmailOtpRegistrationRequestToJSON(requestParameters["sendEmailOtpRegistrationRequest"])
14569
+ }, initOverrides);
14570
+ return new JSONApiResponse(response, (jsonValue) => PhoneOtpSentResponseFromJSON(jsonValue));
14571
+ }
14572
+ /**
14573
+ * Send a numeric verification code to an existing user\'s email address for login.
14574
+ * Send email OTP for login
14575
+ */
14576
+ async sendEmailOtpLogin(sendEmailOtpRegistrationRequest, initOverrides) {
14577
+ const response = await this.sendEmailOtpLoginRaw({ sendEmailOtpRegistrationRequest }, initOverrides);
14578
+ return await response.value();
14579
+ }
14580
+ /**
14581
+ * Send a numeric verification code to an email address for new user registration.
14582
+ * Send email OTP for registration
14583
+ */
14584
+ async sendEmailOtpRegistrationRaw(requestParameters, initOverrides) {
14585
+ if (requestParameters["sendEmailOtpRegistrationRequest"] == null) {
14586
+ throw new RequiredError(
14587
+ "sendEmailOtpRegistrationRequest",
14588
+ 'Required parameter "sendEmailOtpRegistrationRequest" was null or undefined when calling sendEmailOtpRegistration().'
14589
+ );
14590
+ }
14591
+ const queryParameters = {};
14592
+ const headerParameters = {};
14593
+ headerParameters["Content-Type"] = "application/json";
14594
+ if (this.configuration && this.configuration.apiKey) {
14595
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
14596
+ }
14597
+ if (this.configuration && this.configuration.apiKey) {
14598
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
14599
+ }
14600
+ const response = await this.request({
14601
+ path: `/auth/email-otp/register/send`,
14602
+ method: "POST",
14603
+ headers: headerParameters,
14604
+ query: queryParameters,
14605
+ body: SendEmailOtpRegistrationRequestToJSON(requestParameters["sendEmailOtpRegistrationRequest"])
14606
+ }, initOverrides);
14607
+ return new JSONApiResponse(response, (jsonValue) => PhoneOtpSentResponseFromJSON(jsonValue));
14608
+ }
14609
+ /**
14610
+ * Send a numeric verification code to an email address for new user registration.
14611
+ * Send email OTP for registration
14612
+ */
14613
+ async sendEmailOtpRegistration(sendEmailOtpRegistrationRequest, initOverrides) {
14614
+ const response = await this.sendEmailOtpRegistrationRaw({ sendEmailOtpRegistrationRequest }, initOverrides);
14615
+ return await response.value();
14616
+ }
14617
+ /**
14618
+ * Verify the numeric code and login an existing user. If MFA is enabled, returns mfa_required with a challenge token.
14619
+ * Verify email OTP login
14620
+ */
14621
+ async verifyEmailOtpLoginRaw(requestParameters, initOverrides) {
14622
+ if (requestParameters["verifyEmailOtpLoginRequest"] == null) {
14623
+ throw new RequiredError(
14624
+ "verifyEmailOtpLoginRequest",
14625
+ 'Required parameter "verifyEmailOtpLoginRequest" was null or undefined when calling verifyEmailOtpLogin().'
14626
+ );
14627
+ }
14628
+ const queryParameters = {};
14629
+ const headerParameters = {};
14630
+ headerParameters["Content-Type"] = "application/json";
14631
+ if (this.configuration && this.configuration.apiKey) {
14632
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
14633
+ }
14634
+ if (this.configuration && this.configuration.apiKey) {
14635
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
14636
+ }
14637
+ const response = await this.request({
14638
+ path: `/auth/email-otp/login/verify`,
14639
+ method: "POST",
14640
+ headers: headerParameters,
14641
+ query: queryParameters,
14642
+ body: VerifyEmailOtpLoginRequestToJSON(requestParameters["verifyEmailOtpLoginRequest"])
14643
+ }, initOverrides);
14644
+ return new JSONApiResponse(response, (jsonValue) => AuthLoginResponseFromJSON(jsonValue));
14645
+ }
14646
+ /**
14647
+ * Verify the numeric code and login an existing user. If MFA is enabled, returns mfa_required with a challenge token.
14648
+ * Verify email OTP login
14649
+ */
14650
+ async verifyEmailOtpLogin(verifyEmailOtpLoginRequest, initOverrides) {
14651
+ const response = await this.verifyEmailOtpLoginRaw({ verifyEmailOtpLoginRequest }, initOverrides);
14652
+ return await response.value();
14653
+ }
14654
+ /**
14655
+ * Verify the numeric code and create a new user account with the email address.
14656
+ * Verify email OTP registration
14657
+ */
14658
+ async verifyEmailOtpRegistrationRaw(requestParameters, initOverrides) {
14659
+ if (requestParameters["verifyEmailOtpRegistrationRequest"] == null) {
14660
+ throw new RequiredError(
14661
+ "verifyEmailOtpRegistrationRequest",
14662
+ 'Required parameter "verifyEmailOtpRegistrationRequest" was null or undefined when calling verifyEmailOtpRegistration().'
14663
+ );
14664
+ }
14665
+ const queryParameters = {};
14666
+ const headerParameters = {};
14667
+ headerParameters["Content-Type"] = "application/json";
14668
+ if (this.configuration && this.configuration.apiKey) {
14669
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
14670
+ }
14671
+ if (this.configuration && this.configuration.apiKey) {
14672
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
14673
+ }
14674
+ const response = await this.request({
14675
+ path: `/auth/email-otp/register/verify`,
14676
+ method: "POST",
14677
+ headers: headerParameters,
14678
+ query: queryParameters,
14679
+ body: VerifyEmailOtpRegistrationRequestToJSON(requestParameters["verifyEmailOtpRegistrationRequest"])
14680
+ }, initOverrides);
14681
+ return new JSONApiResponse(response, (jsonValue) => AuthResultResponseFromJSON(jsonValue));
14682
+ }
14683
+ /**
14684
+ * Verify the numeric code and create a new user account with the email address.
14685
+ * Verify email OTP registration
14686
+ */
14687
+ async verifyEmailOtpRegistration(verifyEmailOtpRegistrationRequest, initOverrides) {
14688
+ const response = await this.verifyEmailOtpRegistrationRaw({ verifyEmailOtpRegistrationRequest }, initOverrides);
14689
+ return await response.value();
14690
+ }
14691
+ };
14692
+
14419
14693
  // src/src/apis/AuthEmailTemplatesApi.ts
14420
14694
  var AuthEmailTemplatesApi = class extends BaseAPI {
14421
14695
  /**
@@ -22909,6 +23183,7 @@ var Zyphr = class {
22909
23183
  // Sub-tenant CRUD + membership + the active-org switch flow.
22910
23184
  organizations: new AuthOrganizationsApi(config),
22911
23185
  phone: new AuthPhoneApi(config),
23186
+ emailOtp: new AuthEmailOTPApi(config),
22912
23187
  profile: new AuthUserProfileApi(config),
22913
23188
  webauthn: new AuthWebAuthnApi(config)
22914
23189
  };
@@ -22977,6 +23252,7 @@ export {
22977
23252
  ApiErrorMetaToJSONTyped,
22978
23253
  ApiErrorToJSON,
22979
23254
  ApiErrorToJSONTyped,
23255
+ AuthEmailOTPApi,
22980
23256
  AuthEmailTemplateDefaultFromJSON,
22981
23257
  AuthEmailTemplateDefaultFromJSONTyped,
22982
23258
  AuthEmailTemplateDefaultResponseFromJSON,
@@ -23994,6 +24270,10 @@ export {
23994
24270
  SendBatchSmsResponseFromJSONTyped,
23995
24271
  SendBatchSmsResponseToJSON,
23996
24272
  SendBatchSmsResponseToJSONTyped,
24273
+ SendEmailOtpRegistrationRequestFromJSON,
24274
+ SendEmailOtpRegistrationRequestFromJSONTyped,
24275
+ SendEmailOtpRegistrationRequestToJSON,
24276
+ SendEmailOtpRegistrationRequestToJSONTyped,
23997
24277
  SendEmailRequestFromJSON,
23998
24278
  SendEmailRequestFromJSONTyped,
23999
24279
  SendEmailRequestToJSON,
@@ -24462,6 +24742,14 @@ export {
24462
24742
  VerifyDomainResponseFromJSONTyped,
24463
24743
  VerifyDomainResponseToJSON,
24464
24744
  VerifyDomainResponseToJSONTyped,
24745
+ VerifyEmailOtpLoginRequestFromJSON,
24746
+ VerifyEmailOtpLoginRequestFromJSONTyped,
24747
+ VerifyEmailOtpLoginRequestToJSON,
24748
+ VerifyEmailOtpLoginRequestToJSONTyped,
24749
+ VerifyEmailOtpRegistrationRequestFromJSON,
24750
+ VerifyEmailOtpRegistrationRequestFromJSONTyped,
24751
+ VerifyEmailOtpRegistrationRequestToJSON,
24752
+ VerifyEmailOtpRegistrationRequestToJSONTyped,
24465
24753
  VerifySmsConfigDataFromJSON,
24466
24754
  VerifySmsConfigDataFromJSONTyped,
24467
24755
  VerifySmsConfigDataToJSON,
@@ -25016,6 +25304,7 @@ export {
25016
25304
  instanceOfSendBatchSmsData,
25017
25305
  instanceOfSendBatchSmsRequest,
25018
25306
  instanceOfSendBatchSmsResponse,
25307
+ instanceOfSendEmailOtpRegistrationRequest,
25019
25308
  instanceOfSendEmailRequest,
25020
25309
  instanceOfSendEmailResponse,
25021
25310
  instanceOfSendEmailResponseData,
@@ -25127,6 +25416,8 @@ export {
25127
25416
  instanceOfVerificationStatusResponseData,
25128
25417
  instanceOfVerifyDomainResponse,
25129
25418
  instanceOfVerifyDomainResponseData,
25419
+ instanceOfVerifyEmailOtpLoginRequest,
25420
+ instanceOfVerifyEmailOtpRegistrationRequest,
25130
25421
  instanceOfVerifySmsConfigData,
25131
25422
  instanceOfVerifySmsConfigResponse,
25132
25423
  instanceOfWaaSApplication,