@zyphr-dev/node-sdk 0.1.24 → 0.1.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyphr-dev/node-sdk",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
4
4
  "description": "Official Zyphr SDK for Node.js, React, and React Native",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -83,6 +83,11 @@ src/models/ConsentRecordResponseData.ts
83
83
  src/models/ConsentStatus.ts
84
84
  src/models/ConsentStatusResponse.ts
85
85
  src/models/ConsentWithdrawResponse.ts
86
+ src/models/ConvertAnonymousUserRequest.ts
87
+ src/models/ConvertAnonymousUserRequestOneOf.ts
88
+ src/models/ConvertAnonymousUserRequestOneOf1.ts
89
+ src/models/ConvertAnonymousUserRequestOneOf1AppleUser.ts
90
+ src/models/ConvertAnonymousUserRequestOneOf1AppleUserName.ts
86
91
  src/models/CreateCategoryRequest.ts
87
92
  src/models/CreateSubscriberRequest.ts
88
93
  src/models/CreateTemplateRequest.ts
@@ -189,6 +194,9 @@ src/models/PaginationMeta.ts
189
194
  src/models/PasswordRequirements.ts
190
195
  src/models/PasswordRequirementsResponse.ts
191
196
  src/models/PasswordRequirementsResponseData.ts
197
+ src/models/PayloadTooLargeError.ts
198
+ src/models/PayloadTooLargeErrorError.ts
199
+ src/models/PayloadTooLargeErrorErrorDetails.ts
192
200
  src/models/PhoneAuthAvailabilityResponse.ts
193
201
  src/models/PhoneAuthAvailabilityResponseData.ts
194
202
  src/models/PhoneLoginVerifyRequest.ts
@@ -270,6 +278,7 @@ src/models/SessionListResponseData.ts
270
278
  src/models/SessionListResponseDataSessionInfo.ts
271
279
  src/models/SetPreferencesRequest.ts
272
280
  src/models/SetPreferencesRequestPreferencesInner.ts
281
+ src/models/SignInAnonymouslyRequest.ts
273
282
  src/models/SlackMessage.ts
274
283
  src/models/SlackMessageListResponse.ts
275
284
  src/models/SlackMessageListResponseMeta.ts
package/src/errors.ts CHANGED
@@ -82,6 +82,35 @@ export class ZyphrNotFoundError extends ZyphrError {
82
82
  }
83
83
  }
84
84
 
