@zyphr-dev/node-sdk 0.1.42 → 0.1.44
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/README.md +6 -4
- package/dist/index.cjs +2056 -345
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2258 -466
- package/dist/index.d.ts +2258 -466
- package/dist/index.js +1852 -340
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/.openapi-generator/FILES +40 -1
- package/src/client.ts +18 -3
- package/src/clientAuth.ts +45 -12
- package/src/src/apis/AuthApplicationApi.ts +93 -0
- package/src/src/apis/AuthEmailTemplatesApi.ts +4 -4
- package/src/src/apis/AuthUserDirectoryApi.ts +120 -36
- package/src/src/apis/DomainsApi.ts +7 -6
- package/src/src/apis/InboxApi.ts +78 -54
- package/src/src/apis/TemplatesApi.ts +10 -6
- package/src/src/apis/WaaSDeliveriesApi.ts +17 -12
- package/src/src/apis/WaaSEndpointsApi.ts +50 -30
- package/src/src/apis/WaaSEventTypesApi.ts +17 -12
- package/src/src/apis/index.ts +1 -0
- package/src/src/models/ApplicationSelf.ts +118 -0
- package/src/src/models/ApplicationSelfResponse.ts +88 -0
- package/src/src/models/AuthEmailTemplateTestRequest.ts +1 -1
- package/src/src/models/AuthMethods.ts +111 -0
- package/src/src/models/CloseWaaSEndpointCircuit200Response.ts +88 -0
- package/src/src/models/CloseWaaSEndpointCircuit200ResponseData.ts +76 -0
- package/src/src/models/GetEndUserAuthMethods200Response.ts +88 -0
- package/src/src/models/GetEndUserById200Response.ts +88 -0
- package/src/src/models/GetEndUserClaims200Response.ts +88 -0
- package/src/src/models/GetEndUserClaims200ResponseData.ts +65 -0
- package/src/src/models/GetSubscriberInboxPreferences200Response.ts +73 -0
- package/src/src/models/GetSubscriberInboxPreferences200ResponseData.ts +88 -0
- package/src/src/models/GetSubscriberInboxPreferences200ResponseDataCategoriesInner.ts +88 -0
- package/src/src/models/GetSubscriberInboxPreferences200ResponseDataCategoriesInnerCategory.ts +97 -0
- package/src/src/models/GetSubscriberInboxPreferences200ResponseDataGlobal.ts +73 -0
- package/src/src/models/GetSubscriberInboxPreferences200ResponseDataGlobalChannelsInner.ts +94 -0
- package/src/src/models/GetSubscriberNotification200Response.ts +73 -0
- package/src/src/models/GetSubscriberUnreadCount200Response.ts +73 -0
- package/src/src/models/GetWaaSDelivery200Response.ts +88 -0
- package/src/src/models/GetWaaSEndpointCircuit200Response.ts +88 -0
- package/src/src/models/GetWaaSEndpointCircuit200ResponseData.ts +123 -0
- package/src/src/models/GetWaaSEndpointMetrics200Response.ts +88 -0
- package/src/src/models/GetWaaSEndpointMetrics200ResponseData.ts +99 -0
- package/src/src/models/GetWaaSEndpointMetrics200ResponseDataHealth.ts +87 -0
- package/src/src/models/GetWaaSEndpointMetrics200ResponseDataWindowsValue.ts +126 -0
- package/src/src/models/InviteEndUser200Response.ts +88 -0
- package/src/src/models/InviteEndUser200ResponseData.ts +81 -0
- package/src/src/models/ListEndUsers200Response.ts +88 -0
- package/src/src/models/{ListWorkflowExecutions200ResponseMeta.ts → ListEndUsers200ResponseMeta.ts} +15 -15
- package/src/src/models/ListWorkflowExecutions200Response.ts +11 -11
- package/src/src/models/MarkAllSubscriberNotificationsRead200Response.ts +73 -0
- package/src/src/models/RotateWaaSEndpointSecret200Response.ts +88 -0
- package/src/src/models/RotateWaaSEndpointSecret200ResponseData.ts +66 -0
- package/src/src/models/SendTemplateTestEmail202Response.ts +90 -0
- package/src/src/models/SendTemplateTestEmail202ResponseData.ts +120 -0
- package/src/src/models/SendTemplateTestEmail202ResponseMeta.ts +66 -0
- package/src/src/models/SmsListResponse.ts +10 -10
- package/src/src/models/UpdateSubscriberPreferences200Response.ts +73 -0
- package/src/src/models/UpdateSubscriberPreferences200ResponseData.ts +81 -0
- package/src/src/models/UpdateSubscriberPreferences200ResponseDataPreferencesInner.ts +102 -0
- package/src/src/models/UpdateWaaSEndpoint200Response.ts +88 -0
- package/src/src/models/UpdateWaaSEventType200Response.ts +88 -0
- package/src/src/models/index.ts +39 -1
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
.npmignore
|
|
3
3
|
README.md
|
|
4
4
|
package.json
|
|
5
|
+
src/apis/AuthApplicationApi.ts
|
|
5
6
|
src/apis/AuthEmailOTPApi.ts
|
|
6
7
|
src/apis/AuthEmailTemplatesApi.ts
|
|
7
8
|
src/apis/AuthEmailVerificationApi.ts
|
|
@@ -50,6 +51,8 @@ src/models/AddWorkflowStepRequest.ts
|
|
|
50
51
|
src/models/ApiError.ts
|
|
51
52
|
src/models/ApiErrorError.ts
|
|
52
53
|
src/models/ApiErrorMeta.ts
|
|
54
|
+
src/models/ApplicationSelf.ts
|
|
55
|
+
src/models/ApplicationSelfResponse.ts
|
|
53
56
|
src/models/AuthEmailTemplate.ts
|
|
54
57
|
src/models/AuthEmailTemplateDefault.ts
|
|
55
58
|
src/models/AuthEmailTemplateDefaultResponse.ts
|
|
@@ -70,6 +73,7 @@ src/models/AuthEmailType.ts
|
|
|
70
73
|
src/models/AuthLoginResponse.ts
|
|
71
74
|
src/models/AuthLoginResult.ts
|
|
72
75
|
src/models/AuthLoginResultMfaChallenge.ts
|
|
76
|
+
src/models/AuthMethods.ts
|
|
73
77
|
src/models/AuthResult.ts
|
|
74
78
|
src/models/AuthResultResponse.ts
|
|
75
79
|
src/models/AuthSession.ts
|
|
@@ -85,6 +89,8 @@ src/models/BulkUpsertAuthEmailTemplatesResponse.ts
|
|
|
85
89
|
src/models/Category.ts
|
|
86
90
|
src/models/CategoryListResponse.ts
|
|
87
91
|
src/models/CategoryResponse.ts
|
|
92
|
+
src/models/CloseWaaSEndpointCircuit200Response.ts
|
|
93
|
+
src/models/CloseWaaSEndpointCircuit200ResponseData.ts
|
|
88
94
|
src/models/ConfirmEmailVerificationRequest.ts
|
|
89
95
|
src/models/ConfirmEmailVerificationResponse.ts
|
|
90
96
|
src/models/ConfirmEmailVerificationResponseData.ts
|
|
@@ -161,7 +167,26 @@ src/models/GenerateSubscriberTokenRequest.ts
|
|
|
161
167
|
src/models/GenerateWaaSPortalToken201Response.ts
|
|
162
168
|
src/models/GetDomain200Response.ts
|
|
163
169
|
src/models/GetDomain200ResponseMeta.ts
|
|
170
|
+
src/models/GetEndUserAuthMethods200Response.ts
|
|
171
|
+
src/models/GetEndUserById200Response.ts
|
|
172
|
+
src/models/GetEndUserClaims200Response.ts
|
|
173
|
+
src/models/GetEndUserClaims200ResponseData.ts
|
|
174
|
+
src/models/GetSubscriberInboxPreferences200Response.ts
|
|
175
|
+
src/models/GetSubscriberInboxPreferences200ResponseData.ts
|
|
176
|
+
src/models/GetSubscriberInboxPreferences200ResponseDataCategoriesInner.ts
|
|
177
|
+
src/models/GetSubscriberInboxPreferences200ResponseDataCategoriesInnerCategory.ts
|
|
178
|
+
src/models/GetSubscriberInboxPreferences200ResponseDataGlobal.ts
|
|
179
|
+
src/models/GetSubscriberInboxPreferences200ResponseDataGlobalChannelsInner.ts
|
|
180
|
+
src/models/GetSubscriberNotification200Response.ts
|
|
181
|
+
src/models/GetSubscriberUnreadCount200Response.ts
|
|
182
|
+
src/models/GetWaaSDelivery200Response.ts
|
|
164
183
|
src/models/GetWaaSEndpoint200Response.ts
|
|
184
|
+
src/models/GetWaaSEndpointCircuit200Response.ts
|
|
185
|
+
src/models/GetWaaSEndpointCircuit200ResponseData.ts
|
|
186
|
+
src/models/GetWaaSEndpointMetrics200Response.ts
|
|
187
|
+
src/models/GetWaaSEndpointMetrics200ResponseData.ts
|
|
188
|
+
src/models/GetWaaSEndpointMetrics200ResponseDataHealth.ts
|
|
189
|
+
src/models/GetWaaSEndpointMetrics200ResponseDataWindowsValue.ts
|
|
165
190
|
src/models/GetWaaSUsage200Response.ts
|
|
166
191
|
src/models/InAppNotification.ts
|
|
167
192
|
src/models/InboundAttachmentUrlResponse.ts
|
|
@@ -175,13 +200,16 @@ src/models/InboundEmailResponse.ts
|
|
|
175
200
|
src/models/InboxListMeta.ts
|
|
176
201
|
src/models/InboxListResponse.ts
|
|
177
202
|
src/models/InboxNotificationResponse.ts
|
|
203
|
+
src/models/InviteEndUser200Response.ts
|
|
204
|
+
src/models/InviteEndUser200ResponseData.ts
|
|
178
205
|
src/models/InviteEndUserRequest.ts
|
|
206
|
+
src/models/ListEndUsers200Response.ts
|
|
207
|
+
src/models/ListEndUsers200ResponseMeta.ts
|
|
179
208
|
src/models/ListWaaSApplications200Response.ts
|
|
180
209
|
src/models/ListWaaSEndpointDeliveries200Response.ts
|
|
181
210
|
src/models/ListWaaSEndpoints200Response.ts
|
|
182
211
|
src/models/ListWaaSEventTypes200Response.ts
|
|
183
212
|
src/models/ListWorkflowExecutions200Response.ts
|
|
184
|
-
src/models/ListWorkflowExecutions200ResponseMeta.ts
|
|
185
213
|
src/models/ListWorkflows200Response.ts
|
|
186
214
|
src/models/ListWorkflows200ResponseMeta.ts
|
|
187
215
|
src/models/LoginRequest.ts
|
|
@@ -192,6 +220,7 @@ src/models/MagicLinkVerifyResponseData.ts
|
|
|
192
220
|
src/models/MarkAllInboxReadRequest.ts
|
|
193
221
|
src/models/MarkAllReadData.ts
|
|
194
222
|
src/models/MarkAllReadResponse.ts
|
|
223
|
+
src/models/MarkAllSubscriberNotificationsRead200Response.ts
|
|
195
224
|
src/models/MarkAllSubscriberNotificationsReadRequest.ts
|
|
196
225
|
src/models/MarkInboxReadRequest.ts
|
|
197
226
|
src/models/MfaBackupCodesResponse.ts
|
|
@@ -288,6 +317,8 @@ src/models/ResubscribeResponse.ts
|
|
|
288
317
|
src/models/RevokeAllSessionsResponse.ts
|
|
289
318
|
src/models/RevokeAllSessionsResponseData.ts
|
|
290
319
|
src/models/RevokeSessionRequest.ts
|
|
320
|
+
src/models/RotateWaaSEndpointSecret200Response.ts
|
|
321
|
+
src/models/RotateWaaSEndpointSecret200ResponseData.ts
|
|
291
322
|
src/models/SendBatchEmailRequest.ts
|
|
292
323
|
src/models/SendBatchEmailResponse.ts
|
|
293
324
|
src/models/SendBatchEmailResult.ts
|
|
@@ -320,6 +351,9 @@ src/models/SendSlackMessageResult.ts
|
|
|
320
351
|
src/models/SendSmsData.ts
|
|
321
352
|
src/models/SendSmsRequest.ts
|
|
322
353
|
src/models/SendSmsResponse.ts
|
|
354
|
+
src/models/SendTemplateTestEmail202Response.ts
|
|
355
|
+
src/models/SendTemplateTestEmail202ResponseData.ts
|
|
356
|
+
src/models/SendTemplateTestEmail202ResponseMeta.ts
|
|
323
357
|
src/models/SendTemplateTestEmailRequest.ts
|
|
324
358
|
src/models/SendTestSmsData.ts
|
|
325
359
|
src/models/SendTestSmsRequest.ts
|
|
@@ -397,13 +431,18 @@ src/models/UpdateEndUserByApplicationRequest.ts
|
|
|
397
431
|
src/models/UpdateEndUserRequest.ts
|
|
398
432
|
src/models/UpdateOrganizationMemberRoleRequest.ts
|
|
399
433
|
src/models/UpdateOrganizationRequest.ts
|
|
434
|
+
src/models/UpdateSubscriberPreferences200Response.ts
|
|
435
|
+
src/models/UpdateSubscriberPreferences200ResponseData.ts
|
|
436
|
+
src/models/UpdateSubscriberPreferences200ResponseDataPreferencesInner.ts
|
|
400
437
|
src/models/UpdateSubscriberPreferencesRequest.ts
|
|
401
438
|
src/models/UpdateSubscriberPreferencesRequestPreferencesInner.ts
|
|
402
439
|
src/models/UpdateSubscriberRequest.ts
|
|
403
440
|
src/models/UpdateTemplateRequest.ts
|
|
404
441
|
src/models/UpdateTopicRequest.ts
|
|
405
442
|
src/models/UpdateWaaSApplicationRequest.ts
|
|
443
|
+
src/models/UpdateWaaSEndpoint200Response.ts
|
|
406
444
|
src/models/UpdateWaaSEndpointRequest.ts
|
|
445
|
+
src/models/UpdateWaaSEventType200Response.ts
|
|
407
446
|
src/models/UpdateWaaSEventTypeRequest.ts
|
|
408
447
|
src/models/UpdateWebhookRequest.ts
|
|
409
448
|
src/models/UpdateWorkflowRequest.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
|
+
AuthApplicationApi,
|
|
19
20
|
AuthEmailOTPApi,
|
|
20
21
|
AuthEmailVerificationApi,
|
|
21
22
|
AuthLoginApi,
|
|
@@ -52,13 +53,24 @@ import {
|
|
|
52
53
|
import { parseErrorResponse } from './errors.js';
|
|
53
54
|
|
|
54
55
|
export interface ZyphrOptions {
|
|
55
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Your Project-scoped Zyphr API key (`zy_live_*` / `zy_test_*`), sent as
|
|
58
|
+
* `Authorization: Bearer`. Used for notification APIs (emails, push, webhooks).
|
|
59
|
+
*/
|
|
56
60
|
apiKey: string;
|
|
57
61
|
/** Override the base API URL (defaults to https://api.zyphr.dev/v1) */
|
|
58
62
|
baseUrl?: string;
|
|
59
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* Application-scoped public key (`za_live_pub_*` / `za_test_pub_*`; legacy
|
|
65
|
+
* `za_pub_*` still accepted) for Auth-as-a-Service endpoints, sent as
|
|
66
|
+
* `X-Application-Key`. Distinct from the Project-scoped `apiKey` above.
|
|
67
|
+
*/
|
|
60
68
|
applicationKey?: string;
|
|
61
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* Application-scoped secret key (`za_live_sec_*` / `za_test_sec_*`; legacy
|
|
71
|
+
* `za_sec_*` still accepted) for server-side Auth-as-a-Service endpoints, sent
|
|
72
|
+
* as `X-Application-Secret`. Must stay server-side — never ship in a client bundle.
|
|
73
|
+
*/
|
|
62
74
|
applicationSecret?: string;
|
|
63
75
|
}
|
|
64
76
|
|
|
@@ -115,6 +127,8 @@ export class Zyphr {
|
|
|
115
127
|
/** Server-side (secret-key) end-user directory: list/search/get/update/delete, invite, and the trusted claims store. */
|
|
116
128
|
readonly userDirectory: AuthUserDirectoryApi;
|
|
117
129
|
readonly webauthn: AuthWebAuthnApi;
|
|
130
|
+
/** Read the authenticating application's own non-sensitive metadata (id, name, environment, signing algorithm) via GET /auth/application. */
|
|
131
|
+
readonly application: AuthApplicationApi;
|
|
118
132
|
};
|
|
119
133
|
|
|
120
134
|
private readonly options: ZyphrOptions;
|
|
@@ -171,6 +185,7 @@ export class Zyphr {
|
|
|
171
185
|
profile: new AuthUserProfileApi(config),
|
|
172
186
|
userDirectory: new AuthUserDirectoryApi(config),
|
|
173
187
|
webauthn: new AuthWebAuthnApi(config),
|
|
188
|
+
application: new AuthApplicationApi(config),
|
|
174
189
|
};
|
|
175
190
|
}
|
|
176
191
|
|
package/src/clientAuth.ts
CHANGED
|
@@ -4,8 +4,14 @@
|
|
|
4
4
|
* `ZyphrClient` is a browser / React Native-safe entry point for Auth-as-a-Service.
|
|
5
5
|
* Unlike the server `Zyphr` client (which requires a secret API key and, for auth,
|
|
6
6
|
* an application SECRET key), `ZyphrClient` is constructed with ONLY the publishable
|
|
7
|
-
* application key (`
|
|
8
|
-
* plus, once the user is authenticated,
|
|
7
|
+
* application key (`za_live_pub_*` in live mode, `za_test_pub_*` in test mode) — the
|
|
8
|
+
* key that is safe to ship in a client bundle — plus, once the user is authenticated,
|
|
9
|
+
* their end-user access token.
|
|
10
|
+
*
|
|
11
|
+
* These Application-scoped credentials (`X-Application-Key` publishable key, and the
|
|
12
|
+
* server-only `X-Application-Secret`) are distinct from the Project-scoped notification
|
|
13
|
+
* keys (`zy_live_*` / `zy_test_*`, sent as `Authorization: Bearer`) used by the server
|
|
14
|
+
* `Zyphr` client for emails/push/webhooks.
|
|
9
15
|
*
|
|
10
16
|
* It deliberately exposes ONLY the end-user-scoped auth surface (login, registration,
|
|
11
17
|
* sessions, magic links, OAuth, phone, email-OTP, profile, MFA, WebAuthn, password
|
|
@@ -17,7 +23,7 @@
|
|
|
17
23
|
* ```ts
|
|
18
24
|
* import { ZyphrClient } from '@zyphr-dev/node-sdk';
|
|
19
25
|
*
|
|
20
|
-
* const zyphr = new ZyphrClient({ applicationKey: '
|
|
26
|
+
* const zyphr = new ZyphrClient({ applicationKey: 'za_live_pub_xxx' });
|
|
21
27
|
*
|
|
22
28
|
* const login = await zyphr.auth.login.loginEndUser({ ... });
|
|
23
29
|
* zyphr.setAccessToken(login.data.tokens.access_token);
|
|
@@ -47,7 +53,10 @@ import {
|
|
|
47
53
|
import { parseErrorResponse } from './errors.js';
|
|
48
54
|
|
|
49
55
|
export interface ZyphrClientOptions {
|
|
50
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Publishable application key (`za_live_pub_*` / `za_test_pub_*`) — safe to
|
|
58
|
+
* embed in a client bundle. Legacy `za_pub_*` keys are also accepted.
|
|
59
|
+
*/
|
|
51
60
|
applicationKey: string;
|
|
52
61
|
/** Override the base API URL (defaults to https://api.zyphr.dev/v1). */
|
|
53
62
|
baseUrl?: string;
|
|
@@ -75,8 +84,31 @@ export class ZyphrClientCredentialError extends Error {
|
|
|
75
84
|
}
|
|
76
85
|
}
|
|
77
86
|
|
|
78
|
-
|
|
79
|
-
|
|
87
|
+
// Key prefixes are mirrored from the platform source of truth,
|
|
88
|
+
// packages/shared/src/constants/api.ts (APPLICATION_KEY_PREFIXES,
|
|
89
|
+
// SECRET_KEY_PREFIXES). They are inlined here because this is a standalone
|
|
90
|
+
// published package that cannot import @zyphr/shared at runtime — keep the two
|
|
91
|
+
// in sync if the prefixes ever change.
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Publishable application-key prefixes accepted by the client-safe SDK.
|
|
95
|
+
* `za_live_pub_` / `za_test_pub_` are the current live/test prefixes; `za_pub_`
|
|
96
|
+
* is the deprecated legacy prefix, still accepted for backward compatibility.
|
|
97
|
+
*/
|
|
98
|
+
const PUBLISHABLE_KEY_PREFIXES = ['za_live_pub_', 'za_test_pub_', 'za_pub_'];
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Prefixes that must NEVER reach a client bundle: application SECRET keys
|
|
102
|
+
* (`za_live_sec_` / `za_test_sec_`, and legacy `za_sec_`) and Project-scoped
|
|
103
|
+
* notification API keys (`zy_live_*` / `zy_test_*`).
|
|
104
|
+
*/
|
|
105
|
+
const SECRET_KEY_PREFIXES = [
|
|
106
|
+
'za_live_sec_',
|
|
107
|
+
'za_test_sec_',
|
|
108
|
+
'za_sec_',
|
|
109
|
+
'zy_live_',
|
|
110
|
+
'zy_test_',
|
|
111
|
+
];
|
|
80
112
|
|
|
81
113
|
export class ZyphrClient {
|
|
82
114
|
readonly auth: {
|
|
@@ -103,19 +135,20 @@ export class ZyphrClient {
|
|
|
103
135
|
|
|
104
136
|
constructor(options: ZyphrClientOptions) {
|
|
105
137
|
if (!options.applicationKey) {
|
|
106
|
-
throw new ZyphrClientCredentialError('applicationKey (
|
|
138
|
+
throw new ZyphrClientCredentialError('applicationKey (za_live_pub_* / za_test_pub_*) is required');
|
|
107
139
|
}
|
|
108
140
|
// Guardrail: reject secret-shaped credentials so a secret can't be shipped
|
|
109
|
-
// in a client bundle by mistake.
|
|
141
|
+
// in a client bundle by mistake. Checked before the publishable allow-list so
|
|
142
|
+
// a secret key produces the clearer "never a secret key" message.
|
|
110
143
|
if (SECRET_KEY_PREFIXES.some((p) => options.applicationKey.startsWith(p))) {
|
|
111
144
|
throw new ZyphrClientCredentialError(
|
|
112
|
-
'ZyphrClient must be constructed with a publishable application key
|
|
113
|
-
'never a secret key. Secret keys must stay server-side.'
|
|
145
|
+
'ZyphrClient must be constructed with a publishable application key ' +
|
|
146
|
+
'(za_live_pub_* / za_test_pub_*), never a secret key. Secret keys must stay server-side.'
|
|
114
147
|
);
|
|
115
148
|
}
|
|
116
|
-
if (!options.applicationKey.startsWith(
|
|
149
|
+
if (!PUBLISHABLE_KEY_PREFIXES.some((p) => options.applicationKey.startsWith(p))) {
|
|
117
150
|
throw new ZyphrClientCredentialError(
|
|
118
|
-
'applicationKey must be a publishable application key (
|
|
151
|
+
'applicationKey must be a publishable application key (za_live_pub_* / za_test_pub_*).'
|
|
119
152
|
);
|
|
120
153
|
}
|
|
121
154
|
|
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
import * as runtime from '../runtime';
|
|
17
|
+
import type {
|
|
18
|
+
ApiError,
|
|
19
|
+
ApplicationSelfResponse,
|
|
20
|
+
} from '../models/index';
|
|
21
|
+
import {
|
|
22
|
+
ApiErrorFromJSON,
|
|
23
|
+
ApiErrorToJSON,
|
|
24
|
+
ApplicationSelfResponseFromJSON,
|
|
25
|
+
ApplicationSelfResponseToJSON,
|
|
26
|
+
} from '../models/index';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* AuthApplicationApi - interface
|
|
30
|
+
*
|
|
31
|
+
* @export
|
|
32
|
+
* @interface AuthApplicationApiInterface
|
|
33
|
+
*/
|
|
34
|
+
export interface AuthApplicationApiInterface {
|
|
35
|
+
/**
|
|
36
|
+
* Return non-sensitive metadata about the application whose credentials authenticated this request. Lets an integrator read their own application_id (the sole tenant discriminator embedded in every end-user token) directly from the API, rather than only from the dashboard UI or by decoding a token. Returns only id, name, the calling environment\'s mode, and the JWT signing algorithm — never secrets, signing keys, or account-internal fields.
|
|
37
|
+
* @summary Get the authenticating application
|
|
38
|
+
* @param {*} [options] Override http request option.
|
|
39
|
+
* @throws {RequiredError}
|
|
40
|
+
* @memberof AuthApplicationApiInterface
|
|
41
|
+
*/
|
|
42
|
+
getSelfApplicationRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApplicationSelfResponse>>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Return non-sensitive metadata about the application whose credentials authenticated this request. Lets an integrator read their own application_id (the sole tenant discriminator embedded in every end-user token) directly from the API, rather than only from the dashboard UI or by decoding a token. Returns only id, name, the calling environment\'s mode, and the JWT signing algorithm — never secrets, signing keys, or account-internal fields.
|
|
46
|
+
* Get the authenticating application
|
|
47
|
+
*/
|
|
48
|
+
getSelfApplication(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApplicationSelfResponse>;
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
export class AuthApplicationApi extends runtime.BaseAPI implements AuthApplicationApiInterface {
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Return non-sensitive metadata about the application whose credentials authenticated this request. Lets an integrator read their own application_id (the sole tenant discriminator embedded in every end-user token) directly from the API, rather than only from the dashboard UI or by decoding a token. Returns only id, name, the calling environment\'s mode, and the JWT signing algorithm — never secrets, signing keys, or account-internal fields.
|
|
59
|
+
* Get the authenticating application
|
|
60
|
+
*/
|
|
61
|
+
async getSelfApplicationRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApplicationSelfResponse>> {
|
|
62
|
+
const queryParameters: any = {};
|
|
63
|
+
|
|
64
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
65
|
+
|
|
66
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
67
|
+
headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret"); // ApplicationSecret authentication
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
71
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const response = await this.request({
|
|
75
|
+
path: `/auth/application`,
|
|
76
|
+
method: 'GET',
|
|
77
|
+
headers: headerParameters,
|
|
78
|
+
query: queryParameters,
|
|
79
|
+
}, initOverrides);
|
|
80
|
+
|
|
81
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => ApplicationSelfResponseFromJSON(jsonValue));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Return non-sensitive metadata about the application whose credentials authenticated this request. Lets an integrator read their own application_id (the sole tenant discriminator embedded in every end-user token) directly from the API, rather than only from the dashboard UI or by decoding a token. Returns only id, name, the calling environment\'s mode, and the JWT signing algorithm — never secrets, signing keys, or account-internal fields.
|
|
86
|
+
* Get the authenticating application
|
|
87
|
+
*/
|
|
88
|
+
async getSelfApplication(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApplicationSelfResponse> {
|
|
89
|
+
const response = await this.getSelfApplicationRaw(initOverrides);
|
|
90
|
+
return await response.value();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
}
|
|
@@ -240,7 +240,7 @@ export interface AuthEmailTemplatesApiInterface {
|
|
|
240
240
|
restoreAuthEmailTemplateVersion(type: AuthEmailType, version: number, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateResponse>;
|
|
241
241
|
|
|
242
242
|
/**
|
|
243
|
-
* Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited.
|
|
243
|
+
* Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited. When non-empty, `test_recipients` gates ALL auth emails this application sends (magic link, password reset, email verification, and email OTP) — not just these test renders. Only listed recipients receive auth email; any other recipient is silently blocked. Use it to make a non-production application safe from mass sends. An empty allowlist (the default) imposes no restriction and every recipient receives auth email normally.
|
|
244
244
|
* @summary Send a test render of a template
|
|
245
245
|
* @param {AuthEmailType} type
|
|
246
246
|
* @param {AuthEmailTemplateTestRequest} authEmailTemplateTestRequest
|
|
@@ -251,7 +251,7 @@ export interface AuthEmailTemplatesApiInterface {
|
|
|
251
251
|
sendAuthEmailTemplateTestRaw(requestParameters: AuthEmailTemplatesApiSendAuthEmailTemplateTestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplateTestResponse>>;
|
|
252
252
|
|
|
253
253
|
/**
|
|
254
|
-
* Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited.
|
|
254
|
+
* Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited. When non-empty, `test_recipients` gates ALL auth emails this application sends (magic link, password reset, email verification, and email OTP) — not just these test renders. Only listed recipients receive auth email; any other recipient is silently blocked. Use it to make a non-production application safe from mass sends. An empty allowlist (the default) imposes no restriction and every recipient receives auth email normally.
|
|
255
255
|
* Send a test render of a template
|
|
256
256
|
*/
|
|
257
257
|
sendAuthEmailTemplateTest(type: AuthEmailType, authEmailTemplateTestRequest: AuthEmailTemplateTestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateTestResponse>;
|
|
@@ -629,7 +629,7 @@ export class AuthEmailTemplatesApi extends runtime.BaseAPI implements AuthEmailT
|
|
|
629
629
|
}
|
|
630
630
|
|
|
631
631
|
/**
|
|
632
|
-
* Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited.
|
|
632
|
+
* Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited. When non-empty, `test_recipients` gates ALL auth emails this application sends (magic link, password reset, email verification, and email OTP) — not just these test renders. Only listed recipients receive auth email; any other recipient is silently blocked. Use it to make a non-production application safe from mass sends. An empty allowlist (the default) imposes no restriction and every recipient receives auth email normally.
|
|
633
633
|
* Send a test render of a template
|
|
634
634
|
*/
|
|
635
635
|
async sendAuthEmailTemplateTestRaw(requestParameters: AuthEmailTemplatesApiSendAuthEmailTemplateTestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplateTestResponse>> {
|
|
@@ -673,7 +673,7 @@ export class AuthEmailTemplatesApi extends runtime.BaseAPI implements AuthEmailT
|
|
|
673
673
|
}
|
|
674
674
|
|
|
675
675
|
/**
|
|
676
|
-
* Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited.
|
|
676
|
+
* Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited. When non-empty, `test_recipients` gates ALL auth emails this application sends (magic link, password reset, email verification, and email OTP) — not just these test renders. Only listed recipients receive auth email; any other recipient is silently blocked. Use it to make a non-production application safe from mass sends. An empty allowlist (the default) imposes no restriction and every recipient receives auth email normally.
|
|
677
677
|
* Send a test render of a template
|
|
678
678
|
*/
|
|
679
679
|
async sendAuthEmailTemplateTest(type: AuthEmailType, authEmailTemplateTestRequest: AuthEmailTemplateTestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateTestResponse> {
|