@zyphr-dev/node-sdk 0.1.44 → 0.1.45

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.44",
3
+ "version": "0.1.45",
4
4
  "description": "Official Zyphr SDK for Node.js, React, and React Native",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -89,6 +89,7 @@ src/models/BulkUpsertAuthEmailTemplatesResponse.ts
89
89
  src/models/Category.ts
90
90
  src/models/CategoryListResponse.ts
91
91
  src/models/CategoryResponse.ts
92
+ src/models/ChangePasswordRequest.ts
92
93
  src/models/CloseWaaSEndpointCircuit200Response.ts
93
94
  src/models/CloseWaaSEndpointCircuit200ResponseData.ts
94
95
  src/models/ConfirmEmailVerificationRequest.ts
@@ -368,6 +369,7 @@ src/models/SetEndUserClaims200ResponseData.ts
368
369
  src/models/SetEndUserClaimsRequest.ts
369
370
  src/models/SetPreferencesRequest.ts
370
371
  src/models/SetPreferencesRequestPreferencesInner.ts
372
+ src/models/SetSelfApplicationTestRecipientsRequest.ts
371
373
  src/models/SignInAnonymouslyRequest.ts
372
374
  src/models/SignInWithGameCenterRequest.ts
373
375
  src/models/SignInWithGooglePlayGamesRequest.ts
@@ -505,6 +507,7 @@ src/models/WebhookDeliveryListResponse.ts
505
507
  src/models/WebhookDeliveryResponse.ts
506
508
  src/models/WebhookDeliveryRetryResponse.ts
507
509
  src/models/WebhookDeliveryRetryResponseData.ts
510
+ src/models/WebhookEventType.ts
508
511
  src/models/WebhookEventTypesResponse.ts
509
512
  src/models/WebhookEventTypesResponseData.ts
510
513
  src/models/WebhookIpsResponse.ts
@@ -17,14 +17,21 @@ import * as runtime from '../runtime';
17
17
  import type {
18
18
  ApiError,
19
19
  ApplicationSelfResponse,
20
+ SetSelfApplicationTestRecipientsRequest,
20
21
  } from '../models/index';
21
22
  import {
22
23
  ApiErrorFromJSON,
23
24
  ApiErrorToJSON,
24
25
  ApplicationSelfResponseFromJSON,
25
26
  ApplicationSelfResponseToJSON,
27
+ SetSelfApplicationTestRecipientsRequestFromJSON,
28
+ SetSelfApplicationTestRecipientsRequestToJSON,
26
29
  } from '../models/index';
27
30
 
31
+ export interface AuthApplicationApiSetSelfApplicationTestRecipientsOperationRequest {
32
+ setSelfApplicationTestRecipientsRequest: SetSelfApplicationTestRecipientsRequest;
33
+ }
34
+
28
35
  /**
29
36
  * AuthApplicationApi - interface
30
37
  *
@@ -47,6 +54,22 @@ export interface AuthApplicationApiInterface {
47
54
  */