85
+ /**
86
+ * Thrown when the API returns a 413 payload-too-large error because the
87
+ * request body exceeds the maximum allowed size (currently 10 MB).
88
+ *
89
+ * Use `limitBytes` to read the server-side cap and `receivedBytes` to read
90
+ * the size of the rejected payload, both surfaced from `details` so callers
91
+ * don't have to reach into the untyped error body.
92
+ *
93
+ * @see https://zyphr.dev/resources/api-limits
94
+ */
95
+ export class ZyphrPayloadTooLargeError extends ZyphrError {
96
+ constructor(message: string, details?: Record<string, unknown>, requestId?: string) {
97
+ super({ message, status: 413, code: 'payload_too_large', details, requestId });
98
+ this.name = 'ZyphrPayloadTooLargeError';
99
+ }
100
+
101
+ /** Maximum allowed request body size in bytes (server-enforced). */
102
+ get limitBytes(): number | undefined {
103
+ const value = this.details?.limit_bytes;
104
+ return typeof value === 'number' ? value : undefined;
105
+ }
106
+
107
+ /** Size of the rejected request body in bytes, as measured by the server. */
108
+ get receivedBytes(): number | undefined {
109
+ const value = this.details?.received_bytes;
110
+ return typeof value === 'number' ? value : undefined;
111
+ }
112
+ }
113
+
85
114
  /**
86
115
  * Thrown when a Zyphr webhook signature fails verification.
87
116
  *
@@ -129,6 +158,8 @@ export async function parseErrorResponse(response: Response): Promise<ZyphrError
129
158
  return new ZyphrAuthenticationError(message);
130
159
  case 404:
131
160
  return new ZyphrNotFoundError(message);
161
+ case 413:
162
+ return new ZyphrPayloadTooLargeError(message, details, requestId);
132
163
  case 429: {
133
164
  const retryAfterHeader = response.headers.get('Retry-After');
134
165
  const retryAfter = retryAfterHeader ? parseInt(retryAfterHeader, 10) : undefined;
@@ -28,6 +28,7 @@ import type {
28
28
  AuthEmailType,
29
29
  BulkUpsertAuthEmailTemplatesRequest,
30
30
  BulkUpsertAuthEmailTemplatesResponse,
31
+ PayloadTooLargeError,
31
32
  UpsertAuthEmailTemplateRequest,
32
33
  } from '../models/index';
33
34
  import {
@@ -57,6 +58,8 @@ import {
57
58
  BulkUpsertAuthEmailTemplatesRequestToJSON,
58
59
  BulkUpsertAuthEmailTemplatesResponseFromJSON,
59
60
  BulkUpsertAuthEmailTemplatesResponseToJSON,
61
+ PayloadTooLargeErrorFromJSON,
62
+ PayloadTooLargeErrorToJSON,
60
63
  UpsertAuthEmailTemplateRequestFromJSON,
61
64
  UpsertAuthEmailTemplateRequestToJSON,
62
65
  } from '../models/index';
@@ -17,21 +17,35 @@ import * as runtime from '../runtime';
17
17
  import type {
18
18
  ApiError,
19
19
  AuthResultResponse,
20
+ ConvertAnonymousUserRequest,
20
21
  RegisterRequest,
22
+ SignInAnonymouslyRequest,
21
23
  } from '../models/index';
22
24
  import {
23
25
  ApiErrorFromJSON,
24
26
  ApiErrorToJSON,
25
27
  AuthResultResponseFromJSON,
26
28
  AuthResultResponseToJSON,
29
+ ConvertAnonymousUserRequestFromJSON,
30
+ ConvertAnonymousUserRequestToJSON,
27
31
  RegisterRequestFromJSON,
28
32
  RegisterRequestToJSON,
33
+ SignInAnonymouslyRequestFromJSON,
34
+ SignInAnonymouslyRequestToJSON,
29
35
  } from '../models/index';
30
36
 
37
+ export interface AuthRegistrationApiConvertAnonymousUserOperationRequest {
38
+ convertAnonymousUserRequest: ConvertAnonymousUserRequest;
39
+ }
40
+
31
41
  export interface AuthRegistrationApiRegisterEndUserRequest {
32
42
  registerRequest: RegisterRequest;
33
43
  }
34
44
 
45
+ export interface AuthRegistrationApiSignInAnonymouslyOperationRequest {
46
+ signInAnonymouslyRequest: SignInAnonymouslyRequest;
47
+ }
48
+
35
49
  /**
36
50
  * AuthRegistrationApi - interface
37
51
  *
@@ -39,6 +53,22 @@ export interface AuthRegistrationApiRegisterEndUserRequest {
39
53
  * @interface AuthRegistrationApiInterface
40
54
  */
