@zyphr-dev/node-sdk 0.1.34 → 0.1.35
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 +384 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +362 -42
- package/dist/index.d.ts +362 -42
- package/dist/index.js +358 -36
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/.openapi-generator/FILES +6 -1
- package/src/src/apis/AuthEmailOTPApi.ts +371 -0
- package/src/src/apis/index.ts +1 -0
- package/src/src/models/CheckEmailOtpAvailability200Response.ts +73 -0
- package/src/src/models/{PhoneAuthAvailabilityResponseData.ts → CheckEmailOtpAvailability200ResponseData.ts} +12 -12
- package/src/src/models/PhoneAuthAvailabilityResponse.ts +10 -10
- package/src/src/models/SendEmailOtpRegistrationRequest.ts +66 -0
- package/src/src/models/VerifyEmailOtpLoginRequest.ts +83 -0
- package/src/src/models/VerifyEmailOtpRegistrationRequest.ts +91 -0
- package/src/src/models/index.ts +5 -1
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
.npmignore
|
|
3
3
|
README.md
|
|
4
4
|
package.json
|
|
5
|
+
src/apis/AuthEmailOTPApi.ts
|
|
5
6
|
src/apis/AuthEmailTemplatesApi.ts
|
|
6
7
|
src/apis/AuthEmailVerificationApi.ts
|
|
7
8
|
src/apis/AuthLoginApi.ts
|
|
@@ -81,6 +82,8 @@ src/models/BulkUpsertAuthEmailTemplatesResponse.ts
|
|
|
81
82
|
src/models/Category.ts
|
|
82
83
|
src/models/CategoryListResponse.ts
|
|
83
84
|
src/models/CategoryResponse.ts
|
|
85
|
+
src/models/CheckEmailOtpAvailability200Response.ts
|
|
86
|
+
src/models/CheckEmailOtpAvailability200ResponseData.ts
|
|
84
87
|
src/models/ConfirmEmailVerificationRequest.ts
|
|
85
88
|
src/models/ConfirmEmailVerificationResponse.ts
|
|
86
89
|
src/models/ConfirmEmailVerificationResponseData.ts
|
|
@@ -231,7 +234,6 @@ src/models/PayloadTooLargeError.ts
|
|
|
231
234
|
src/models/PayloadTooLargeErrorError.ts
|
|
232
235
|
src/models/PayloadTooLargeErrorErrorDetails.ts
|
|
233
236
|
src/models/PhoneAuthAvailabilityResponse.ts
|
|
234
|
-
src/models/PhoneAuthAvailabilityResponseData.ts
|
|
235
237
|
src/models/PhoneLoginVerifyRequest.ts
|
|
236
238
|
src/models/PhoneOtpSendRequest.ts
|
|
237
239
|
src/models/PhoneOtpSentResponse.ts
|
|
@@ -281,6 +283,7 @@ src/models/SendBatchInAppResponse.ts
|
|
|
281
283
|
src/models/SendBatchSmsData.ts
|
|
282
284
|
src/models/SendBatchSmsRequest.ts
|
|
283
285
|
src/models/SendBatchSmsResponse.ts
|
|
286
|
+
src/models/SendEmailOtpRegistrationRequest.ts
|
|
284
287
|
src/models/SendEmailRequest.ts
|
|
285
288
|
src/models/SendEmailResponse.ts
|
|
286
289
|
src/models/SendEmailResponseData.ts
|
|
@@ -392,6 +395,8 @@ src/models/VerificationStatusResponse.ts
|
|
|
392
395
|
src/models/VerificationStatusResponseData.ts
|
|
393
396
|
src/models/VerifyDomainResponse.ts
|
|
394
397
|
src/models/VerifyDomainResponseData.ts
|
|
398
|
+
src/models/VerifyEmailOtpLoginRequest.ts
|
|
399
|
+
src/models/VerifyEmailOtpRegistrationRequest.ts
|
|
395
400
|
src/models/VerifySmsConfigData.ts
|
|
396
401
|
src/models/VerifySmsConfigResponse.ts
|
|
397
402
|
src/models/WaaSApplication.ts
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Zyphr API
|
|
5
|
+
* Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
* Contact: support@zyphr.dev
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
import * as runtime from '../runtime';
|
|
17
|
+
import type {
|
|
18
|
+
ApiError,
|
|
19
|
+
AuthLoginResponse,
|
|
20
|
+
AuthResultResponse,
|
|
21
|
+
CheckEmailOtpAvailability200Response,
|
|
22
|
+
PhoneOtpSentResponse,
|
|
23
|
+
SendEmailOtpRegistrationRequest,
|
|
24
|
+
VerifyEmailOtpLoginRequest,
|
|
25
|
+
VerifyEmailOtpRegistrationRequest,
|
|
26
|
+
} from '../models/index';
|
|
27
|
+
import {
|
|
28
|
+
ApiErrorFromJSON,
|
|
29
|
+
ApiErrorToJSON,
|
|
30
|
+
AuthLoginResponseFromJSON,
|
|
31
|
+
AuthLoginResponseToJSON,
|
|
32
|
+
AuthResultResponseFromJSON,
|
|
33
|
+
AuthResultResponseToJSON,
|
|
34
|
+
CheckEmailOtpAvailability200ResponseFromJSON,
|
|
35
|
+
CheckEmailOtpAvailability200ResponseToJSON,
|
|
36
|
+
PhoneOtpSentResponseFromJSON,
|
|
37
|
+
PhoneOtpSentResponseToJSON,
|
|
38
|
+
SendEmailOtpRegistrationRequestFromJSON,
|
|
39
|
+
SendEmailOtpRegistrationRequestToJSON,
|
|
40
|
+
VerifyEmailOtpLoginRequestFromJSON,
|
|
41
|
+
VerifyEmailOtpLoginRequestToJSON,
|
|
42
|
+
VerifyEmailOtpRegistrationRequestFromJSON,
|
|
43
|
+
VerifyEmailOtpRegistrationRequestToJSON,
|
|
44
|
+
} from '../models/index';
|
|
45
|
+
|
|
46
|
+
export interface AuthEmailOTPApiSendEmailOtpLoginRequest {
|
|
47
|
+
sendEmailOtpRegistrationRequest: SendEmailOtpRegistrationRequest;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface AuthEmailOTPApiSendEmailOtpRegistrationOperationRequest {
|
|
51
|
+
sendEmailOtpRegistrationRequest: SendEmailOtpRegistrationRequest;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface AuthEmailOTPApiVerifyEmailOtpLoginOperationRequest {
|
|
55
|
+
verifyEmailOtpLoginRequest: VerifyEmailOtpLoginRequest;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface AuthEmailOTPApiVerifyEmailOtpRegistrationOperationRequest {
|
|
59
|
+
verifyEmailOtpRegistrationRequest: VerifyEmailOtpRegistrationRequest;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* AuthEmailOTPApi - interface
|
|
64
|
+
*
|
|
65
|
+
* @export
|
|
66
|
+
* @interface AuthEmailOTPApiInterface
|
|
67
|
+
*/
|
|
68
|
+
export interface AuthEmailOTPApiInterface {
|
|
69
|
+
/**
|
|
70
|
+
* Check if numeric email OTP authentication is available for this application. Requires a verified sending domain on the project.
|
|
71
|
+
* @summary Check email OTP availability
|
|
72
|
+
* @param {*} [options] Override http request option.
|
|
73
|
+
* @throws {RequiredError}
|
|
74
|
+
* @memberof AuthEmailOTPApiInterface
|
|
75
|
+
*/
|
|
76
|
+
checkEmailOtpAvailabilityRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CheckEmailOtpAvailability200Response>>;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Check if numeric email OTP authentication is available for this application. Requires a verified sending domain on the project.
|
|
80
|
+
* Check email OTP availability
|
|
81
|
+
*/
|
|
82
|
+
checkEmailOtpAvailability(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CheckEmailOtpAvailability200Response>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Send a numeric verification code to an existing user\'s email address for login.
|
|
86
|
+
* @summary Send email OTP for login
|
|
87
|
+
* @param {SendEmailOtpRegistrationRequest} sendEmailOtpRegistrationRequest
|
|
88
|
+
* @param {*} [options] Override http request option.
|
|
89
|
+
* @throws {RequiredError}
|
|
90
|
+
* @memberof AuthEmailOTPApiInterface
|
|
91
|
+
*/
|
|
92
|
+
sendEmailOtpLoginRaw(requestParameters: AuthEmailOTPApiSendEmailOtpLoginRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PhoneOtpSentResponse>>;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Send a numeric verification code to an existing user\'s email address for login.
|
|
96
|
+
* Send email OTP for login
|
|
97
|
+
*/
|
|
98
|
+
sendEmailOtpLogin(sendEmailOtpRegistrationRequest: SendEmailOtpRegistrationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PhoneOtpSentResponse>;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Send a numeric verification code to an email address for new user registration.
|
|
102
|
+
* @summary Send email OTP for registration
|
|
103
|
+
* @param {SendEmailOtpRegistrationRequest} sendEmailOtpRegistrationRequest
|
|
104
|
+
* @param {*} [options] Override http request option.
|
|
105
|
+
* @throws {RequiredError}
|
|
106
|
+
* @memberof AuthEmailOTPApiInterface
|
|
107
|
+
*/
|
|
108
|
+
sendEmailOtpRegistrationRaw(requestParameters: AuthEmailOTPApiSendEmailOtpRegistrationOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PhoneOtpSentResponse>>;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Send a numeric verification code to an email address for new user registration.
|
|
112
|
+
* Send email OTP for registration
|
|
113
|
+
*/
|
|
114
|
+
sendEmailOtpRegistration(sendEmailOtpRegistrationRequest: SendEmailOtpRegistrationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PhoneOtpSentResponse>;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Verify the numeric code and login an existing user. If MFA is enabled, returns mfa_required with a challenge token.
|
|
118
|
+
* @summary Verify email OTP login
|
|
119
|
+
* @param {VerifyEmailOtpLoginRequest} verifyEmailOtpLoginRequest
|
|
120
|
+
* @param {*} [options] Override http request option.
|
|
121
|
+
* @throws {RequiredError}
|
|
122
|
+
* @memberof AuthEmailOTPApiInterface
|
|
123
|
+
*/
|
|
124
|
+
verifyEmailOtpLoginRaw(requestParameters: AuthEmailOTPApiVerifyEmailOtpLoginOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthLoginResponse>>;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Verify the numeric code and login an existing user. If MFA is enabled, returns mfa_required with a challenge token.
|
|
128
|
+
* Verify email OTP login
|
|
129
|
+
*/
|
|
130
|
+
verifyEmailOtpLogin(verifyEmailOtpLoginRequest: VerifyEmailOtpLoginRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthLoginResponse>;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Verify the numeric code and create a new user account with the email address.
|
|
134
|
+
* @summary Verify email OTP registration
|
|
135
|
+
* @param {VerifyEmailOtpRegistrationRequest} verifyEmailOtpRegistrationRequest
|
|
136
|
+
* @param {*} [options] Override http request option.
|
|
137
|
+
* @throws {RequiredError}
|
|
138
|
+
* @memberof AuthEmailOTPApiInterface
|
|
139
|
+
*/
|
|
140
|
+
verifyEmailOtpRegistrationRaw(requestParameters: AuthEmailOTPApiVerifyEmailOtpRegistrationOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthResultResponse>>;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Verify the numeric code and create a new user account with the email address.
|
|
144
|
+
* Verify email OTP registration
|
|
145
|
+
*/
|
|
146
|
+
verifyEmailOtpRegistration(verifyEmailOtpRegistrationRequest: VerifyEmailOtpRegistrationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthResultResponse>;
|
|
147
|
+
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
*
|
|
152
|
+
*/
|
|
153
|
+
export class AuthEmailOTPApi extends runtime.BaseAPI implements AuthEmailOTPApiInterface {
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Check if numeric email OTP authentication is available for this application. Requires a verified sending domain on the project.
|
|
157
|
+
* Check email OTP availability
|
|
158
|
+
*/
|
|
159
|
+
async checkEmailOtpAvailabilityRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CheckEmailOtpAvailability200Response>> {
|
|
160
|
+
const queryParameters: any = {};
|
|
161
|
+
|
|
162
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
163
|
+
|
|
164
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
165
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const response = await this.request({
|
|
169
|
+
path: `/auth/email-otp/available`,
|
|
170
|
+
method: 'GET',
|
|
171
|
+
headers: headerParameters,
|
|
172
|
+
query: queryParameters,
|
|
173
|
+
}, initOverrides);
|
|
174
|
+
|
|
175
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => CheckEmailOtpAvailability200ResponseFromJSON(jsonValue));
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Check if numeric email OTP authentication is available for this application. Requires a verified sending domain on the project.
|
|
180
|
+
* Check email OTP availability
|
|
181
|
+
*/
|
|
182
|
+
async checkEmailOtpAvailability(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CheckEmailOtpAvailability200Response> {
|
|
183
|
+
const response = await this.checkEmailOtpAvailabilityRaw(initOverrides);
|
|
184
|
+
return await response.value();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Send a numeric verification code to an existing user\'s email address for login.
|
|
189
|
+
* Send email OTP for login
|
|
190
|
+
*/
|
|
191
|
+
async sendEmailOtpLoginRaw(requestParameters: AuthEmailOTPApiSendEmailOtpLoginRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PhoneOtpSentResponse>> {
|
|
192
|
+
if (requestParameters['sendEmailOtpRegistrationRequest'] == null) {
|
|
193
|
+
throw new runtime.RequiredError(
|
|
194
|
+
'sendEmailOtpRegistrationRequest',
|
|
195
|
+
'Required parameter "sendEmailOtpRegistrationRequest" was null or undefined when calling sendEmailOtpLogin().'
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const queryParameters: any = {};
|
|
200
|
+
|
|
201
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
202
|
+
|
|
203
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
204
|
+
|
|
205
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
206
|
+
headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret"); // ApplicationSecret authentication
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
210
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const response = await this.request({
|
|
214
|
+
path: `/auth/email-otp/login/send`,
|
|
215
|
+
method: 'POST',
|
|
216
|
+
headers: headerParameters,
|
|
217
|
+
query: queryParameters,
|
|
218
|
+
body: SendEmailOtpRegistrationRequestToJSON(requestParameters['sendEmailOtpRegistrationRequest']),
|
|
219
|
+
}, initOverrides);
|
|
220
|
+
|
|
221
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => PhoneOtpSentResponseFromJSON(jsonValue));
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Send a numeric verification code to an existing user\'s email address for login.
|
|
226
|
+
* Send email OTP for login
|
|
227
|
+
*/
|
|
228
|
+
async sendEmailOtpLogin(sendEmailOtpRegistrationRequest: SendEmailOtpRegistrationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PhoneOtpSentResponse> {
|
|
229
|
+
const response = await this.sendEmailOtpLoginRaw({ sendEmailOtpRegistrationRequest: sendEmailOtpRegistrationRequest }, initOverrides);
|
|
230
|
+
return await response.value();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Send a numeric verification code to an email address for new user registration.
|
|
235
|
+
* Send email OTP for registration
|
|
236
|
+
*/
|
|
237
|
+
async sendEmailOtpRegistrationRaw(requestParameters: AuthEmailOTPApiSendEmailOtpRegistrationOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PhoneOtpSentResponse>> {
|
|
238
|
+
if (requestParameters['sendEmailOtpRegistrationRequest'] == null) {
|
|
239
|
+
throw new runtime.RequiredError(
|
|
240
|
+
'sendEmailOtpRegistrationRequest',
|
|
241
|
+
'Required parameter "sendEmailOtpRegistrationRequest" was null or undefined when calling sendEmailOtpRegistration().'
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
const queryParameters: any = {};
|
|
246
|
+
|
|
247
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
248
|
+
|
|
249
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
250
|
+
|
|
251
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
252
|
+
headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret"); // ApplicationSecret authentication
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
256
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const response = await this.request({
|
|
260
|
+
path: `/auth/email-otp/register/send`,
|
|
261
|
+
method: 'POST',
|
|
262
|
+
headers: headerParameters,
|
|
263
|
+
query: queryParameters,
|
|
264
|
+
body: SendEmailOtpRegistrationRequestToJSON(requestParameters['sendEmailOtpRegistrationRequest']),
|
|
265
|
+
}, initOverrides);
|
|
266
|
+
|
|
267
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => PhoneOtpSentResponseFromJSON(jsonValue));
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Send a numeric verification code to an email address for new user registration.
|
|
272
|
+
* Send email OTP for registration
|
|
273
|
+
*/
|
|
274
|
+
async sendEmailOtpRegistration(sendEmailOtpRegistrationRequest: SendEmailOtpRegistrationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PhoneOtpSentResponse> {
|
|
275
|
+
const response = await this.sendEmailOtpRegistrationRaw({ sendEmailOtpRegistrationRequest: sendEmailOtpRegistrationRequest }, initOverrides);
|
|
276
|
+
return await response.value();
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Verify the numeric code and login an existing user. If MFA is enabled, returns mfa_required with a challenge token.
|
|
281
|
+
* Verify email OTP login
|
|
282
|
+
*/
|
|
283
|
+
async verifyEmailOtpLoginRaw(requestParameters: AuthEmailOTPApiVerifyEmailOtpLoginOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthLoginResponse>> {
|
|
284
|
+
if (requestParameters['verifyEmailOtpLoginRequest'] == null) {
|
|
285
|
+
throw new runtime.RequiredError(
|
|
286
|
+
'verifyEmailOtpLoginRequest',
|
|
287
|
+
'Required parameter "verifyEmailOtpLoginRequest" was null or undefined when calling verifyEmailOtpLogin().'
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const queryParameters: any = {};
|
|
292
|
+
|
|
293
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
294
|
+
|
|
295
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
296
|
+
|
|
297
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
298
|
+
headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret"); // ApplicationSecret authentication
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
302
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const response = await this.request({
|
|
306
|
+
path: `/auth/email-otp/login/verify`,
|
|
307
|
+
method: 'POST',
|
|
308
|
+
headers: headerParameters,
|
|
309
|
+
query: queryParameters,
|
|
310
|
+
body: VerifyEmailOtpLoginRequestToJSON(requestParameters['verifyEmailOtpLoginRequest']),
|
|
311
|
+
}, initOverrides);
|
|
312
|
+
|
|
313
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => AuthLoginResponseFromJSON(jsonValue));
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Verify the numeric code and login an existing user. If MFA is enabled, returns mfa_required with a challenge token.
|
|
318
|
+
* Verify email OTP login
|
|
319
|
+
*/
|
|
320
|
+
async verifyEmailOtpLogin(verifyEmailOtpLoginRequest: VerifyEmailOtpLoginRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthLoginResponse> {
|
|
321
|
+
const response = await this.verifyEmailOtpLoginRaw({ verifyEmailOtpLoginRequest: verifyEmailOtpLoginRequest }, initOverrides);
|
|
322
|
+
return await response.value();
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Verify the numeric code and create a new user account with the email address.
|
|
327
|
+
* Verify email OTP registration
|
|
328
|
+
*/
|
|
329
|
+
async verifyEmailOtpRegistrationRaw(requestParameters: AuthEmailOTPApiVerifyEmailOtpRegistrationOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthResultResponse>> {
|
|
330
|
+
if (requestParameters['verifyEmailOtpRegistrationRequest'] == null) {
|
|
331
|
+
throw new runtime.RequiredError(
|
|
332
|
+
'verifyEmailOtpRegistrationRequest',
|
|
333
|
+
'Required parameter "verifyEmailOtpRegistrationRequest" was null or undefined when calling verifyEmailOtpRegistration().'
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
const queryParameters: any = {};
|
|
338
|
+
|
|
339
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
340
|
+
|
|
341
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
342
|
+
|
|
343
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
344
|
+
headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret"); // ApplicationSecret authentication
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
348
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
const response = await this.request({
|
|
352
|
+
path: `/auth/email-otp/register/verify`,
|
|
353
|
+
method: 'POST',
|
|
354
|
+
headers: headerParameters,
|
|
355
|
+
query: queryParameters,
|
|
356
|
+
body: VerifyEmailOtpRegistrationRequestToJSON(requestParameters['verifyEmailOtpRegistrationRequest']),
|
|
357
|
+
}, initOverrides);
|
|
358
|
+
|
|
359
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => AuthResultResponseFromJSON(jsonValue));
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Verify the numeric code and create a new user account with the email address.
|
|
364
|
+
* Verify email OTP registration
|
|
365
|
+
*/
|
|
366
|
+
async verifyEmailOtpRegistration(verifyEmailOtpRegistrationRequest: VerifyEmailOtpRegistrationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthResultResponse> {
|
|
367
|
+
const response = await this.verifyEmailOtpRegistrationRaw({ verifyEmailOtpRegistrationRequest: verifyEmailOtpRegistrationRequest }, initOverrides);
|
|
368
|
+
return await response.value();
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
}
|
package/src/src/apis/index.ts
CHANGED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Zyphr API
|
|
5
|
+
* Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
* Contact: support@zyphr.dev
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { mapValues } from '../runtime';
|
|
16
|
+
import type { CheckEmailOtpAvailability200ResponseData } from './CheckEmailOtpAvailability200ResponseData';
|
|
17
|
+
import {
|
|
18
|
+
CheckEmailOtpAvailability200ResponseDataFromJSON,
|
|
19
|
+
CheckEmailOtpAvailability200ResponseDataFromJSONTyped,
|
|
20
|
+
CheckEmailOtpAvailability200ResponseDataToJSON,
|
|
21
|
+
CheckEmailOtpAvailability200ResponseDataToJSONTyped,
|
|
22
|
+
} from './CheckEmailOtpAvailability200ResponseData';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @export
|
|
27
|
+
* @interface CheckEmailOtpAvailability200Response
|
|
28
|
+
*/
|
|
29
|
+
export interface CheckEmailOtpAvailability200Response {
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @type {CheckEmailOtpAvailability200ResponseData}
|
|
33
|
+
* @memberof CheckEmailOtpAvailability200Response
|
|
34
|
+
*/
|
|
35
|
+
data?: CheckEmailOtpAvailability200ResponseData;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Check if a given object implements the CheckEmailOtpAvailability200Response interface.
|
|
40
|
+
*/
|
|
41
|
+
export function instanceOfCheckEmailOtpAvailability200Response(value: object): value is CheckEmailOtpAvailability200Response {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function CheckEmailOtpAvailability200ResponseFromJSON(json: any): CheckEmailOtpAvailability200Response {
|
|
46
|
+
return CheckEmailOtpAvailability200ResponseFromJSONTyped(json, false);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function CheckEmailOtpAvailability200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): CheckEmailOtpAvailability200Response {
|
|
50
|
+
if (json == null) {
|
|
51
|
+
return json;
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
|
|
55
|
+
'data': json['data'] == null ? undefined : CheckEmailOtpAvailability200ResponseDataFromJSON(json['data']),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function CheckEmailOtpAvailability200ResponseToJSON(json: any): CheckEmailOtpAvailability200Response {
|
|
60
|
+
return CheckEmailOtpAvailability200ResponseToJSONTyped(json, false);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function CheckEmailOtpAvailability200ResponseToJSONTyped(value?: CheckEmailOtpAvailability200Response | null, ignoreDiscriminator: boolean = false): any {
|
|
64
|
+
if (value == null) {
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
|
|
70
|
+
'data': CheckEmailOtpAvailability200ResponseDataToJSON(value['data']),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
@@ -16,35 +16,35 @@ import { mapValues } from '../runtime';
|
|
|
16
16
|
/**
|
|
17
17
|
*
|
|
18
18
|
* @export
|
|
19
|
-
* @interface
|
|
19
|
+
* @interface CheckEmailOtpAvailability200ResponseData
|
|
20
20
|
*/
|
|
21
|
-
export interface
|
|
21
|
+
export interface CheckEmailOtpAvailability200ResponseData {
|
|
22
22
|
/**
|
|
23
23
|
*
|
|
24
24
|
* @type {boolean}
|
|
25
|
-
* @memberof
|
|
25
|
+
* @memberof CheckEmailOtpAvailability200ResponseData
|
|
26
26
|
*/
|
|
27
27
|
available?: boolean;
|
|
28
28
|
/**
|
|
29
29
|
*
|
|
30
30
|
* @type {string}
|
|
31
|
-
* @memberof
|
|
31
|
+
* @memberof CheckEmailOtpAvailability200ResponseData
|
|
32
32
|
*/
|
|
33
33
|
message?: string;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
* Check if a given object implements the
|
|
37
|
+
* Check if a given object implements the CheckEmailOtpAvailability200ResponseData interface.
|
|
38
38
|
*/
|
|
39
|
-
export function
|
|
39
|
+
export function instanceOfCheckEmailOtpAvailability200ResponseData(value: object): value is CheckEmailOtpAvailability200ResponseData {
|
|
40
40
|
return true;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export function
|
|
44
|
-
return
|
|
43
|
+
export function CheckEmailOtpAvailability200ResponseDataFromJSON(json: any): CheckEmailOtpAvailability200ResponseData {
|
|
44
|
+
return CheckEmailOtpAvailability200ResponseDataFromJSONTyped(json, false);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export function
|
|
47
|
+
export function CheckEmailOtpAvailability200ResponseDataFromJSONTyped(json: any, ignoreDiscriminator: boolean): CheckEmailOtpAvailability200ResponseData {
|
|
48
48
|
if (json == null) {
|
|
49
49
|
return json;
|
|
50
50
|
}
|
|
@@ -55,11 +55,11 @@ export function PhoneAuthAvailabilityResponseDataFromJSONTyped(json: any, ignore
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
export function
|
|
59
|
-
return
|
|
58
|
+
export function CheckEmailOtpAvailability200ResponseDataToJSON(json: any): CheckEmailOtpAvailability200ResponseData {
|
|
59
|
+
return CheckEmailOtpAvailability200ResponseDataToJSONTyped(json, false);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
export function
|
|
62
|
+
export function CheckEmailOtpAvailability200ResponseDataToJSONTyped(value?: CheckEmailOtpAvailability200ResponseData | null, ignoreDiscriminator: boolean = false): any {
|
|
63
63
|
if (value == null) {
|
|
64
64
|
return value;
|
|
65
65
|
}
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { mapValues } from '../runtime';
|
|
16
|
-
import type {
|
|
16
|
+
import type { CheckEmailOtpAvailability200ResponseData } from './CheckEmailOtpAvailability200ResponseData';
|
|
17
17
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} from './
|
|
18
|
+
CheckEmailOtpAvailability200ResponseDataFromJSON,
|
|
19
|
+
CheckEmailOtpAvailability200ResponseDataFromJSONTyped,
|
|
20
|
+
CheckEmailOtpAvailability200ResponseDataToJSON,
|
|
21
|
+
CheckEmailOtpAvailability200ResponseDataToJSONTyped,
|
|
22
|
+
} from './CheckEmailOtpAvailability200ResponseData';
|
|
23
23
|
import type { RequestMeta } from './RequestMeta';
|
|
24
24
|
import {
|
|
25
25
|
RequestMetaFromJSON,
|
|
@@ -36,10 +36,10 @@ import {
|
|
|
36
36
|
export interface PhoneAuthAvailabilityResponse {
|
|
37
37
|
/**
|
|
38
38
|
*
|
|
39
|
-
* @type {
|
|
39
|
+
* @type {CheckEmailOtpAvailability200ResponseData}
|
|
40
40
|
* @memberof PhoneAuthAvailabilityResponse
|
|
41
41
|
*/
|
|
42
|
-
data?:
|
|
42
|
+
data?: CheckEmailOtpAvailability200ResponseData;
|
|
43
43
|
/**
|
|
44
44
|
*
|
|
45
45
|
* @type {RequestMeta}
|
|
@@ -65,7 +65,7 @@ export function PhoneAuthAvailabilityResponseFromJSONTyped(json: any, ignoreDisc
|
|
|
65
65
|
}
|
|
66
66
|
return {
|
|
67
67
|
|
|
68
|
-
'data': json['data'] == null ? undefined :
|
|
68
|
+
'data': json['data'] == null ? undefined : CheckEmailOtpAvailability200ResponseDataFromJSON(json['data']),
|
|
69
69
|
'meta': json['meta'] == null ? undefined : RequestMetaFromJSON(json['meta']),
|
|
70
70
|
};
|
|
71
71
|
}
|
|
@@ -81,7 +81,7 @@ export function PhoneAuthAvailabilityResponseToJSONTyped(value?: PhoneAuthAvaila
|
|
|
81
81
|
|
|
82
82
|
return {
|
|
83
83
|
|
|
84
|
-
'data':
|
|
84
|
+
'data': CheckEmailOtpAvailability200ResponseDataToJSON(value['data']),
|
|
85
85
|
'meta': RequestMetaToJSON(value['meta']),
|
|
86
86
|
};
|
|
87
87
|
}
|