48
55
  getSelfApplication(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApplicationSelfResponse>;
49
56
 
57
+ /**
58
+ * Set `test_recipients` — the per-application auth-email allowlist — on the application whose credentials authenticated this request. When non-empty, this allowlist gates ALL auth emails (only listed addresses receive them); an EMPTY array clears it and disables the gate. Lets an integrator manage the allowlist from their own infrastructure config instead of the dashboard. Application-SECRET scoped (server-side write): requires X-Application-Key AND X-Application-Secret. Mutates ONLY the authenticating application — it never takes an application id from the request, so there is no cross-tenant write path. The response mirrors GET /auth/application exactly (never returns secrets).
59
+ * @summary Set the authenticating application\'s auth-email test allowlist
60
+ * @param {SetSelfApplicationTestRecipientsRequest} setSelfApplicationTestRecipientsRequest
61
+ * @param {*} [options] Override http request option.
62
+ * @throws {RequiredError}
63
+ * @memberof AuthApplicationApiInterface
64
+ */
65
+ setSelfApplicationTestRecipientsRaw(requestParameters: AuthApplicationApiSetSelfApplicationTestRecipientsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApplicationSelfResponse>>;
66
+
67
+ /**
68
+ * Set `test_recipients` — the per-application auth-email allowlist — on the application whose credentials authenticated this request. When non-empty, this allowlist gates ALL auth emails (only listed addresses receive them); an EMPTY array clears it and disables the gate. Lets an integrator manage the allowlist from their own infrastructure config instead of the dashboard. Application-SECRET scoped (server-side write): requires X-Application-Key AND X-Application-Secret. Mutates ONLY the authenticating application — it never takes an application id from the request, so there is no cross-tenant write path. The response mirrors GET /auth/application exactly (never returns secrets).
69
+ * Set the authenticating application\'s auth-email test allowlist
70
+ */
71
+ setSelfApplicationTestRecipients(setSelfApplicationTestRecipientsRequest: SetSelfApplicationTestRecipientsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApplicationSelfResponse>;
72
+
50
73
  }
51
74
 
52
75
  /**
@@ -90,4 +113,50 @@ export class AuthApplicationApi extends runtime.BaseAPI implements AuthApplicati
90
113
  return await response.value();
91
114
  }
92
115
 
116
+ /**
117
+ * Set `test_recipients` — the per-application auth-email allowlist — on the application whose credentials authenticated this request. When non-empty, this allowlist gates ALL auth emails (only listed addresses receive them); an EMPTY array clears it and disables the gate. Lets an integrator manage the allowlist from their own infrastructure config instead of the dashboard. Application-SECRET scoped (server-side write): requires X-Application-Key AND X-Application-Secret. Mutates ONLY the authenticating application — it never takes an application id from the request, so there is no cross-tenant write path. The response mirrors GET /auth/application exactly (never returns secrets).
118
+ * Set the authenticating application\'s auth-email test allowlist
119
+ */
120
+ async setSelfApplicationTestRecipientsRaw(requestParameters: AuthApplicationApiSetSelfApplicationTestRecipientsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApplicationSelfResponse>> {
121
+ if (requestParameters['setSelfApplicationTestRecipientsRequest'] == null) {
122
+ throw new runtime.RequiredError(
123
+ 'setSelfApplicationTestRecipientsRequest',
124
+ 'Required parameter "setSelfApplicationTestRecipientsRequest" was null or undefined when calling setSelfApplicationTestRecipients().'
125
+ );
126
+ }
127
+
128
+ const queryParameters: any = {};
129
+
130
+ const headerParameters: runtime.HTTPHeaders = {};
131
+
132
+ headerParameters['Content-Type'] = 'application/json';
133
+
134
+ if (this.configuration && this.configuration.apiKey) {
135
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret"); // ApplicationSecret authentication
136
+ }
137
+
138
+ if (this.configuration && this.configuration.apiKey) {
139
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
140
+ }
141
+
142
+ const response = await this.request({
143
+ path: `/auth/application`,
144
+ method: 'PATCH',
145
+ headers: headerParameters,
146
+ query: queryParameters,
147
+ body: SetSelfApplicationTestRecipientsRequestToJSON(requestParameters['setSelfApplicationTestRecipientsRequest']),
148
+ }, initOverrides);
149
+
150
+ return new runtime.JSONApiResponse(response, (jsonValue) => ApplicationSelfResponseFromJSON(jsonValue));
151
+ }
152
+
153
+ /**
154
+ * Set `test_recipients` — the per-application auth-email allowlist — on the application whose credentials authenticated this request. When non-empty, this allowlist gates ALL auth emails (only listed addresses receive them); an EMPTY array clears it and disables the gate. Lets an integrator manage the allowlist from their own infrastructure config instead of the dashboard. Application-SECRET scoped (server-side write): requires X-Application-Key AND X-Application-Secret. Mutates ONLY the authenticating application — it never takes an application id from the request, so there is no cross-tenant write path. The response mirrors GET /auth/application exactly (never returns secrets).
155
+ * Set the authenticating application\'s auth-email test allowlist
156
+ */
157
+ async setSelfApplicationTestRecipients(setSelfApplicationTestRecipientsRequest: SetSelfApplicationTestRecipientsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApplicationSelfResponse> {
158
+ const response = await this.setSelfApplicationTestRecipientsRaw({ setSelfApplicationTestRecipientsRequest: setSelfApplicationTestRecipientsRequest }, initOverrides);
159
+ return await response.value();
160
+ }
161
+
93
162
  }
@@ -17,7 +17,9 @@ import * as runtime from '../runtime';
17
17
  import type {
18
18
  ApiError,
19
19
  AuthUserResponse,
20
+ ChangePasswordRequest,
20
21
  EndUserDeleteResponse,
22
+ RefreshTokenResponse,
21
23
  UpdateEndUserRequest,
22
24
  } from '../models/index';
23
25
  import {
@@ -25,12 +27,20 @@ import {
25
27
  ApiErrorToJSON,
26
28
  AuthUserResponseFromJSON,
27
29
  AuthUserResponseToJSON,
30
+ ChangePasswordRequestFromJSON,
31
+ ChangePasswordRequestToJSON,
28
32
  EndUserDeleteResponseFromJSON,
29
33
  EndUserDeleteResponseToJSON,
34
+ RefreshTokenResponseFromJSON,
35
+ RefreshTokenResponseToJSON,
30
36
  UpdateEndUserRequestFromJSON,
31
37
  UpdateEndUserRequestToJSON,
32
38
  } from '../models/index';
33
39
 
40
+ export interface AuthUserProfileApiChangeEndUserPasswordRequest {
41
+ changePasswordRequest: ChangePasswordRequest;
42
+ }
43
+
34
44
  export interface AuthUserProfileApiUpdateEndUserOperationRequest {
35
45
  updateEndUserRequest: UpdateEndUserRequest;
36
46
  }
@@ -42,6 +52,22 @@ export interface AuthUserProfileApiUpdateEndUserOperationRequest {
42
52
  * @interface AuthUserProfileApiInterface
43
53
  */
44
54
  export interface AuthUserProfileApiInterface {
55
+ /**
56
+ * Change the currently authenticated end user\'s password from a logged-in session. The caller must prove possession of the CURRENT password (`current_password`); the user is identified from the end-user token, not the request body, so a user can only change their own password. On success, all existing sessions are revoked and a fresh token pair is returned so the current session stays authenticated. Emits the `user.password_changed` webhook.
57
+ * @summary Change password (authenticated session)
58
+ * @param {ChangePasswordRequest} changePasswordRequest
59
+ * @param {*} [options] Override http request option.
60
+ * @throws {RequiredError}
61
+ * @memberof AuthUserProfileApiInterface
62
+ */
63
+ changeEndUserPasswordRaw(requestParameters: AuthUserProfileApiChangeEndUserPasswordRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RefreshTokenResponse>>;
64
+
65
+ /**
66
+ * Change the currently authenticated end user\'s password from a logged-in session. The caller must prove possession of the CURRENT password (`current_password`); the user is identified from the end-user token, not the request body, so a user can only change their own password. On success, all existing sessions are revoked and a fresh token pair is returned so the current session stays authenticated. Emits the `user.password_changed` webhook.
67
+ * Change password (authenticated session)
68
+ */
69
+ changeEndUserPassword(changePasswordRequest: ChangePasswordRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RefreshTokenResponse>;
70
+
45
71
  /**
46
72
  * Delete the current end user account (GDPR right to erasure). This is a soft delete — the account is marked as deleted but data is retained for a period to allow for recovery or legal requirements.
47
73
  * @summary Delete current end user account
@@ -95,6 +121,56 @@ export interface AuthUserProfileApiInterface {
95
121
  */
96
122
  export class AuthUserProfileApi extends runtime.BaseAPI implements AuthUserProfileApiInterface {
97
123
 
124
+ /**
125
+ * Change the currently authenticated end user\'s password from a logged-in session. The caller must prove possession of the CURRENT password (`current_password`); the user is identified from the end-user token, not the request body, so a user can only change their own password. On success, all existing sessions are revoked and a fresh token pair is returned so the current session stays authenticated. Emits the `user.password_changed` webhook.
126
+ * Change password (authenticated session)
127
+ */
128
+ async changeEndUserPasswordRaw(requestParameters: AuthUserProfileApiChangeEndUserPasswordRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RefreshTokenResponse>> {
129
+ if (requestParameters['changePasswordRequest'] == null) {
130
+ throw new runtime.RequiredError(
131
+ 'changePasswordRequest',
132
+ 'Required parameter "changePasswordRequest" was null or undefined when calling changeEndUserPassword().'
133
+ );
134
+ }
135
+
136
+ const queryParameters: any = {};
137
+
138
+ const headerParameters: runtime.HTTPHeaders = {};
139
+
140
+ headerParameters['Content-Type'] = 'application/json';
141
+
142
+ if (this.configuration && this.configuration.accessToken) {
143
+ const token = this.configuration.accessToken;
144
+ const tokenString = await token("EndUserToken", []);
145
+
146
+ if (tokenString) {
147
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
148
+ }
149
+ }
150
+ if (this.configuration && this.configuration.apiKey) {
151
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
152
+ }
153
+
154
+ const response = await this.request({
155
+ path: `/auth/users/change-password`,
156
+ method: 'POST',
157
+ headers: headerParameters,
158
+ query: queryParameters,
159
+ body: ChangePasswordRequestToJSON(requestParameters['changePasswordRequest']),
160
+ }, initOverrides);
161
+
162
+ return new runtime.JSONApiResponse(response, (jsonValue) => RefreshTokenResponseFromJSON(jsonValue));
163
+ }
164
+
165
+ /**
166
+ * Change the currently authenticated end user\'s password from a logged-in session. The caller must prove possession of the CURRENT password (`current_password`); the user is identified from the end-user token, not the request body, so a user can only change their own password. On success, all existing sessions are revoked and a fresh token pair is returned so the current session stays authenticated. Emits the `user.password_changed` webhook.
167
+ * Change password (authenticated session)
168
+ */
169
+ async changeEndUserPassword(changePasswordRequest: ChangePasswordRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RefreshTokenResponse> {
170
+ const response = await this.changeEndUserPasswordRaw({ changePasswordRequest: changePasswordRequest }, initOverrides);
171
+ return await response.value();
172
+ }
173
+
98
174
  /**
99
175
  * Delete the current end user account (GDPR right to erasure). This is a soft delete — the account is marked as deleted but data is retained for a period to allow for recovery or legal requirements.
100
176
  * Delete current end user account
@@ -47,6 +47,12 @@ export interface ApplicationSelf {
47
47
  * @memberof ApplicationSelf
48
48
  */
49
49
  signingAlgorithm: ApplicationSelfSigningAlgorithmEnum;
50
+ /**
51
+ * The auth-email test allowlist. When non-empty, only these addresses receive auth emails (the gate from sc-7443); an empty array disables the gate. Settable via PATCH /auth/application (sc-7600).
52
+ * @type {Array<string>}
53
+ * @memberof ApplicationSelf
54
+ */
55
+ testRecipients: Array<string>;
50
56
  }
51
57
 
52
58
 
@@ -78,6 +84,7 @@ export function instanceOfApplicationSelf(value: object): value is ApplicationSe
78
84
  if (!('name' in value) || value['name'] === undefined) return false;
79
85
  if (!('environment' in value) || value['environment'] === undefined) return false;
80
86
  if (!('signingAlgorithm' in value) || value['signingAlgorithm'] === undefined) return false;
87
+ if (!('testRecipients' in value) || value['testRecipients'] === undefined) return false;
81
88
  return true;
82
89
  }
83
90
 
@@ -95,6 +102,7 @@ export function ApplicationSelfFromJSONTyped(json: any, ignoreDiscriminator: boo
95
102
  'name': json['name'],
96
103
  'environment': json['environment'],
97
104
  'signingAlgorithm': json['signing_algorithm'],
105
+ 'testRecipients': json['test_recipients'],
98
106
  };
99
107
  }
100
108
 
@@ -113,6 +121,7 @@ export function ApplicationSelfToJSONTyped(value?: ApplicationSelf | null, ignor
113
121
  'name': value['name'],
114
122
  'environment': value['environment'],
115
123
  'signing_algorithm': value['signingAlgorithm'],
124
+ 'test_recipients': value['testRecipients'],
116
125
  };
117
126
  }
118
127
 
@@ -0,0 +1,75 @@
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 ## Account Sending Status Every authenticated response carries the account\'s current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## 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 ChangePasswordRequest
20
+ */
21
+ export interface ChangePasswordRequest {
22
+ /**
23
+ * The user's current password, for verification.
24
+ * @type {string}
25
+ * @memberof ChangePasswordRequest
26
+ */
27
+ currentPassword: string;
28
+ /**
29
+ * The new password. Must satisfy the application's password policy.
30
+ * @type {string}
31
+ * @memberof ChangePasswordRequest
32
+ */
33
+ newPassword: string;
34
+ }
35
+
36
+ /**
37
+ * Check if a given object implements the ChangePasswordRequest interface.
38
+ */
39
+ export function instanceOfChangePasswordRequest(value: object): value is ChangePasswordRequest {
40
+ if (!('currentPassword' in value) || value['currentPassword'] === undefined) return false;
41
+ if (!('newPassword' in value) || value['newPassword'] === undefined) return false;
42
+ return true;
43
+ }
44
+
45
+ export function ChangePasswordRequestFromJSON(json: any): ChangePasswordRequest {
46
+ return ChangePasswordRequestFromJSONTyped(json, false);
47
+ }
48
+
49
+ export function ChangePasswordRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): ChangePasswordRequest {
50
+ if (json == null) {
51
+ return json;
52
+ }
53
+ return {
54
+
55
+ 'currentPassword': json['current_password'],
56
+ 'newPassword': json['new_password'],
57
+ };
58
+ }
59
+
60
+ export function ChangePasswordRequestToJSON(json: any): ChangePasswordRequest {
61
+ return ChangePasswordRequestToJSONTyped(json, false);
62
+ }
63
+
64
+ export function ChangePasswordRequestToJSONTyped(value?: ChangePasswordRequest | null, ignoreDiscriminator: boolean = false): any {
65
+ if (value == null) {
66
+ return value;
67
+ }
68
+
69
+ return {
70
+
71
+ 'current_password': value['currentPassword'],
72
+ 'new_password': value['newPassword'],
73
+ };
74
+ }
75
+
@@ -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 ## Account Sending Status Every authenticated response carries the account\'s current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## 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 SetSelfApplicationTestRecipientsRequest
20
+ */
21
+ export interface SetSelfApplicationTestRecipientsRequest {
22
+ /**
23
+ * Email addresses allowed to receive auth emails. An empty array clears the allowlist (disables the gate).
24
+ * @type {Array<string>}
25
+ * @memberof SetSelfApplicationTestRecipientsRequest
26
+ */
27
+ testRecipients: Array<string>;
28
+ }
29
+
30
+ /**
31
+ * Check if a given object implements the SetSelfApplicationTestRecipientsRequest interface.
32
+ */
33
+ export function instanceOfSetSelfApplicationTestRecipientsRequest(value: object): value is SetSelfApplicationTestRecipientsRequest {
34
+ if (!('testRecipients' in value) || value['testRecipients'] === undefined) return false;
35
+ return true;
36
+ }
37
+
38
+ export function SetSelfApplicationTestRecipientsRequestFromJSON(json: any): SetSelfApplicationTestRecipientsRequest {
39
+ return SetSelfApplicationTestRecipientsRequestFromJSONTyped(json, false);
40
+ }
41
+
42
+ export function SetSelfApplicationTestRecipientsRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): SetSelfApplicationTestRecipientsRequest {
43
+ if (json == null) {
44
+ return json;
45
+ }
46
+ return {
47
+
48
+ 'testRecipients': json['test_recipients'],
49
+ };
50
+ }
51
+
52
+ export function SetSelfApplicationTestRecipientsRequestToJSON(json: any): SetSelfApplicationTestRecipientsRequest {
53
+ return SetSelfApplicationTestRecipientsRequestToJSONTyped(json, false);
54
+ }
55
+
56
+ export function SetSelfApplicationTestRecipientsRequestToJSONTyped(value?: SetSelfApplicationTestRecipientsRequest | null, ignoreDiscriminator: boolean = false): any {
57
+ if (value == null) {
58
+ return value;
59
+ }
60
+
61
+ return {
62
+
63
+ 'test_recipients': value['testRecipients'],
64
+ };
65
+ }
66
+
@@ -13,6 +13,14 @@
13
13
  */
14
14
 
15
15
  import { mapValues } from '../runtime';
16
+ import type { WebhookEventType } from './WebhookEventType';
17
+ import {
18
+ WebhookEventTypeFromJSON,
19
+ WebhookEventTypeFromJSONTyped,
20
+ WebhookEventTypeToJSON,
21
+ WebhookEventTypeToJSONTyped,
22
+ } from './WebhookEventType';
23
+
16
24
  /**
17
25
  *
18
26
  * @export
@@ -39,10 +47,10 @@ export interface WebhookDelivery {
39
47
  eventId?: string;
40
48
  /**
41
49
  *
42
- * @type {string}
50
+ * @type {WebhookEventType}
43
51
  * @memberof WebhookDelivery
44
52
  */
45
- eventType?: string;
53
+ eventType?: WebhookEventType;
46
54
  /**
47
55
  *
48
56
  * @type {string}
@@ -151,7 +159,7 @@ export function WebhookDeliveryFromJSONTyped(json: any, ignoreDiscriminator: boo
151
159
  'id': json['id'] == null ? undefined : json['id'],
152
160
  'msgId': json['msg_id'] == null ? undefined : json['msg_id'],
153
161
  'eventId': json['event_id'] == null ? undefined : json['event_id'],
154
- 'eventType': json['event_type'] == null ? undefined : json['event_type'],
162
+ 'eventType': json['event_type'] == null ? undefined : WebhookEventTypeFromJSON(json['event_type']),
155
163
  'status': json['status'] == null ? undefined : json['status'],
156
164
  'attempts': json['attempts'] == null ? undefined : json['attempts'],
157
165
  'maxAttempts': json['max_attempts'] == null ? undefined : json['max_attempts'],
@@ -181,7 +189,7 @@ export function WebhookDeliveryToJSONTyped(value?: WebhookDelivery | null, ignor
181
189
  'id': value['id'],
182
190
  'msg_id': value['msgId'],
183
191
  'event_id': value['eventId'],
184
- 'event_type': value['eventType'],
192
+ 'event_type': WebhookEventTypeToJSON(value['eventType']),
185
193
  'status': value['status'],
186
194
  'attempts': value['attempts'],
187
195
  'max_attempts': value['maxAttempts'],
@@ -13,6 +13,14 @@
13
13
  */
14
14
 
15
15
  import { mapValues } from '../runtime';
16
+ import type { WebhookEventType } from './WebhookEventType';
17
+ import {
18
+ WebhookEventTypeFromJSON,
19
+ WebhookEventTypeFromJSONTyped,
20
+ WebhookEventTypeToJSON,
21
+ WebhookEventTypeToJSONTyped,
22
+ } from './WebhookEventType';
23
+
16
24
  /**
17
25
  * Full delivery object with payload, headers, and response details
18
26
  * @export
@@ -39,10 +47,10 @@ export interface WebhookDeliveryDetail {
39
47
  eventId?: string;
40
48
  /**
41
49
  *
42
- * @type {string}
50
+ * @type {WebhookEventType}
43
51
  * @memberof WebhookDeliveryDetail
44
52
  */
45
- eventType?: string;
53
+ eventType?: WebhookEventType;
46
54
  /**
47
55
  *
48
56
  * @type {string}
@@ -175,7 +183,7 @@ export function WebhookDeliveryDetailFromJSONTyped(json: any, ignoreDiscriminato
175
183
  'id': json['id'] == null ? undefined : json['id'],
176
184
  'msgId': json['msg_id'] == null ? undefined : json['msg_id'],
177
185
  'eventId': json['event_id'] == null ? undefined : json['event_id'],
178
- 'eventType': json['event_type'] == null ? undefined : json['event_type'],
186
+ 'eventType': json['event_type'] == null ? undefined : WebhookEventTypeFromJSON(json['event_type']),
179
187
  'status': json['status'] == null ? undefined : json['status'],
180
188
  'attempts': json['attempts'] == null ? undefined : json['attempts'],
181
189
  'maxAttempts': json['max_attempts'] == null ? undefined : json['max_attempts'],
@@ -209,7 +217,7 @@ export function WebhookDeliveryDetailToJSONTyped(value?: WebhookDeliveryDetail |
209
217
  'id': value['id'],
210
218
  'msg_id': value['msgId'],
211
219
  'event_id': value['eventId'],
212
- 'event_type': value['eventType'],
220
+ 'event_type': WebhookEventTypeToJSON(value['eventType']),
213
221
  'status': value['status'],
214
222
  'attempts': value['attempts'],
215
223
  'max_attempts': value['maxAttempts'],
@@ -0,0 +1,79 @@
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 ## Account Sending Status Every authenticated response carries the account\'s current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## 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
+ /**
17
+ * Canonical webhook event type. Matches the event `type` field on the webhook delivery envelope and the values returned by `GET /v1/webhooks/event-types`. Source of truth: packages/shared/src/constants/webhookEventRegistry.ts.
18
+ * @export
19
+ */
20
+ export const WebhookEventType = {
21
+ EMAIL_QUEUED: 'email.queued',
22
+ EMAIL_SENT: 'email.sent',
23
+ EMAIL_DELIVERED: 'email.delivered',
24
+ EMAIL_BOUNCED: 'email.bounced',
25
+ EMAIL_SOFT_BOUNCED: 'email.soft_bounced',
26
+ EMAIL_COMPLAINED: 'email.complained',
27
+ EMAIL_OPENED: 'email.opened',
28
+ EMAIL_CLICKED: 'email.clicked',
29
+ EMAIL_FAILED: 'email.failed',
30
+ EMAIL_RECEIVED: 'email.received',
31
+ PUSH_SENT: 'push.sent',
32
+ PUSH_DELIVERED: 'push.delivered',
33
+ PUSH_FAILED: 'push.failed',
34
+ PUSH_EXPIRED: 'push.expired',
35
+ USER_CREATED: 'user.created',
36
+ USER_LOGIN: 'user.login',
37
+ USER_LOGOUT: 'user.logout',
38
+ USER_PASSWORD_CHANGED: 'user.password_changed',
39
+ USER_PASSWORD_RESET_REQUESTED: 'user.password_reset_requested',
40
+ USER_EMAIL_VERIFIED: 'user.email_verified',
41
+ USER_PHONE_VERIFIED: 'user.phone_verified',
42
+ USER_DELETED: 'user.deleted',
43
+ USER_SESSION_REVOKED: 'user.session_revoked',
44
+ USER_MFA_ENABLED: 'user.mfa_enabled',
45
+ USER_MFA_DISABLED: 'user.mfa_disabled',
46
+ USER_IMPERSONATED: 'user.impersonated',
47
+ DOMAIN_VERIFIED: 'domain.verified',
48
+ DOMAIN_VERIFICATION_FAILED: 'domain.verification_failed'
49
+ } as const;
50
+ export type WebhookEventType = typeof WebhookEventType[keyof typeof WebhookEventType];
51
+
52
+
53
+ export function instanceOfWebhookEventType(value: any): boolean {
54
+ for (const key in WebhookEventType) {
55
+ if (Object.prototype.hasOwnProperty.call(WebhookEventType, key)) {
56
+ if (WebhookEventType[key as keyof typeof WebhookEventType] === value) {
57
+ return true;
58
+ }
59
+ }
60
+ }
61
+ return false;
62
+ }
63
+
64
+ export function WebhookEventTypeFromJSON(json: any): WebhookEventType {
65
+ return WebhookEventTypeFromJSONTyped(json, false);
66
+ }
67
+
68
+ export function WebhookEventTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): WebhookEventType {
69
+ return json as WebhookEventType;
70
+ }
71
+
72
+ export function WebhookEventTypeToJSON(value?: WebhookEventType | null): any {
73
+ return value as any;
74
+ }
75
+
76
+ export function WebhookEventTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): WebhookEventType {
77
+ return value as WebhookEventType;
78
+ }
79
+
@@ -13,6 +13,14 @@
13
13
  */
14
14
 
15
15
  import { mapValues } from '../runtime';
16
+ import type { WebhookEventType } from './WebhookEventType';
17
+ import {
18
+ WebhookEventTypeFromJSON,
19
+ WebhookEventTypeFromJSONTyped,
20
+ WebhookEventTypeToJSON,
21
+ WebhookEventTypeToJSONTyped,
22
+ } from './WebhookEventType';
23
+
16
24
  /**
17
25
  *
18
26
  * @export
@@ -21,10 +29,10 @@ import { mapValues } from '../runtime';
21
29
  export interface WebhookEventTypesResponseData {
22
30
  /**
23
31
  *
24
- * @type {Array<string>}
32
+ * @type {Array<WebhookEventType>}
25
33
  * @memberof WebhookEventTypesResponseData
26
34
  */
27
- eventTypes?: Array<string>;
35
+ eventTypes?: Array<WebhookEventType>;
28
36
  /**
29
37
  *
30
38
  * @type {Array<object>}
@@ -62,7 +70,7 @@ export function WebhookEventTypesResponseDataFromJSONTyped(json: any, ignoreDisc
62
70
  }
63
71
  return {
64
72
 
65
- 'eventTypes': json['event_types'] == null ? undefined : json['event_types'],
73
+ 'eventTypes': json['event_types'] == null ? undefined : ((json['event_types'] as Array<any>).map(WebhookEventTypeFromJSON)),
66
74
  'registry': json['registry'] == null ? undefined : json['registry'],
67
75
  'categories': json['categories'] == null ? undefined : json['categories'],
68
76
  'apiVersion': json['api_version'] == null ? undefined : json['api_version'],
@@ -80,7 +88,7 @@ export function WebhookEventTypesResponseDataToJSONTyped(value?: WebhookEventTyp
80
88
 
81
89
  return {
82
90
 
83
- 'event_types': value['eventTypes'],
91
+ 'event_types': value['eventTypes'] == null ? undefined : ((value['eventTypes'] as Array<any>).map(WebhookEventTypeToJSON)),
84
92
  'registry': value['registry'],
85
93
  'categories': value['categories'],
86
94
  'api_version': value['apiVersion'],