41
55
  export interface AuthRegistrationApiInterface {
56
+ /**
57
+ * Upgrade the calling anonymous user to a full email+password account in place. The end_user.id is preserved, so customer-domain tables with foreign keys to end_users.id need no migration on conversion. All prior sessions for the user (including the anonymous token used to make this call) are revoked. A fresh token pair is returned in the response body. The conversion is the moment the user becomes billable -- MAU is tracked from this point forward.
58
+ * @summary Convert anonymous account to a full account
59
+ * @param {ConvertAnonymousUserRequest} convertAnonymousUserRequest
60
+ * @param {*} [options] Override http request option.
61
+ * @throws {RequiredError}
62
+ * @memberof AuthRegistrationApiInterface
63
+ */
64
+ convertAnonymousUserRaw(requestParameters: AuthRegistrationApiConvertAnonymousUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthResultResponse>>;
65
+
66
+ /**
67
+ * Upgrade the calling anonymous user to a full email+password account in place. The end_user.id is preserved, so customer-domain tables with foreign keys to end_users.id need no migration on conversion. All prior sessions for the user (including the anonymous token used to make this call) are revoked. A fresh token pair is returned in the response body. The conversion is the moment the user becomes billable -- MAU is tracked from this point forward.
68
+ * Convert anonymous account to a full account
69
+ */
70
+ convertAnonymousUser(convertAnonymousUserRequest: ConvertAnonymousUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthResultResponse>;
71
+
42
72
  /**
43
73
  * Register a new end user with email and password.
44
74
  * @summary Register a new end user
@@ -55,6 +85,22 @@ export interface AuthRegistrationApiInterface {
55
85
  */
56
86
  registerEndUser(registerRequest: RegisterRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthResultResponse>;
57
87
 
88
+ /**
89
+ * Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert.
90
+ * @summary Sign in anonymously
91
+ * @param {SignInAnonymouslyRequest} signInAnonymouslyRequest
92
+ * @param {*} [options] Override http request option.
93
+ * @throws {RequiredError}
94
+ * @memberof AuthRegistrationApiInterface
95
+ */
96
+ signInAnonymouslyRaw(requestParameters: AuthRegistrationApiSignInAnonymouslyOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthResultResponse>>;
97
+
98
+ /**
99
+ * Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert.
100
+ * Sign in anonymously
101
+ */
102
+ signInAnonymously(signInAnonymouslyRequest: SignInAnonymouslyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthResultResponse>;
103
+
58
104
  }
59
105
 
60
106
  /**
@@ -62,6 +108,44 @@ export interface AuthRegistrationApiInterface {
62
108
  */
63
109
  export class AuthRegistrationApi extends runtime.BaseAPI implements AuthRegistrationApiInterface {
64
110
 
111
+ /**
112
+ * Upgrade the calling anonymous user to a full email+password account in place. The end_user.id is preserved, so customer-domain tables with foreign keys to end_users.id need no migration on conversion. All prior sessions for the user (including the anonymous token used to make this call) are revoked. A fresh token pair is returned in the response body. The conversion is the moment the user becomes billable -- MAU is tracked from this point forward.
113
+ * Convert anonymous account to a full account
114
+ */
115
+ async convertAnonymousUserRaw(requestParameters: AuthRegistrationApiConvertAnonymousUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthResultResponse>> {
116
+ if (requestParameters['convertAnonymousUserRequest'] == null) {
117
+ throw new runtime.RequiredError(
118
+ 'convertAnonymousUserRequest',
119
+ 'Required parameter "convertAnonymousUserRequest" was null or undefined when calling convertAnonymousUser().'
120
+ );
121
+ }
122
+
123
+ const queryParameters: any = {};
124
+
125
+ const headerParameters: runtime.HTTPHeaders = {};
126
+
127
+ headerParameters['Content-Type'] = 'application/json';
128
+
129
+ const response = await this.request({
130
+ path: `/auth/users/convert`,
131
+ method: 'POST',
132
+ headers: headerParameters,
133
+ query: queryParameters,
134
+ body: ConvertAnonymousUserRequestToJSON(requestParameters['convertAnonymousUserRequest']),
135
+ }, initOverrides);
136
+
137
+ return new runtime.JSONApiResponse(response, (jsonValue) => AuthResultResponseFromJSON(jsonValue));
138
+ }
139
+
140
+ /**
141
+ * Upgrade the calling anonymous user to a full email+password account in place. The end_user.id is preserved, so customer-domain tables with foreign keys to end_users.id need no migration on conversion. All prior sessions for the user (including the anonymous token used to make this call) are revoked. A fresh token pair is returned in the response body. The conversion is the moment the user becomes billable -- MAU is tracked from this point forward.
142
+ * Convert anonymous account to a full account
143
+ */
144
+ async convertAnonymousUser(convertAnonymousUserRequest: ConvertAnonymousUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthResultResponse> {
145
+ const response = await this.convertAnonymousUserRaw({ convertAnonymousUserRequest: convertAnonymousUserRequest }, initOverrides);
146
+ return await response.value();
147
+ }
148
+
65
149
  /**
66
150
  * Register a new end user with email and password.
67
151
  * Register a new end user
@@ -108,4 +192,46 @@ export class AuthRegistrationApi extends runtime.BaseAPI implements AuthRegistra
108
192
  return await response.value();
109
193
  }
110
194
 
195
+ /**
196
+ * Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert.
197
+ * Sign in anonymously
198
+ */
199
+ async signInAnonymouslyRaw(requestParameters: AuthRegistrationApiSignInAnonymouslyOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthResultResponse>> {
200
+ if (requestParameters['signInAnonymouslyRequest'] == null) {
201
+ throw new runtime.RequiredError(
202
+ 'signInAnonymouslyRequest',
203
+ 'Required parameter "signInAnonymouslyRequest" was null or undefined when calling signInAnonymously().'
204
+ );
205
+ }
206
+
207
+ const queryParameters: any = {};
208
+
209
+ const headerParameters: runtime.HTTPHeaders = {};
210
+
211
+ headerParameters['Content-Type'] = 'application/json';
212
+
213
+ if (this.configuration && this.configuration.apiKey) {
214
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
215
+ }
216
+
217
+ const response = await this.request({
218
+ path: `/auth/users/anonymous`,
219
+ method: 'POST',
220
+ headers: headerParameters,
221
+ query: queryParameters,
222
+ body: SignInAnonymouslyRequestToJSON(requestParameters['signInAnonymouslyRequest']),
223
+ }, initOverrides);
224
+
225
+ return new runtime.JSONApiResponse(response, (jsonValue) => AuthResultResponseFromJSON(jsonValue));
226
+ }
227
+
228
+ /**
229
+ * Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert.
230
+ * Sign in anonymously
231
+ */
232
+ async signInAnonymously(signInAnonymouslyRequest: SignInAnonymouslyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthResultResponse> {
233
+ const response = await this.signInAnonymouslyRaw({ signInAnonymouslyRequest: signInAnonymouslyRequest }, initOverrides);
234
+ return await response.value();
235
+ }
236
+
111
237
  }
@@ -20,6 +20,7 @@ import type {
20
20
  EmailListResponse,
21
21
  EmailResponse,
22
22
  EmailTrackingResponse,
23
+ PayloadTooLargeError,
23
24
  SendBatchEmailRequest,
24
25
  SendBatchEmailResponse,
25
26
  SendEmailRequest,
@@ -36,6 +37,8 @@ import {
36
37
  EmailResponseToJSON,
37
38
  EmailTrackingResponseFromJSON,
38
39
  EmailTrackingResponseToJSON,
40
+ PayloadTooLargeErrorFromJSON,
41
+ PayloadTooLargeErrorToJSON,
39
42
  SendBatchEmailRequestFromJSON,
40
43
  SendBatchEmailRequestToJSON,
41
44
  SendBatchEmailResponseFromJSON,
@@ -24,6 +24,7 @@ import type {
24
24
  MarkAllReadResponse,
25
25
  MarkAllSubscriberNotificationsReadRequest,
26
26
  MarkInboxReadRequest,
27
+ PayloadTooLargeError,
27
28
  SendBatchInAppRequest,
28
29
  SendBatchInAppResponse,
29
30
  SendInAppRequest,
@@ -50,6 +51,8 @@ import {
50
51
  MarkAllSubscriberNotificationsReadRequestToJSON,
51
52
  MarkInboxReadRequestFromJSON,
52
53
  MarkInboxReadRequestToJSON,
54
+ PayloadTooLargeErrorFromJSON,
55
+ PayloadTooLargeErrorToJSON,
53
56
  SendBatchInAppRequestFromJSON,
54
57
  SendBatchInAppRequestToJSON,
55
58
  SendBatchInAppResponseFromJSON,
@@ -17,6 +17,7 @@ import * as runtime from '../runtime';
17
17
  import type {
18
18
  ApiError,
19
19
  DevicePushTopicListResponse,
20
+ PayloadTooLargeError,
20
21
  PushDetailResponse,
21
22
  PushListResponse,
22
23
  PushStatsResponse,
@@ -34,6 +35,8 @@ import {
34
35
  ApiErrorToJSON,
35
36
  DevicePushTopicListResponseFromJSON,
36
37
  DevicePushTopicListResponseToJSON,
38
+ PayloadTooLargeErrorFromJSON,
39
+ PayloadTooLargeErrorToJSON,
37
40
  PushDetailResponseFromJSON,
38
41
  PushDetailResponseToJSON,
39
42
  PushListResponseFromJSON,
@@ -16,6 +16,7 @@
16
16
  import * as runtime from '../runtime';
17
17
  import type {
18
18
  ApiError,
19
+ PayloadTooLargeError,
19
20
  SendBatchSmsRequest,
20
21
  SendBatchSmsResponse,
21
22
  SendSmsRequest,
@@ -32,6 +33,8 @@ import type {
32
33
  import {
33
34
  ApiErrorFromJSON,
34
35
  ApiErrorToJSON,
36
+ PayloadTooLargeErrorFromJSON,
37
+ PayloadTooLargeErrorToJSON,
35
38
  SendBatchSmsRequestFromJSON,
36
39
  SendBatchSmsRequestToJSON,
37
40
  SendBatchSmsResponseFromJSON,
@@ -18,6 +18,7 @@ import type {
18
18
  ApiError,
19
19
  CreateTemplateRequest,
20
20
  DeleteResult,
21
+ PayloadTooLargeError,
21
22
  RenderTemplateRequest,
22
23
  TemplateListResponse,
23
24
  TemplateRenderResponse,
@@ -31,6 +32,8 @@ import {
31
32
  CreateTemplateRequestToJSON,
32
33
  DeleteResultFromJSON,
33
34
  DeleteResultToJSON,
35
+ PayloadTooLargeErrorFromJSON,
36
+ PayloadTooLargeErrorToJSON,
34
37
  RenderTemplateRequestFromJSON,
35
38
  RenderTemplateRequestToJSON,
36
39
  TemplateListResponseFromJSON,
@@ -79,6 +79,24 @@ export interface AuthUser {
79
79
  * @memberof AuthUser
80
80
  */
81
81
  mfaEnabled?: boolean;
82
+ /**
83
+ * True if the user signed in anonymously and has not yet been converted to a full account.
84
+ * @type {boolean}
85
+ * @memberof AuthUser
86
+ */
87
+ isAnonymous?: boolean;
88
+ /**
89
+ * Per-device identifier supplied at anonymous sign-in. Preserved across conversion so client-side "this device has scores from me" detection survives the upgrade. NULL for users who never signed in anonymously.
90
+ * @type {string}
91
+ * @memberof AuthUser
92
+ */
93
+ anonymousDeviceId?: string | null;
94
+ /**
95
+ * Set on the user's first authenticated request after anonymous sign-in (excluding /auth/refresh). MAU billing for anonymous-origin users keys off this timestamp instead of created_at.
96
+ * @type {Date}
97
+ * @memberof AuthUser
98
+ */
99
+ firstActivityAt?: Date | null;
82
100
  /**
83
101
  *
84
102
  * @type {Date}
@@ -138,6 +156,9 @@ export function AuthUserFromJSONTyped(json: any, ignoreDiscriminator: boolean):
138
156
  'phoneVerified': json['phone_verified'] == null ? undefined : json['phone_verified'],
139
157
  'status': json['status'] == null ? undefined : json['status'],
140
158
  'mfaEnabled': json['mfa_enabled'] == null ? undefined : json['mfa_enabled'],
159
+ 'isAnonymous': json['is_anonymous'] == null ? undefined : json['is_anonymous'],
160
+ 'anonymousDeviceId': json['anonymous_device_id'] == null ? undefined : json['anonymous_device_id'],
161
+ 'firstActivityAt': json['first_activity_at'] == null ? undefined : (new Date(json['first_activity_at'])),
141
162
  'createdAt': json['created_at'] == null ? undefined : (new Date(json['created_at'])),
142
163
  'updatedAt': json['updated_at'] == null ? undefined : (new Date(json['updated_at'])),
143
164
  'lastLoginAt': json['last_login_at'] == null ? undefined : (new Date(json['last_login_at'])),
@@ -165,6 +186,9 @@ export function AuthUserToJSONTyped(value?: AuthUser | null, ignoreDiscriminator
165
186
  'phone_verified': value['phoneVerified'],
166
187
  'status': value['status'],
167
188
  'mfa_enabled': value['mfaEnabled'],
189
+ 'is_anonymous': value['isAnonymous'],
190
+ 'anonymous_device_id': value['anonymousDeviceId'],
191
+ 'first_activity_at': value['firstActivityAt'] == null ? undefined : ((value['firstActivityAt'] as any).toISOString()),
168
192
  'created_at': value['createdAt'] == null ? undefined : ((value['createdAt']).toISOString()),
169
193
  'updated_at': value['updatedAt'] == null ? undefined : ((value['updatedAt']).toISOString()),
170
194
  'last_login_at': value['lastLoginAt'] == null ? undefined : ((value['lastLoginAt'] as any).toISOString()),
@@ -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 type { ConvertAnonymousUserRequestOneOf } from './ConvertAnonymousUserRequestOneOf';
16
+ import {
17
+ instanceOfConvertAnonymousUserRequestOneOf,
18
+ ConvertAnonymousUserRequestOneOfFromJSON,
19
+ ConvertAnonymousUserRequestOneOfFromJSONTyped,
20
+ ConvertAnonymousUserRequestOneOfToJSON,
21
+ } from './ConvertAnonymousUserRequestOneOf';
22
+ import type { ConvertAnonymousUserRequestOneOf1 } from './ConvertAnonymousUserRequestOneOf1';
23
+ import {
24
+ instanceOfConvertAnonymousUserRequestOneOf1,
25
+ ConvertAnonymousUserRequestOneOf1FromJSON,
26
+ ConvertAnonymousUserRequestOneOf1FromJSONTyped,
27
+ ConvertAnonymousUserRequestOneOf1ToJSON,
28
+ } from './ConvertAnonymousUserRequestOneOf1';
29
+
30
+ /**
31
+ * @type ConvertAnonymousUserRequest
32
+ *
33
+ * @export
34
+ */
35
+ export type ConvertAnonymousUserRequest = ConvertAnonymousUserRequestOneOf | ConvertAnonymousUserRequestOneOf1;
36
+
37
+ export function ConvertAnonymousUserRequestFromJSON(json: any): ConvertAnonymousUserRequest {
38
+ return ConvertAnonymousUserRequestFromJSONTyped(json, false);
39
+ }
40
+
41
+ export function ConvertAnonymousUserRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): ConvertAnonymousUserRequest {
42
+ if (json == null) {
43
+ return json;
44
+ }
45
+ if (instanceOfConvertAnonymousUserRequestOneOf(json)) {
46
+ return ConvertAnonymousUserRequestOneOfFromJSONTyped(json, true);
47
+ }
48
+ if (instanceOfConvertAnonymousUserRequestOneOf1(json)) {
49
+ return ConvertAnonymousUserRequestOneOf1FromJSONTyped(json, true);
50
+ }
51
+
52
+ return {} as any;
53
+ }
54
+
55
+ export function ConvertAnonymousUserRequestToJSON(json: any): any {
56
+ return ConvertAnonymousUserRequestToJSONTyped(json, false);
57
+ }
58
+
59
+ export function ConvertAnonymousUserRequestToJSONTyped(value?: ConvertAnonymousUserRequest | null, ignoreDiscriminator: boolean = false): any {
60
+ if (value == null) {
61
+ return value;
62
+ }
63
+
64
+ if (instanceOfConvertAnonymousUserRequestOneOf(value)) {
65
+ return ConvertAnonymousUserRequestOneOfToJSON(value as ConvertAnonymousUserRequestOneOf);
66
+ }
67
+ if (instanceOfConvertAnonymousUserRequestOneOf1(value)) {
68
+ return ConvertAnonymousUserRequestOneOf1ToJSON(value as ConvertAnonymousUserRequestOneOf1);
69
+ }
70
+
71
+ return {};
72
+ }
73
+
@@ -0,0 +1,102 @@
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 ConvertAnonymousUserRequestOneOf
20
+ */
21
+ export interface ConvertAnonymousUserRequestOneOf {
22
+ /**
23
+ *
24
+ * @type {string}
25
+ * @memberof ConvertAnonymousUserRequestOneOf
26
+ */
27
+ method: ConvertAnonymousUserRequestOneOfMethodEnum;
28
+ /**
29
+ *
30
+ * @type {string}
31
+ * @memberof ConvertAnonymousUserRequestOneOf
32
+ */
33
+ email: string;
34
+ /**
35
+ *
36
+ * @type {string}
37
+ * @memberof ConvertAnonymousUserRequestOneOf
38
+ */
39
+ password: string;
40
+ /**
41
+ * Optional. Overwrites the user's existing name if provided.
42
+ * @type {string}
43
+ * @memberof ConvertAnonymousUserRequestOneOf
44
+ */
45
+ name?: string;
46
+ }
47
+
48
+
49
+ /**
50
+ * @export
51
+ */
52
+ export const ConvertAnonymousUserRequestOneOfMethodEnum = {
53
+ PASSWORD: 'password'
54
+ } as const;
55
+ export type ConvertAnonymousUserRequestOneOfMethodEnum = typeof ConvertAnonymousUserRequestOneOfMethodEnum[keyof typeof ConvertAnonymousUserRequestOneOfMethodEnum];
56
+
57
+
58
+ /**
59
+ * Check if a given object implements the ConvertAnonymousUserRequestOneOf interface.
60
+ */
61
+ export function instanceOfConvertAnonymousUserRequestOneOf(value: object): value is ConvertAnonymousUserRequestOneOf {
62
+ if (!('method' in value) || value['method'] === undefined) return false;
63
+ if (!('email' in value) || value['email'] === undefined) return false;
64
+ if (!('password' in value) || value['password'] === undefined) return false;
65
+ return true;
66
+ }
67
+
68
+ export function ConvertAnonymousUserRequestOneOfFromJSON(json: any): ConvertAnonymousUserRequestOneOf {
69
+ return ConvertAnonymousUserRequestOneOfFromJSONTyped(json, false);
70
+ }
71
+
72
+ export function ConvertAnonymousUserRequestOneOfFromJSONTyped(json: any, ignoreDiscriminator: boolean): ConvertAnonymousUserRequestOneOf {
73
+ if (json == null) {
74
+ return json;
75
+ }
76
+ return {
77
+
78
+ 'method': json['method'],
79
+ 'email': json['email'],
80
+ 'password': json['password'],
81
+ 'name': json['name'] == null ? undefined : json['name'],
82
+ };
83
+ }
84
+
85
+ export function ConvertAnonymousUserRequestOneOfToJSON(json: any): ConvertAnonymousUserRequestOneOf {
86
+ return ConvertAnonymousUserRequestOneOfToJSONTyped(json, false);
87
+ }
88
+
89
+ export function ConvertAnonymousUserRequestOneOfToJSONTyped(value?: ConvertAnonymousUserRequestOneOf | null, ignoreDiscriminator: boolean = false): any {
90
+ if (value == null) {
91
+ return value;
92
+ }
93
+
94
+ return {
95
+
96
+ 'method': value['method'],
97
+ 'email': value['email'],
98
+ 'password': value['password'],
99
+ 'name': value['name'],
100
+ };
101
+ }
102
+