@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 +307 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +288 -1
- package/dist/index.d.ts +288 -1
- package/dist/index.js +291 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/src/.openapi-generator/FILES +4 -0
- package/src/client.ts +3 -0
- package/src/src/apis/AuthEmailOTPApi.ts +371 -0
- package/src/src/apis/index.ts +1 -0
- 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 +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zyphr-dev/node-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.36",
|
|
4
4
|
"description": "Official Zyphr SDK for Node.js, React, and React Native",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsup",
|
|
29
29
|
"lint": "tsc --noEmit",
|
|
30
|
-
"test": "
|
|
30
|
+
"test": "vitest run",
|
|
31
31
|
"examples:typecheck": "tsc --noEmit -p examples/tsconfig.json",
|
|
32
32
|
"readme:check": "node ../scripts/verify-readme-methods.mjs",
|
|
33
33
|
"verify": "yarn lint && yarn examples:typecheck && yarn readme:check",
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"tsup": "^8.5.1",
|
|
38
|
-
"typescript": "^5.3.0"
|
|
38
|
+
"typescript": "^5.3.0",
|
|
39
|
+
"vitest": "^4.0.18"
|
|
39
40
|
},
|
|
40
41
|
"keywords": [
|
|
41
42
|
"zyphr",
|
|
@@ -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
|
|
@@ -281,6 +282,7 @@ src/models/SendBatchInAppResponse.ts
|
|
|
281
282
|
src/models/SendBatchSmsData.ts
|
|
282
283
|
src/models/SendBatchSmsRequest.ts
|
|
283
284
|
src/models/SendBatchSmsResponse.ts
|
|
285
|
+
src/models/SendEmailOtpRegistrationRequest.ts
|
|
284
286
|
src/models/SendEmailRequest.ts
|
|
285
287
|
src/models/SendEmailResponse.ts
|
|
286
288
|
src/models/SendEmailResponseData.ts
|
|
@@ -392,6 +394,8 @@ src/models/VerificationStatusResponse.ts
|
|
|
392
394
|
src/models/VerificationStatusResponseData.ts
|
|
393
395
|
src/models/VerifyDomainResponse.ts
|
|
394
396
|
src/models/VerifyDomainResponseData.ts
|
|
397
|
+
src/models/VerifyEmailOtpLoginRequest.ts
|
|
398
|
+
src/models/VerifyEmailOtpRegistrationRequest.ts
|
|
395
399
|
src/models/VerifySmsConfigData.ts
|
|
396
400
|
src/models/VerifySmsConfigResponse.ts
|
|
397
401
|
src/models/WaaSApplication.ts
|
package/src/client.ts
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import { Configuration } from './src/runtime.js';
|
|
17
17
|
import type { Middleware, ResponseContext } from './src/runtime.js';
|
|
18
18
|
import {
|
|
19
|
+
AuthEmailOTPApi,
|
|
19
20
|
AuthEmailVerificationApi,
|
|
20
21
|
AuthLoginApi,
|
|
21
22
|
AuthMFAApi,
|
|
@@ -108,6 +109,7 @@ export class Zyphr {
|
|
|
108
109
|
readonly oauth: AuthOAuthApi;
|
|
109
110
|
readonly organizations: AuthOrganizationsApi;
|
|
110
111
|
readonly phone: AuthPhoneApi;
|
|
112
|
+
readonly emailOtp: AuthEmailOTPApi;
|
|
111
113
|
readonly profile: AuthUserProfileApi;
|
|
112
114
|
readonly webauthn: AuthWebAuthnApi;
|
|
113
115
|
};
|
|
@@ -162,6 +164,7 @@ export class Zyphr {
|
|
|
162
164
|
// Sub-tenant CRUD + membership + the active-org switch flow.
|
|
163
165
|
organizations: new AuthOrganizationsApi(config),
|
|
164
166
|
phone: new AuthPhoneApi(config),
|
|
167
|
+
emailOtp: new AuthEmailOTPApi(config),
|
|
165
168
|
profile: new AuthUserProfileApi(config),
|
|
166
169
|
webauthn: new AuthWebAuthnApi(config),
|
|
167
170
|
};
|
|
@@ -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
|
+
PhoneAuthAvailabilityResponse,
|
|
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
|
+
PhoneAuthAvailabilityResponseFromJSON,
|
|
35
|
+
PhoneAuthAvailabilityResponseToJSON,
|
|
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<PhoneAuthAvailabilityResponse>>;
|
|
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<PhoneAuthAvailabilityResponse>;
|
|
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<PhoneAuthAvailabilityResponse>> {
|
|
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) => PhoneAuthAvailabilityResponseFromJSON(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<PhoneAuthAvailabilityResponse> {
|
|
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,66 @@
|
|
|
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
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @export
|
|
19
|
+
* @interface SendEmailOtpRegistrationRequest
|
|
20
|
+
*/
|
|
21
|
+
export interface SendEmailOtpRegistrationRequest {
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @type {string}
|
|
25
|
+
* @memberof SendEmailOtpRegistrationRequest
|
|
26
|
+
*/
|
|
27
|
+
email: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Check if a given object implements the SendEmailOtpRegistrationRequest interface.
|
|
32
|
+
*/
|
|
33
|
+
export function instanceOfSendEmailOtpRegistrationRequest(value: object): value is SendEmailOtpRegistrationRequest {
|
|
34
|
+
if (!('email' in value) || value['email'] === undefined) return false;
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function SendEmailOtpRegistrationRequestFromJSON(json: any): SendEmailOtpRegistrationRequest {
|
|
39
|
+
return SendEmailOtpRegistrationRequestFromJSONTyped(json, false);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function SendEmailOtpRegistrationRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): SendEmailOtpRegistrationRequest {
|
|
43
|
+
if (json == null) {
|
|
44
|
+
return json;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
|
|
48
|
+
'email': json['email'],
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function SendEmailOtpRegistrationRequestToJSON(json: any): SendEmailOtpRegistrationRequest {
|
|
53
|
+
return SendEmailOtpRegistrationRequestToJSONTyped(json, false);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function SendEmailOtpRegistrationRequestToJSONTyped(value?: SendEmailOtpRegistrationRequest | null, ignoreDiscriminator: boolean = false): any {
|
|
57
|
+
if (value == null) {
|
|
58
|
+
return value;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
|
|
63
|
+
'email': value['email'],
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @export
|
|
19
|
+
* @interface VerifyEmailOtpLoginRequest
|
|
20
|
+
*/
|
|
21
|
+
export interface VerifyEmailOtpLoginRequest {
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @type {string}
|
|
25
|
+
* @memberof VerifyEmailOtpLoginRequest
|
|
26
|
+
*/
|
|
27
|
+
email: string;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @type {string}
|
|
31
|
+
* @memberof VerifyEmailOtpLoginRequest
|
|
32
|
+
*/
|
|
33
|
+
code: string;
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @type {object}
|
|
37
|
+
* @memberof VerifyEmailOtpLoginRequest
|
|
38
|
+
*/
|
|
39
|
+
customClaims?: object;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Check if a given object implements the VerifyEmailOtpLoginRequest interface.
|
|
44
|
+
*/
|
|
45
|
+
export function instanceOfVerifyEmailOtpLoginRequest(value: object): value is VerifyEmailOtpLoginRequest {
|
|
46
|
+
if (!('email' in value) || value['email'] === undefined) return false;
|
|
47
|
+
if (!('code' in value) || value['code'] === undefined) return false;
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function VerifyEmailOtpLoginRequestFromJSON(json: any): VerifyEmailOtpLoginRequest {
|
|
52
|
+
return VerifyEmailOtpLoginRequestFromJSONTyped(json, false);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function VerifyEmailOtpLoginRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): VerifyEmailOtpLoginRequest {
|
|
56
|
+
if (json == null) {
|
|
57
|
+
return json;
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
|
|
61
|
+
'email': json['email'],
|
|
62
|
+
'code': json['code'],
|
|
63
|
+
'customClaims': json['custom_claims'] == null ? undefined : json['custom_claims'],
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function VerifyEmailOtpLoginRequestToJSON(json: any): VerifyEmailOtpLoginRequest {
|
|
68
|
+
return VerifyEmailOtpLoginRequestToJSONTyped(json, false);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function VerifyEmailOtpLoginRequestToJSONTyped(value?: VerifyEmailOtpLoginRequest | null, ignoreDiscriminator: boolean = false): any {
|
|
72
|
+
if (value == null) {
|
|
73
|
+
return value;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
|
|
78
|
+
'email': value['email'],
|
|
79
|
+
'code': value['code'],
|
|
80
|
+
'custom_claims': value['customClaims'],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|