@zyphr-dev/node-sdk 0.1.32 → 0.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2245 -117
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3139 -933
- package/dist/index.d.ts +3139 -933
- package/dist/index.js +2100 -117
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/.openapi-generator/FILES +30 -0
- package/src/client.ts +9 -0
- package/src/src/apis/AuthOrganizationsApi.ts +823 -0
- package/src/src/apis/AuthUserProfileApi.ts +62 -0
- package/src/src/apis/DomainsApi.ts +73 -0
- package/src/src/apis/InboundEmailApi.ts +264 -0
- package/src/src/apis/MuseApi.ts +531 -0
- package/src/src/apis/index.ts +3 -0
- package/src/src/models/AddOrganizationMemberRequest.ts +74 -0
- package/src/src/models/CreateOrganizationRequest.ts +82 -0
- package/src/src/models/InboundAttachmentUrlResponse.ts +88 -0
- package/src/src/models/InboundAttachmentUrlResponseData.ts +81 -0
- package/src/src/models/InboundEmail.ts +247 -0
- package/src/src/models/InboundEmailAttachment.ts +89 -0
- package/src/src/models/InboundEmailFrom.ts +73 -0
- package/src/src/models/InboundEmailListResponse.ts +88 -0
- package/src/src/models/InboundEmailListResponseMeta.ts +89 -0
- package/src/src/models/InboundEmailResponse.ts +88 -0
- package/src/src/models/LoginRequest.ts +12 -0
- package/src/src/models/Organization.ts +137 -0
- package/src/src/models/OrganizationListResponse.ts +90 -0
- package/src/src/models/OrganizationListResponseMeta.ts +73 -0
- package/src/src/models/OrganizationMembersListResponse.ts +90 -0
- package/src/src/models/OrganizationMembership.ts +119 -0
- package/src/src/models/OrganizationMembershipResponse.ts +90 -0
- package/src/src/models/OrganizationMembershipWithUser.ts +135 -0
- package/src/src/models/OrganizationResponse.ts +90 -0
- package/src/src/models/RegisterRequest.ts +23 -0
- package/src/src/models/SetDomainInboundRequest.ts +65 -0
- package/src/src/models/SwitchOrganizationRequest.ts +75 -0
- package/src/src/models/SwitchOrganizationResponse.ts +90 -0
- package/src/src/models/SwitchOrganizationResponseData.ts +99 -0
- package/src/src/models/SwitchOrganizationResponseDataTokens.ts +103 -0
- package/src/src/models/SwitchOrganizationResponseDataUser.ts +73 -0
- package/src/src/models/UpdateOrganizationMemberRoleRequest.ts +66 -0
- package/src/src/models/UpdateOrganizationRequest.ts +81 -0
- package/src/src/models/V1MuseSubjectsSuggestPostRequest.ts +105 -0
- package/src/src/models/index.ts +27 -0
|
@@ -31,6 +31,10 @@ import {
|
|
|
31
31
|
UpdateEndUserRequestToJSON,
|
|
32
32
|
} from '../models/index';
|
|
33
33
|
|
|
34
|
+
export interface AuthUserProfileApiDeleteEndUserByApplicationRequest {
|
|
35
|
+
userId: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
34
38
|
export interface AuthUserProfileApiUpdateEndUserOperationRequest {
|
|
35
39
|
updateEndUserRequest: UpdateEndUserRequest;
|
|
36
40
|
}
|
|
@@ -57,6 +61,22 @@ export interface AuthUserProfileApiInterface {
|
|
|
57
61
|
*/
|
|
58
62
|
deleteEndUser(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EndUserDeleteResponse>;
|
|
59
63
|
|
|
64
|
+
/**
|
|
65
|
+
* App-credentialed soft-delete for an end user, scoped to the test environment only. Live-mode credentials receive 403 — this is the intentional safety guard against a misconfigured CI runner nuking production users. Mirrors the self-service `DELETE /auth/users/me` flow: revokes all sessions, soft-deletes the row (status=\'deleted\'), and emits a `user.deleted` webhook with `method=\'application_admin\'`. The audit log row survives (no FK to end_users), so org-history queries still resolve. Intended for smoke / test-fixture cleanup. Production deletes should continue to use `DELETE /auth/users/me` from the end-user\'s own session or the dashboard.
|
|
66
|
+
* @summary Delete an end user (test environment only)
|
|
67
|
+
* @param {string} userId
|
|
68
|
+
* @param {*} [options] Override http request option.
|
|
69
|
+
* @throws {RequiredError}
|
|
70
|
+
* @memberof AuthUserProfileApiInterface
|
|
71
|
+
*/
|
|
72
|
+
deleteEndUserByApplicationRaw(requestParameters: AuthUserProfileApiDeleteEndUserByApplicationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* App-credentialed soft-delete for an end user, scoped to the test environment only. Live-mode credentials receive 403 — this is the intentional safety guard against a misconfigured CI runner nuking production users. Mirrors the self-service `DELETE /auth/users/me` flow: revokes all sessions, soft-deletes the row (status=\'deleted\'), and emits a `user.deleted` webhook with `method=\'application_admin\'`. The audit log row survives (no FK to end_users), so org-history queries still resolve. Intended for smoke / test-fixture cleanup. Production deletes should continue to use `DELETE /auth/users/me` from the end-user\'s own session or the dashboard.
|
|
76
|
+
* Delete an end user (test environment only)
|
|
77
|
+
*/
|
|
78
|
+
deleteEndUserByApplication(userId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
79
|
+
|
|
60
80
|
/**
|
|
61
81
|
* Retrieve the profile of the currently authenticated end user.
|
|
62
82
|
* @summary Get current end user profile
|
|
@@ -135,6 +155,48 @@ export class AuthUserProfileApi extends runtime.BaseAPI implements AuthUserProfi
|
|
|
135
155
|
return await response.value();
|
|
136
156
|
}
|
|
137
157
|
|
|
158
|
+
/**
|
|
159
|
+
* App-credentialed soft-delete for an end user, scoped to the test environment only. Live-mode credentials receive 403 — this is the intentional safety guard against a misconfigured CI runner nuking production users. Mirrors the self-service `DELETE /auth/users/me` flow: revokes all sessions, soft-deletes the row (status=\'deleted\'), and emits a `user.deleted` webhook with `method=\'application_admin\'`. The audit log row survives (no FK to end_users), so org-history queries still resolve. Intended for smoke / test-fixture cleanup. Production deletes should continue to use `DELETE /auth/users/me` from the end-user\'s own session or the dashboard.
|
|
160
|
+
* Delete an end user (test environment only)
|
|
161
|
+
*/
|
|
162
|
+
async deleteEndUserByApplicationRaw(requestParameters: AuthUserProfileApiDeleteEndUserByApplicationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
163
|
+
if (requestParameters['userId'] == null) {
|
|
164
|
+
throw new runtime.RequiredError(
|
|
165
|
+
'userId',
|
|
166
|
+
'Required parameter "userId" was null or undefined when calling deleteEndUserByApplication().'
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const queryParameters: any = {};
|
|
171
|
+
|
|
172
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
173
|
+
|
|
174
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
175
|
+
headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret"); // ApplicationSecret authentication
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
179
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const response = await this.request({
|
|
183
|
+
path: `/auth/users/{user_id}`.replace(`{${"user_id"}}`, encodeURIComponent(String(requestParameters['userId']))),
|
|
184
|
+
method: 'DELETE',
|
|
185
|
+
headers: headerParameters,
|
|
186
|
+
query: queryParameters,
|
|
187
|
+
}, initOverrides);
|
|
188
|
+
|
|
189
|
+
return new runtime.VoidApiResponse(response);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* App-credentialed soft-delete for an end user, scoped to the test environment only. Live-mode credentials receive 403 — this is the intentional safety guard against a misconfigured CI runner nuking production users. Mirrors the self-service `DELETE /auth/users/me` flow: revokes all sessions, soft-deletes the row (status=\'deleted\'), and emits a `user.deleted` webhook with `method=\'application_admin\'`. The audit log row survives (no FK to end_users), so org-history queries still resolve. Intended for smoke / test-fixture cleanup. Production deletes should continue to use `DELETE /auth/users/me` from the end-user\'s own session or the dashboard.
|
|
194
|
+
* Delete an end user (test environment only)
|
|
195
|
+
*/
|
|
196
|
+
async deleteEndUserByApplication(userId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
197
|
+
await this.deleteEndUserByApplicationRaw({ userId: userId }, initOverrides);
|
|
198
|
+
}
|
|
199
|
+
|
|
138
200
|
/**
|
|
139
201
|
* Retrieve the profile of the currently authenticated end user.
|
|
140
202
|
* Get current end user profile
|
|
@@ -21,6 +21,7 @@ import type {
|
|
|
21
21
|
DeleteDomainResponse,
|
|
22
22
|
DomainListResponse,
|
|
23
23
|
GetDomain200Response,
|
|
24
|
+
SetDomainInboundRequest,
|
|
24
25
|
VerificationStatusResponse,
|
|
25
26
|
VerifyDomainResponse,
|
|
26
27
|
} from '../models/index';
|
|
@@ -37,6 +38,8 @@ import {
|
|
|
37
38
|
DomainListResponseToJSON,
|
|
38
39
|
GetDomain200ResponseFromJSON,
|
|
39
40
|
GetDomain200ResponseToJSON,
|
|
41
|
+
SetDomainInboundRequestFromJSON,
|
|
42
|
+
SetDomainInboundRequestToJSON,
|
|
40
43
|
VerificationStatusResponseFromJSON,
|
|
41
44
|
VerificationStatusResponseToJSON,
|
|
42
45
|
VerifyDomainResponseFromJSON,
|
|
@@ -59,6 +62,11 @@ export interface DomainsApiGetDomainVerificationStatusRequest {
|
|
|
59
62
|
id: string;
|
|
60
63
|
}
|
|
61
64
|
|
|
65
|
+
export interface DomainsApiSetDomainInboundOperationRequest {
|
|
66
|
+
id: string;
|
|
67
|
+
setDomainInboundRequest: SetDomainInboundRequest;
|
|
68
|
+
}
|
|
69
|
+
|
|
62
70
|
export interface DomainsApiVerifyDomainRequest {
|
|
63
71
|
id: string;
|
|
64
72
|
}
|
|
@@ -149,6 +157,23 @@ export interface DomainsApiInterface {
|
|
|
149
157
|
*/
|
|
150
158
|
listDomains(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DomainListResponse>;
|
|
151
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Toggle email receiving for a domain. When enabled, the domain\'s DNS records gain an MX record on the `inbound.` subdomain that the tenant must publish. Requires a plan with inbound email (Starter+).
|
|
162
|
+
* @summary Enable or disable inbound email for a domain
|
|
163
|
+
* @param {string} id
|
|
164
|
+
* @param {SetDomainInboundRequest} setDomainInboundRequest
|
|
165
|
+
* @param {*} [options] Override http request option.
|
|
166
|
+
* @throws {RequiredError}
|
|
167
|
+
* @memberof DomainsApiInterface
|
|
168
|
+
*/
|
|
169
|
+
setDomainInboundRaw(requestParameters: DomainsApiSetDomainInboundOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Toggle email receiving for a domain. When enabled, the domain\'s DNS records gain an MX record on the `inbound.` subdomain that the tenant must publish. Requires a plan with inbound email (Starter+).
|
|
173
|
+
* Enable or disable inbound email for a domain
|
|
174
|
+
*/
|
|
175
|
+
setDomainInbound(id: string, setDomainInboundRequest: SetDomainInboundRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
176
|
+
|
|
152
177
|
/**
|
|
153
178
|
* Queue an asynchronous DNS verification check. Returns immediately with a `job_id`. Poll `GET /v1/domains/{id}/verification-status` (or the higher-level `GET /v1/domains/{id}`) for the result, or subscribe to the `domain.verified` webhook event when sc-5444 ships. Returns 409 if a verification is already in progress for this domain (within the last 2 minutes).
|
|
154
179
|
* @summary Trigger domain verification
|
|
@@ -363,6 +388,54 @@ export class DomainsApi extends runtime.BaseAPI implements DomainsApiInterface {
|
|
|
363
388
|
return await response.value();
|
|
364
389
|
}
|
|
365
390
|
|
|
391
|
+
/**
|
|
392
|
+
* Toggle email receiving for a domain. When enabled, the domain\'s DNS records gain an MX record on the `inbound.` subdomain that the tenant must publish. Requires a plan with inbound email (Starter+).
|
|
393
|
+
* Enable or disable inbound email for a domain
|
|
394
|
+
*/
|
|
395
|
+
async setDomainInboundRaw(requestParameters: DomainsApiSetDomainInboundOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
396
|
+
if (requestParameters['id'] == null) {
|
|
397
|
+
throw new runtime.RequiredError(
|
|
398
|
+
'id',
|
|
399
|
+
'Required parameter "id" was null or undefined when calling setDomainInbound().'
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
if (requestParameters['setDomainInboundRequest'] == null) {
|
|
404
|
+
throw new runtime.RequiredError(
|
|
405
|
+
'setDomainInboundRequest',
|
|
406
|
+
'Required parameter "setDomainInboundRequest" was null or undefined when calling setDomainInbound().'
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
const queryParameters: any = {};
|
|
411
|
+
|
|
412
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
413
|
+
|
|
414
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
415
|
+
|
|
416
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
417
|
+
headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
const response = await this.request({
|
|
421
|
+
path: `/domains/{id}/inbound`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
|
|
422
|
+
method: 'PUT',
|
|
423
|
+
headers: headerParameters,
|
|
424
|
+
query: queryParameters,
|
|
425
|
+
body: SetDomainInboundRequestToJSON(requestParameters['setDomainInboundRequest']),
|
|
426
|
+
}, initOverrides);
|
|
427
|
+
|
|
428
|
+
return new runtime.VoidApiResponse(response);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Toggle email receiving for a domain. When enabled, the domain\'s DNS records gain an MX record on the `inbound.` subdomain that the tenant must publish. Requires a plan with inbound email (Starter+).
|
|
433
|
+
* Enable or disable inbound email for a domain
|
|
434
|
+
*/
|
|
435
|
+
async setDomainInbound(id: string, setDomainInboundRequest: SetDomainInboundRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
436
|
+
await this.setDomainInboundRaw({ id: id, setDomainInboundRequest: setDomainInboundRequest }, initOverrides);
|
|
437
|
+
}
|
|
438
|
+
|
|
366
439
|
/**
|
|
367
440
|
* Queue an asynchronous DNS verification check. Returns immediately with a `job_id`. Poll `GET /v1/domains/{id}/verification-status` (or the higher-level `GET /v1/domains/{id}`) for the result, or subscribe to the `domain.verified` webhook event when sc-5444 ships. Returns 409 if a verification is already in progress for this domain (within the last 2 minutes).
|
|
368
441
|
* Trigger domain verification
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Zyphr API
|
|
5
|
+
* Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
* Contact: support@zyphr.dev
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
import * as runtime from '../runtime';
|
|
17
|
+
import type {
|
|
18
|
+
InboundAttachmentUrlResponse,
|
|
19
|
+
InboundEmailListResponse,
|
|
20
|
+
InboundEmailResponse,
|
|
21
|
+
} from '../models/index';
|
|
22
|
+
import {
|
|
23
|
+
InboundAttachmentUrlResponseFromJSON,
|
|
24
|
+
InboundAttachmentUrlResponseToJSON,
|
|
25
|
+
InboundEmailListResponseFromJSON,
|
|
26
|
+
InboundEmailListResponseToJSON,
|
|
27
|
+
InboundEmailResponseFromJSON,
|
|
28
|
+
InboundEmailResponseToJSON,
|
|
29
|
+
} from '../models/index';
|
|
30
|
+
|
|
31
|
+
export interface InboundEmailApiGetInboundAttachmentUrlRequest {
|
|
32
|
+
id: string;
|
|
33
|
+
attachmentId: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface InboundEmailApiGetInboundEmailRequest {
|
|
37
|
+
id: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface InboundEmailApiListInboundEmailsRequest {
|
|
41
|
+
status?: ListInboundEmailsStatusEnum;
|
|
42
|
+
to?: string;
|
|
43
|
+
includeWithheld?: boolean;
|
|
44
|
+
limit?: number;
|
|
45
|
+
offset?: number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* InboundEmailApi - interface
|
|
50
|
+
*
|
|
51
|
+
* @export
|
|
52
|
+
* @interface InboundEmailApiInterface
|
|
53
|
+
*/
|
|
54
|
+
export interface InboundEmailApiInterface {
|
|
55
|
+
/**
|
|
56
|
+
* Return a short-lived presigned S3 download URL for one attachment of a received email. `attachmentId` is the positional id from the email\'s `attachments` array.
|
|
57
|
+
* @summary Get an attachment download URL
|
|
58
|
+
* @param {string} id
|
|
59
|
+
* @param {string} attachmentId
|
|
60
|
+
* @param {*} [options] Override http request option.
|
|
61
|
+
* @throws {RequiredError}
|
|
62
|
+
* @memberof InboundEmailApiInterface
|
|
63
|
+
*/
|
|
64
|
+
getInboundAttachmentUrlRaw(requestParameters: InboundEmailApiGetInboundAttachmentUrlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<InboundAttachmentUrlResponse>>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Return a short-lived presigned S3 download URL for one attachment of a received email. `attachmentId` is the positional id from the email\'s `attachments` array.
|
|
68
|
+
* Get an attachment download URL
|
|
69
|
+
*/
|
|
70
|
+
getInboundAttachmentUrl(id: string, attachmentId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<InboundAttachmentUrlResponse>;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Retrieve a single inbound email by id (scoped to the project).
|
|
74
|
+
* @summary Get a received email
|
|
75
|
+
* @param {string} id
|
|
76
|
+
* @param {*} [options] Override http request option.
|
|
77
|
+
* @throws {RequiredError}
|
|
78
|
+
* @memberof InboundEmailApiInterface
|
|
79
|
+
*/
|
|
80
|
+
getInboundEmailRaw(requestParameters: InboundEmailApiGetInboundEmailRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<InboundEmailResponse>>;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Retrieve a single inbound email by id (scoped to the project).
|
|
84
|
+
* Get a received email
|
|
85
|
+
*/
|
|
86
|
+
getInboundEmail(id: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<InboundEmailResponse>;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* List inbound (received) emails for the project, newest first. By default only delivered mail (`received`/`processed`) is returned; pass `include_withheld=true` to also see quarantined/dropped.
|
|
90
|
+
* @summary List received emails
|
|
91
|
+
* @param {'received' | 'processed' | 'quarantined' | 'dropped' | 'failed'} [status]
|
|
92
|
+
* @param {string} [to] Filter by receiving address
|
|
93
|
+
* @param {boolean} [includeWithheld] Include quarantined/dropped mail
|
|
94
|
+
* @param {number} [limit]
|
|
95
|
+
* @param {number} [offset]
|
|
96
|
+
* @param {*} [options] Override http request option.
|
|
97
|
+
* @throws {RequiredError}
|
|
98
|
+
* @memberof InboundEmailApiInterface
|
|
99
|
+
*/
|
|
100
|
+
listInboundEmailsRaw(requestParameters: InboundEmailApiListInboundEmailsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<InboundEmailListResponse>>;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* List inbound (received) emails for the project, newest first. By default only delivered mail (`received`/`processed`) is returned; pass `include_withheld=true` to also see quarantined/dropped.
|
|
104
|
+
* List received emails
|
|
105
|
+
*/
|
|
106
|
+
listInboundEmails(status?: ListInboundEmailsStatusEnum, to?: string, includeWithheld?: boolean, limit?: number, offset?: number, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<InboundEmailListResponse>;
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
*
|
|
112
|
+
*/
|
|
113
|
+
export class InboundEmailApi extends runtime.BaseAPI implements InboundEmailApiInterface {
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Return a short-lived presigned S3 download URL for one attachment of a received email. `attachmentId` is the positional id from the email\'s `attachments` array.
|
|
117
|
+
* Get an attachment download URL
|
|
118
|
+
*/
|
|
119
|
+
async getInboundAttachmentUrlRaw(requestParameters: InboundEmailApiGetInboundAttachmentUrlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<InboundAttachmentUrlResponse>> {
|
|
120
|
+
if (requestParameters['id'] == null) {
|
|
121
|
+
throw new runtime.RequiredError(
|
|
122
|
+
'id',
|
|
123
|
+
'Required parameter "id" was null or undefined when calling getInboundAttachmentUrl().'
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (requestParameters['attachmentId'] == null) {
|
|
128
|
+
throw new runtime.RequiredError(
|
|
129
|
+
'attachmentId',
|
|
130
|
+
'Required parameter "attachmentId" was null or undefined when calling getInboundAttachmentUrl().'
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const queryParameters: any = {};
|
|
135
|
+
|
|
136
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
137
|
+
|
|
138
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
139
|
+
headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const response = await this.request({
|
|
143
|
+
path: `/inbound-emails/{id}/attachments/{attachmentId}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))).replace(`{${"attachmentId"}}`, encodeURIComponent(String(requestParameters['attachmentId']))),
|
|
144
|
+
method: 'GET',
|
|
145
|
+
headers: headerParameters,
|
|
146
|
+
query: queryParameters,
|
|
147
|
+
}, initOverrides);
|
|
148
|
+
|
|
149
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => InboundAttachmentUrlResponseFromJSON(jsonValue));
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Return a short-lived presigned S3 download URL for one attachment of a received email. `attachmentId` is the positional id from the email\'s `attachments` array.
|
|
154
|
+
* Get an attachment download URL
|
|
155
|
+
*/
|
|
156
|
+
async getInboundAttachmentUrl(id: string, attachmentId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<InboundAttachmentUrlResponse> {
|
|
157
|
+
const response = await this.getInboundAttachmentUrlRaw({ id: id, attachmentId: attachmentId }, initOverrides);
|
|
158
|
+
return await response.value();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Retrieve a single inbound email by id (scoped to the project).
|
|
163
|
+
* Get a received email
|
|
164
|
+
*/
|
|
165
|
+
async getInboundEmailRaw(requestParameters: InboundEmailApiGetInboundEmailRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<InboundEmailResponse>> {
|
|
166
|
+
if (requestParameters['id'] == null) {
|
|
167
|
+
throw new runtime.RequiredError(
|
|
168
|
+
'id',
|
|
169
|
+
'Required parameter "id" was null or undefined when calling getInboundEmail().'
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const queryParameters: any = {};
|
|
174
|
+
|
|
175
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
176
|
+
|
|
177
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
178
|
+
headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const response = await this.request({
|
|
182
|
+
path: `/inbound-emails/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
|
|
183
|
+
method: 'GET',
|
|
184
|
+
headers: headerParameters,
|
|
185
|
+
query: queryParameters,
|
|
186
|
+
}, initOverrides);
|
|
187
|
+
|
|
188
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => InboundEmailResponseFromJSON(jsonValue));
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Retrieve a single inbound email by id (scoped to the project).
|
|
193
|
+
* Get a received email
|
|
194
|
+
*/
|
|
195
|
+
async getInboundEmail(id: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<InboundEmailResponse> {
|
|
196
|
+
const response = await this.getInboundEmailRaw({ id: id }, initOverrides);
|
|
197
|
+
return await response.value();
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* List inbound (received) emails for the project, newest first. By default only delivered mail (`received`/`processed`) is returned; pass `include_withheld=true` to also see quarantined/dropped.
|
|
202
|
+
* List received emails
|
|
203
|
+
*/
|
|
204
|
+
async listInboundEmailsRaw(requestParameters: InboundEmailApiListInboundEmailsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<InboundEmailListResponse>> {
|
|
205
|
+
const queryParameters: any = {};
|
|
206
|
+
|
|
207
|
+
if (requestParameters['status'] != null) {
|
|
208
|
+
queryParameters['status'] = requestParameters['status'];
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (requestParameters['to'] != null) {
|
|
212
|
+
queryParameters['to'] = requestParameters['to'];
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (requestParameters['includeWithheld'] != null) {
|
|
216
|
+
queryParameters['include_withheld'] = requestParameters['includeWithheld'];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (requestParameters['limit'] != null) {
|
|
220
|
+
queryParameters['limit'] = requestParameters['limit'];
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (requestParameters['offset'] != null) {
|
|
224
|
+
queryParameters['offset'] = requestParameters['offset'];
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
228
|
+
|
|
229
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
230
|
+
headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const response = await this.request({
|
|
234
|
+
path: `/inbound-emails`,
|
|
235
|
+
method: 'GET',
|
|
236
|
+
headers: headerParameters,
|
|
237
|
+
query: queryParameters,
|
|
238
|
+
}, initOverrides);
|
|
239
|
+
|
|
240
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => InboundEmailListResponseFromJSON(jsonValue));
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* List inbound (received) emails for the project, newest first. By default only delivered mail (`received`/`processed`) is returned; pass `include_withheld=true` to also see quarantined/dropped.
|
|
245
|
+
* List received emails
|
|
246
|
+
*/
|
|
247
|
+
async listInboundEmails(status?: ListInboundEmailsStatusEnum, to?: string, includeWithheld?: boolean, limit?: number, offset?: number, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<InboundEmailListResponse> {
|
|
248
|
+
const response = await this.listInboundEmailsRaw({ status: status, to: to, includeWithheld: includeWithheld, limit: limit, offset: offset }, initOverrides);
|
|
249
|
+
return await response.value();
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* @export
|
|
256
|
+
*/
|
|
257
|
+
export const ListInboundEmailsStatusEnum = {
|
|
258
|
+
RECEIVED: 'received',
|
|
259
|
+
PROCESSED: 'processed',
|
|
260
|
+
QUARANTINED: 'quarantined',
|
|
261
|
+
DROPPED: 'dropped',
|
|
262
|
+
FAILED: 'failed'
|
|
263
|
+
} as const;
|
|
264
|
+
export type ListInboundEmailsStatusEnum = typeof ListInboundEmailsStatusEnum[keyof typeof ListInboundEmailsStatusEnum];
|