@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.cjs CHANGED
@@ -52,6 +52,7 @@ __export(index_exports, {
52
52
  ApiErrorMetaToJSONTyped: () => ApiErrorMetaToJSONTyped,
53
53
  ApiErrorToJSON: () => ApiErrorToJSON,
54
54
  ApiErrorToJSONTyped: () => ApiErrorToJSONTyped,
55
+ AuthEmailOTPApi: () => AuthEmailOTPApi,
55
56
  AuthEmailTemplateDefaultFromJSON: () => AuthEmailTemplateDefaultFromJSON,
56
57
  AuthEmailTemplateDefaultFromJSONTyped: () => AuthEmailTemplateDefaultFromJSONTyped,
57
58
  AuthEmailTemplateDefaultResponseFromJSON: () => AuthEmailTemplateDefaultResponseFromJSON,
@@ -1069,6 +1070,10 @@ __export(index_exports, {
1069
1070
  SendBatchSmsResponseFromJSONTyped: () => SendBatchSmsResponseFromJSONTyped,
1070
1071
  SendBatchSmsResponseToJSON: () => SendBatchSmsResponseToJSON,
1071
1072
  SendBatchSmsResponseToJSONTyped: () => SendBatchSmsResponseToJSONTyped,
1073
+ SendEmailOtpRegistrationRequestFromJSON: () => SendEmailOtpRegistrationRequestFromJSON,
1074
+ SendEmailOtpRegistrationRequestFromJSONTyped: () => SendEmailOtpRegistrationRequestFromJSONTyped,
1075
+ SendEmailOtpRegistrationRequestToJSON: () => SendEmailOtpRegistrationRequestToJSON,
1076
+ SendEmailOtpRegistrationRequestToJSONTyped: () => SendEmailOtpRegistrationRequestToJSONTyped,
1072
1077
  SendEmailRequestFromJSON: () => SendEmailRequestFromJSON,
1073
1078
  SendEmailRequestFromJSONTyped: () => SendEmailRequestFromJSONTyped,
1074
1079
  SendEmailRequestToJSON: () => SendEmailRequestToJSON,
@@ -1537,6 +1542,14 @@ __export(index_exports, {
1537
1542
  VerifyDomainResponseFromJSONTyped: () => VerifyDomainResponseFromJSONTyped,
1538
1543
  VerifyDomainResponseToJSON: () => VerifyDomainResponseToJSON,
1539
1544
  VerifyDomainResponseToJSONTyped: () => VerifyDomainResponseToJSONTyped,
1545
+ VerifyEmailOtpLoginRequestFromJSON: () => VerifyEmailOtpLoginRequestFromJSON,
1546
+ VerifyEmailOtpLoginRequestFromJSONTyped: () => VerifyEmailOtpLoginRequestFromJSONTyped,
1547
+ VerifyEmailOtpLoginRequestToJSON: () => VerifyEmailOtpLoginRequestToJSON,
1548
+ VerifyEmailOtpLoginRequestToJSONTyped: () => VerifyEmailOtpLoginRequestToJSONTyped,
1549
+ VerifyEmailOtpRegistrationRequestFromJSON: () => VerifyEmailOtpRegistrationRequestFromJSON,
1550
+ VerifyEmailOtpRegistrationRequestFromJSONTyped: () => VerifyEmailOtpRegistrationRequestFromJSONTyped,
1551
+ VerifyEmailOtpRegistrationRequestToJSON: () => VerifyEmailOtpRegistrationRequestToJSON,
1552
+ VerifyEmailOtpRegistrationRequestToJSONTyped: () => VerifyEmailOtpRegistrationRequestToJSONTyped,
1540
1553
  VerifySmsConfigDataFromJSON: () => VerifySmsConfigDataFromJSON,
1541
1554
  VerifySmsConfigDataFromJSONTyped: () => VerifySmsConfigDataFromJSONTyped,
1542
1555
  VerifySmsConfigDataToJSON: () => VerifySmsConfigDataToJSON,
@@ -2091,6 +2104,7 @@ __export(index_exports, {
2091
2104
  instanceOfSendBatchSmsData: () => instanceOfSendBatchSmsData,
2092
2105
  instanceOfSendBatchSmsRequest: () => instanceOfSendBatchSmsRequest,
2093
2106
  instanceOfSendBatchSmsResponse: () => instanceOfSendBatchSmsResponse,
2107
+ instanceOfSendEmailOtpRegistrationRequest: () => instanceOfSendEmailOtpRegistrationRequest,
2094
2108
  instanceOfSendEmailRequest: () => instanceOfSendEmailRequest,
2095
2109
  instanceOfSendEmailResponse: () => instanceOfSendEmailResponse,
2096
2110
  instanceOfSendEmailResponseData: () => instanceOfSendEmailResponseData,
@@ -2202,6 +2216,8 @@ __export(index_exports, {
2202
2216
  instanceOfVerificationStatusResponseData: () => instanceOfVerificationStatusResponseData,
2203
2217
  instanceOfVerifyDomainResponse: () => instanceOfVerifyDomainResponse,
2204
2218
  instanceOfVerifyDomainResponseData: () => instanceOfVerifyDomainResponseData,
2219
+ instanceOfVerifyEmailOtpLoginRequest: () => instanceOfVerifyEmailOtpLoginRequest,
2220
+ instanceOfVerifyEmailOtpRegistrationRequest: () => instanceOfVerifyEmailOtpRegistrationRequest,
2205
2221
  instanceOfVerifySmsConfigData: () => instanceOfVerifySmsConfigData,
2206
2222
  instanceOfVerifySmsConfigResponse: () => instanceOfVerifySmsConfigResponse,
2207
2223
  instanceOfWaaSApplication: () => instanceOfWaaSApplication,
@@ -11279,6 +11295,34 @@ function SendBatchSmsResponseToJSONTyped(value, ignoreDiscriminator = false) {
11279
11295
  };
11280
11296
  }
11281
11297
 
11298
+ // src/src/models/SendEmailOtpRegistrationRequest.ts
11299
+ function instanceOfSendEmailOtpRegistrationRequest(value) {
11300
+ if (!("email" in value) || value["email"] === void 0) return false;
11301
+ return true;
11302
+ }
11303
+ function SendEmailOtpRegistrationRequestFromJSON(json) {
11304
+ return SendEmailOtpRegistrationRequestFromJSONTyped(json, false);
11305
+ }
11306
+ function SendEmailOtpRegistrationRequestFromJSONTyped(json, ignoreDiscriminator) {
11307
+ if (json == null) {
11308
+ return json;
11309
+ }
11310
+ return {
11311
+ "email": json["email"]
11312
+ };
11313
+ }
11314
+ function SendEmailOtpRegistrationRequestToJSON(json) {
11315
+ return SendEmailOtpRegistrationRequestToJSONTyped(json, false);
11316
+ }
11317
+ function SendEmailOtpRegistrationRequestToJSONTyped(value, ignoreDiscriminator = false) {
11318
+ if (value == null) {
11319
+ return value;
11320
+ }
11321
+ return {
11322
+ "email": value["email"]
11323
+ };
11324
+ }
11325
+
11282
11326
  // src/src/models/SendEmailRequest.ts
11283
11327
  function instanceOfSendEmailRequest(value) {
11284
11328
  if (!("to" in value) || value["to"] === void 0) return false;
@@ -14812,6 +14856,74 @@ function VerifyDomainResponseToJSONTyped(value, ignoreDiscriminator = false) {
14812
14856
  };
14813
14857
  }
14814
14858
 
14859
+ // src/src/models/VerifyEmailOtpLoginRequest.ts
14860
+ function instanceOfVerifyEmailOtpLoginRequest(value) {
14861
+ if (!("email" in value) || value["email"] === void 0) return false;
14862
+ if (!("code" in value) || value["code"] === void 0) return false;
14863
+ return true;
14864
+ }
14865
+ function VerifyEmailOtpLoginRequestFromJSON(json) {
14866
+ return VerifyEmailOtpLoginRequestFromJSONTyped(json, false);
14867
+ }
14868
+ function VerifyEmailOtpLoginRequestFromJSONTyped(json, ignoreDiscriminator) {
14869
+ if (json == null) {
14870
+ return json;
14871
+ }
14872
+ return {
14873
+ "email": json["email"],
14874
+ "code": json["code"],
14875
+ "customClaims": json["custom_claims"] == null ? void 0 : json["custom_claims"]
14876
+ };
14877
+ }
14878
+ function VerifyEmailOtpLoginRequestToJSON(json) {
14879
+ return VerifyEmailOtpLoginRequestToJSONTyped(json, false);
14880
+ }
14881
+ function VerifyEmailOtpLoginRequestToJSONTyped(value, ignoreDiscriminator = false) {
14882
+ if (value == null) {
14883
+ return value;
14884
+ }
14885
+ return {
14886
+ "email": value["email"],
14887
+ "code": value["code"],
14888
+ "custom_claims": value["customClaims"]
14889
+ };
14890
+ }
14891
+
14892
+ // src/src/models/VerifyEmailOtpRegistrationRequest.ts
14893
+ function instanceOfVerifyEmailOtpRegistrationRequest(value) {
14894
+ if (!("email" in value) || value["email"] === void 0) return false;
14895
+ if (!("code" in value) || value["code"] === void 0) return false;
14896
+ return true;
14897
+ }
14898
+ function VerifyEmailOtpRegistrationRequestFromJSON(json) {
14899
+ return VerifyEmailOtpRegistrationRequestFromJSONTyped(json, false);
14900
+ }
14901
+ function VerifyEmailOtpRegistrationRequestFromJSONTyped(json, ignoreDiscriminator) {
14902
+ if (json == null) {
14903
+ return json;
14904
+ }
14905
+ return {
14906
+ "email": json["email"],
14907
+ "code": json["code"],
14908
+ "name": json["name"] == null ? void 0 : json["name"],
14909
+ "metadata": json["metadata"] == null ? void 0 : json["metadata"]
14910
+ };
14911
+ }
14912
+ function VerifyEmailOtpRegistrationRequestToJSON(json) {
14913
+ return VerifyEmailOtpRegistrationRequestToJSONTyped(json, false);
14914
+ }
14915
+ function VerifyEmailOtpRegistrationRequestToJSONTyped(value, ignoreDiscriminator = false) {
14916
+ if (value == null) {
14917
+ return value;
14918
+ }
14919
+ return {
14920
+ "email": value["email"],
14921
+ "code": value["code"],
14922
+ "name": value["name"],
14923
+ "metadata": value["metadata"]
14924
+ };
14925
+ }
14926
+
14815
14927
  // src/src/models/VerifySmsConfigData.ts
14816
14928
  function instanceOfVerifySmsConfigData(value) {
14817
14929
  return true;
@@ -16696,6 +16808,184 @@ function WithdrawSubscriberConsentRequestToJSONTyped(value, ignoreDiscriminator
16696
16808
  };
16697
16809
  }
16698
16810
 
16811
+ // src/src/apis/AuthEmailOTPApi.ts
16812
+ var AuthEmailOTPApi = class extends BaseAPI {
16813
+ /**
16814
+ * Check if numeric email OTP authentication is available for this application. Requires a verified sending domain on the project.
16815
+ * Check email OTP availability
16816
+ */
16817
+ async checkEmailOtpAvailabilityRaw(initOverrides) {
16818
+ const queryParameters = {};
16819
+ const headerParameters = {};
16820
+ if (this.configuration && this.configuration.apiKey) {
16821
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
16822
+ }
16823
+ const response = await this.request({
16824
+ path: `/auth/email-otp/available`,
16825
+ method: "GET",
16826
+ headers: headerParameters,
16827
+ query: queryParameters
16828
+ }, initOverrides);
16829
+ return new JSONApiResponse(response, (jsonValue) => PhoneAuthAvailabilityResponseFromJSON(jsonValue));
16830
+ }
16831
+ /**
16832
+ * Check if numeric email OTP authentication is available for this application. Requires a verified sending domain on the project.
16833
+ * Check email OTP availability
16834
+ */
16835
+ async checkEmailOtpAvailability(initOverrides) {
16836
+ const response = await this.checkEmailOtpAvailabilityRaw(initOverrides);
16837
+ return await response.value();
16838
+ }
16839
+ /**
16840
+ * Send a numeric verification code to an existing user\'s email address for login.
16841
+ * Send email OTP for login
16842
+ */
16843
+ async sendEmailOtpLoginRaw(requestParameters, initOverrides) {
16844
+ if (requestParameters["sendEmailOtpRegistrationRequest"] == null) {
16845
+ throw new RequiredError(
16846
+ "sendEmailOtpRegistrationRequest",
16847
+ 'Required parameter "sendEmailOtpRegistrationRequest" was null or undefined when calling sendEmailOtpLogin().'
16848
+ );
16849
+ }
16850
+ const queryParameters = {};
16851
+ const headerParameters = {};
16852
+ headerParameters["Content-Type"] = "application/json";
16853
+ if (this.configuration && this.configuration.apiKey) {
16854
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
16855
+ }
16856
+ if (this.configuration && this.configuration.apiKey) {
16857
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
16858
+ }
16859
+ const response = await this.request({
16860
+ path: `/auth/email-otp/login/send`,
16861
+ method: "POST",
16862
+ headers: headerParameters,
16863
+ query: queryParameters,
16864
+ body: SendEmailOtpRegistrationRequestToJSON(requestParameters["sendEmailOtpRegistrationRequest"])
16865
+ }, initOverrides);
16866
+ return new JSONApiResponse(response, (jsonValue) => PhoneOtpSentResponseFromJSON(jsonValue));
16867
+ }
16868
+ /**
16869
+ * Send a numeric verification code to an existing user\'s email address for login.
16870
+ * Send email OTP for login
16871
+ */
16872
+ async sendEmailOtpLogin(sendEmailOtpRegistrationRequest, initOverrides) {
16873
+ const response = await this.sendEmailOtpLoginRaw({ sendEmailOtpRegistrationRequest }, initOverrides);
16874
+ return await response.value();
16875
+ }
16876
+ /**
16877
+ * Send a numeric verification code to an email address for new user registration.
16878
+ * Send email OTP for registration
16879
+ */
16880
+ async sendEmailOtpRegistrationRaw(requestParameters, initOverrides) {
16881
+ if (requestParameters["sendEmailOtpRegistrationRequest"] == null) {
16882
+ throw new RequiredError(
16883
+ "sendEmailOtpRegistrationRequest",
16884
+ 'Required parameter "sendEmailOtpRegistrationRequest" was null or undefined when calling sendEmailOtpRegistration().'
16885
+ );
16886
+ }
16887
+ const queryParameters = {};
16888
+ const headerParameters = {};
16889
+ headerParameters["Content-Type"] = "application/json";
16890
+ if (this.configuration && this.configuration.apiKey) {
16891
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
16892
+ }
16893
+ if (this.configuration && this.configuration.apiKey) {
16894
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
16895
+ }
16896
+ const response = await this.request({
16897
+ path: `/auth/email-otp/register/send`,
16898
+ method: "POST",
16899
+ headers: headerParameters,
16900
+ query: queryParameters,
16901
+ body: SendEmailOtpRegistrationRequestToJSON(requestParameters["sendEmailOtpRegistrationRequest"])
16902
+ }, initOverrides);
16903
+ return new JSONApiResponse(response, (jsonValue) => PhoneOtpSentResponseFromJSON(jsonValue));
16904
+ }
16905
+ /**
16906
+ * Send a numeric verification code to an email address for new user registration.
16907
+ * Send email OTP for registration
16908
+ */
16909
+ async sendEmailOtpRegistration(sendEmailOtpRegistrationRequest, initOverrides) {
16910
+ const response = await this.sendEmailOtpRegistrationRaw({ sendEmailOtpRegistrationRequest }, initOverrides);
16911
+ return await response.value();
16912
+ }
16913
+ /**
16914
+ * Verify the numeric code and login an existing user. If MFA is enabled, returns mfa_required with a challenge token.
16915
+ * Verify email OTP login
16916
+ */
16917
+ async verifyEmailOtpLoginRaw(requestParameters, initOverrides) {
16918
+ if (requestParameters["verifyEmailOtpLoginRequest"] == null) {
16919
+ throw new RequiredError(
16920
+ "verifyEmailOtpLoginRequest",
16921
+ 'Required parameter "verifyEmailOtpLoginRequest" was null or undefined when calling verifyEmailOtpLogin().'
16922
+ );
16923
+ }
16924
+ const queryParameters = {};
16925
+ const headerParameters = {};
16926
+ headerParameters["Content-Type"] = "application/json";
16927
+ if (this.configuration && this.configuration.apiKey) {
16928
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
16929
+ }
16930
+ if (this.configuration && this.configuration.apiKey) {
16931
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
16932
+ }
16933
+ const response = await this.request({
16934
+ path: `/auth/email-otp/login/verify`,
16935
+ method: "POST",
16936
+ headers: headerParameters,
16937
+ query: queryParameters,
16938
+ body: VerifyEmailOtpLoginRequestToJSON(requestParameters["verifyEmailOtpLoginRequest"])
16939
+ }, initOverrides);
16940
+ return new JSONApiResponse(response, (jsonValue) => AuthLoginResponseFromJSON(jsonValue));
16941
+ }
16942
+ /**
16943
+ * Verify the numeric code and login an existing user. If MFA is enabled, returns mfa_required with a challenge token.
16944
+ * Verify email OTP login
16945
+ */
16946
+ async verifyEmailOtpLogin(verifyEmailOtpLoginRequest, initOverrides) {
16947
+ const response = await this.verifyEmailOtpLoginRaw({ verifyEmailOtpLoginRequest }, initOverrides);
16948
+ return await response.value();
16949
+ }
16950
+ /**
16951
+ * Verify the numeric code and create a new user account with the email address.
16952
+ * Verify email OTP registration
16953
+ */
16954
+ async verifyEmailOtpRegistrationRaw(requestParameters, initOverrides) {
16955
+ if (requestParameters["verifyEmailOtpRegistrationRequest"] == null) {
16956
+ throw new RequiredError(
16957
+ "verifyEmailOtpRegistrationRequest",
16958
+ 'Required parameter "verifyEmailOtpRegistrationRequest" was null or undefined when calling verifyEmailOtpRegistration().'
16959
+ );
16960
+ }
16961
+ const queryParameters = {};
16962
+ const headerParameters = {};
16963
+ headerParameters["Content-Type"] = "application/json";
16964
+ if (this.configuration && this.configuration.apiKey) {
16965
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
16966
+ }
16967
+ if (this.configuration && this.configuration.apiKey) {
16968
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
16969
+ }
16970
+ const response = await this.request({
16971
+ path: `/auth/email-otp/register/verify`,
16972
+ method: "POST",
16973
+ headers: headerParameters,
16974
+ query: queryParameters,
16975
+ body: VerifyEmailOtpRegistrationRequestToJSON(requestParameters["verifyEmailOtpRegistrationRequest"])
16976
+ }, initOverrides);
16977
+ return new JSONApiResponse(response, (jsonValue) => AuthResultResponseFromJSON(jsonValue));
16978
+ }
16979
+ /**
16980
+ * Verify the numeric code and create a new user account with the email address.
16981
+ * Verify email OTP registration
16982
+ */
16983
+ async verifyEmailOtpRegistration(verifyEmailOtpRegistrationRequest, initOverrides) {
16984
+ const response = await this.verifyEmailOtpRegistrationRaw({ verifyEmailOtpRegistrationRequest }, initOverrides);
16985
+ return await response.value();
16986
+ }
16987
+ };
16988
+
16699
16989
  // src/src/apis/AuthEmailTemplatesApi.ts
16700
16990
  var AuthEmailTemplatesApi = class extends BaseAPI {
16701
16991
  /**
@@ -25189,6 +25479,7 @@ var Zyphr = class {
25189
25479
  // Sub-tenant CRUD + membership + the active-org switch flow.
25190
25480
  organizations: new AuthOrganizationsApi(config),
25191
25481
  phone: new AuthPhoneApi(config),
25482
+ emailOtp: new AuthEmailOTPApi(config),
25192
25483
  profile: new AuthUserProfileApi(config),
25193
25484
  webauthn: new AuthWebAuthnApi(config)
25194
25485
  };
@@ -25258,6 +25549,7 @@ var SDK_VERSION = "0.1.0";
25258
25549
  ApiErrorMetaToJSONTyped,
25259
25550
  ApiErrorToJSON,
25260
25551
  ApiErrorToJSONTyped,
25552
+ AuthEmailOTPApi,
25261
25553
  AuthEmailTemplateDefaultFromJSON,
25262
25554
  AuthEmailTemplateDefaultFromJSONTyped,
25263
25555
  AuthEmailTemplateDefaultResponseFromJSON,
@@ -26275,6 +26567,10 @@ var SDK_VERSION = "0.1.0";
26275
26567
  SendBatchSmsResponseFromJSONTyped,
26276
26568
  SendBatchSmsResponseToJSON,
26277
26569
  SendBatchSmsResponseToJSONTyped,
26570
+ SendEmailOtpRegistrationRequestFromJSON,
26571
+ SendEmailOtpRegistrationRequestFromJSONTyped,
26572
+ SendEmailOtpRegistrationRequestToJSON,
26573
+ SendEmailOtpRegistrationRequestToJSONTyped,
26278
26574
  SendEmailRequestFromJSON,
26279
26575
  SendEmailRequestFromJSONTyped,
26280
26576
  SendEmailRequestToJSON,
@@ -26743,6 +27039,14 @@ var SDK_VERSION = "0.1.0";
26743
27039
  VerifyDomainResponseFromJSONTyped,
26744
27040
  VerifyDomainResponseToJSON,
26745
27041
  VerifyDomainResponseToJSONTyped,
27042
+ VerifyEmailOtpLoginRequestFromJSON,
27043
+ VerifyEmailOtpLoginRequestFromJSONTyped,
27044
+ VerifyEmailOtpLoginRequestToJSON,
27045
+ VerifyEmailOtpLoginRequestToJSONTyped,
27046
+ VerifyEmailOtpRegistrationRequestFromJSON,
27047
+ VerifyEmailOtpRegistrationRequestFromJSONTyped,
27048
+ VerifyEmailOtpRegistrationRequestToJSON,
27049
+ VerifyEmailOtpRegistrationRequestToJSONTyped,
26746
27050
  VerifySmsConfigDataFromJSON,
26747
27051
  VerifySmsConfigDataFromJSONTyped,
26748
27052
  VerifySmsConfigDataToJSON,
@@ -27297,6 +27601,7 @@ var SDK_VERSION = "0.1.0";
27297
27601
  instanceOfSendBatchSmsData,
27298
27602
  instanceOfSendBatchSmsRequest,
27299
27603
  instanceOfSendBatchSmsResponse,
27604
+ instanceOfSendEmailOtpRegistrationRequest,
27300
27605
  instanceOfSendEmailRequest,
27301
27606
  instanceOfSendEmailResponse,
27302
27607
  instanceOfSendEmailResponseData,
@@ -27408,6 +27713,8 @@ var SDK_VERSION = "0.1.0";
27408
27713
  instanceOfVerificationStatusResponseData,
27409
27714
  instanceOfVerifyDomainResponse,
27410
27715
  instanceOfVerifyDomainResponseData,
27716
+ instanceOfVerifyEmailOtpLoginRequest,
27717
+ instanceOfVerifyEmailOtpRegistrationRequest,
27411
27718
  instanceOfVerifySmsConfigData,
27412
27719
  instanceOfVerifySmsConfigResponse,
27413
27720
  instanceOfWaaSApplication,