ark-email 0.5.1
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/CHANGELOG.md +70 -0
- package/LICENSE +201 -0
- package/README.md +431 -0
- package/api-promise.d.mts +2 -0
- package/api-promise.d.mts.map +1 -0
- package/api-promise.d.ts +2 -0
- package/api-promise.d.ts.map +1 -0
- package/api-promise.js +6 -0
- package/api-promise.js.map +1 -0
- package/api-promise.mjs +2 -0
- package/api-promise.mjs.map +1 -0
- package/client.d.mts +204 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +204 -0
- package/client.d.ts.map +1 -0
- package/client.js +481 -0
- package/client.js.map +1 -0
- package/client.mjs +477 -0
- package/client.mjs.map +1 -0
- package/core/api-promise.d.mts +46 -0
- package/core/api-promise.d.mts.map +1 -0
- package/core/api-promise.d.ts +46 -0
- package/core/api-promise.d.ts.map +1 -0
- package/core/api-promise.js +74 -0
- package/core/api-promise.js.map +1 -0
- package/core/api-promise.mjs +70 -0
- package/core/api-promise.mjs.map +1 -0
- package/core/error.d.mts +46 -0
- package/core/error.d.mts.map +1 -0
- package/core/error.d.ts +46 -0
- package/core/error.d.ts.map +1 -0
- package/core/error.js +113 -0
- package/core/error.js.map +1 -0
- package/core/error.mjs +97 -0
- package/core/error.mjs.map +1 -0
- package/core/pagination.d.mts +67 -0
- package/core/pagination.d.mts.map +1 -0
- package/core/pagination.d.ts +67 -0
- package/core/pagination.d.ts.map +1 -0
- package/core/pagination.js +105 -0
- package/core/pagination.js.map +1 -0
- package/core/pagination.mjs +99 -0
- package/core/pagination.mjs.map +1 -0
- package/core/resource.d.mts +6 -0
- package/core/resource.d.mts.map +1 -0
- package/core/resource.d.ts +6 -0
- package/core/resource.d.ts.map +1 -0
- package/core/resource.js +11 -0
- package/core/resource.js.map +1 -0
- package/core/resource.mjs +7 -0
- package/core/resource.mjs.map +1 -0
- package/core/uploads.d.mts +3 -0
- package/core/uploads.d.mts.map +1 -0
- package/core/uploads.d.ts +3 -0
- package/core/uploads.d.ts.map +1 -0
- package/core/uploads.js +6 -0
- package/core/uploads.js.map +1 -0
- package/core/uploads.mjs +2 -0
- package/core/uploads.mjs.map +1 -0
- package/error.d.mts +2 -0
- package/error.d.mts.map +1 -0
- package/error.d.ts +2 -0
- package/error.d.ts.map +1 -0
- package/error.js +6 -0
- package/error.js.map +1 -0
- package/error.mjs +2 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +7 -0
- package/index.d.mts.map +1 -0
- package/index.d.ts +7 -0
- package/index.d.ts.map +1 -0
- package/index.js +32 -0
- package/index.js.map +1 -0
- package/index.mjs +8 -0
- package/index.mjs.map +1 -0
- package/internal/builtin-types.d.mts +73 -0
- package/internal/builtin-types.d.mts.map +1 -0
- package/internal/builtin-types.d.ts +73 -0
- package/internal/builtin-types.d.ts.map +1 -0
- package/internal/builtin-types.js +4 -0
- package/internal/builtin-types.js.map +1 -0
- package/internal/builtin-types.mjs +3 -0
- package/internal/builtin-types.mjs.map +1 -0
- package/internal/detect-platform.d.mts +15 -0
- package/internal/detect-platform.d.mts.map +1 -0
- package/internal/detect-platform.d.ts +15 -0
- package/internal/detect-platform.d.ts.map +1 -0
- package/internal/detect-platform.js +162 -0
- package/internal/detect-platform.js.map +1 -0
- package/internal/detect-platform.mjs +157 -0
- package/internal/detect-platform.mjs.map +1 -0
- package/internal/errors.d.mts +3 -0
- package/internal/errors.d.mts.map +1 -0
- package/internal/errors.d.ts +3 -0
- package/internal/errors.d.ts.map +1 -0
- package/internal/errors.js +41 -0
- package/internal/errors.js.map +1 -0
- package/internal/errors.mjs +36 -0
- package/internal/errors.mjs.map +1 -0
- package/internal/headers.d.mts +20 -0
- package/internal/headers.d.mts.map +1 -0
- package/internal/headers.d.ts +20 -0
- package/internal/headers.d.ts.map +1 -0
- package/internal/headers.js +79 -0
- package/internal/headers.js.map +1 -0
- package/internal/headers.mjs +74 -0
- package/internal/headers.mjs.map +1 -0
- package/internal/parse.d.mts +12 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +12 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +35 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +32 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/request-options.d.mts +75 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +75 -0
- package/internal/request-options.d.ts.map +1 -0
- package/internal/request-options.js +14 -0
- package/internal/request-options.js.map +1 -0
- package/internal/request-options.mjs +10 -0
- package/internal/request-options.mjs.map +1 -0
- package/internal/shim-types.d.mts +17 -0
- package/internal/shim-types.d.mts.map +1 -0
- package/internal/shim-types.d.ts +17 -0
- package/internal/shim-types.d.ts.map +1 -0
- package/internal/shim-types.js +4 -0
- package/internal/shim-types.js.map +1 -0
- package/internal/shim-types.mjs +3 -0
- package/internal/shim-types.mjs.map +1 -0
- package/internal/shims.d.mts +20 -0
- package/internal/shims.d.mts.map +1 -0
- package/internal/shims.d.ts +20 -0
- package/internal/shims.d.ts.map +1 -0
- package/internal/shims.js +92 -0
- package/internal/shims.js.map +1 -0
- package/internal/shims.mjs +85 -0
- package/internal/shims.mjs.map +1 -0
- package/internal/to-file.d.mts +45 -0
- package/internal/to-file.d.mts.map +1 -0
- package/internal/to-file.d.ts +45 -0
- package/internal/to-file.d.ts.map +1 -0
- package/internal/to-file.js +91 -0
- package/internal/to-file.js.map +1 -0
- package/internal/to-file.mjs +88 -0
- package/internal/to-file.mjs.map +1 -0
- package/internal/tslib.js +81 -0
- package/internal/tslib.mjs +17 -0
- package/internal/types.d.mts +69 -0
- package/internal/types.d.mts.map +1 -0
- package/internal/types.d.ts +69 -0
- package/internal/types.d.ts.map +1 -0
- package/internal/types.js +4 -0
- package/internal/types.js.map +1 -0
- package/internal/types.mjs +3 -0
- package/internal/types.mjs.map +1 -0
- package/internal/uploads.d.mts +42 -0
- package/internal/uploads.d.mts.map +1 -0
- package/internal/uploads.d.ts +42 -0
- package/internal/uploads.d.ts.map +1 -0
- package/internal/uploads.js +141 -0
- package/internal/uploads.js.map +1 -0
- package/internal/uploads.mjs +131 -0
- package/internal/uploads.mjs.map +1 -0
- package/internal/utils/base64.d.mts +3 -0
- package/internal/utils/base64.d.mts.map +1 -0
- package/internal/utils/base64.d.ts +3 -0
- package/internal/utils/base64.d.ts.map +1 -0
- package/internal/utils/base64.js +38 -0
- package/internal/utils/base64.js.map +1 -0
- package/internal/utils/base64.mjs +33 -0
- package/internal/utils/base64.mjs.map +1 -0
- package/internal/utils/bytes.d.mts +4 -0
- package/internal/utils/bytes.d.mts.map +1 -0
- package/internal/utils/bytes.d.ts +4 -0
- package/internal/utils/bytes.d.ts.map +1 -0
- package/internal/utils/bytes.js +31 -0
- package/internal/utils/bytes.js.map +1 -0
- package/internal/utils/bytes.mjs +26 -0
- package/internal/utils/bytes.mjs.map +1 -0
- package/internal/utils/env.d.mts +9 -0
- package/internal/utils/env.d.mts.map +1 -0
- package/internal/utils/env.d.ts +9 -0
- package/internal/utils/env.d.ts.map +1 -0
- package/internal/utils/env.js +22 -0
- package/internal/utils/env.js.map +1 -0
- package/internal/utils/env.mjs +18 -0
- package/internal/utils/env.mjs.map +1 -0
- package/internal/utils/log.d.mts +37 -0
- package/internal/utils/log.d.mts.map +1 -0
- package/internal/utils/log.d.ts +37 -0
- package/internal/utils/log.d.ts.map +1 -0
- package/internal/utils/log.js +85 -0
- package/internal/utils/log.js.map +1 -0
- package/internal/utils/log.mjs +79 -0
- package/internal/utils/log.mjs.map +1 -0
- package/internal/utils/path.d.mts +15 -0
- package/internal/utils/path.d.mts.map +1 -0
- package/internal/utils/path.d.ts +15 -0
- package/internal/utils/path.d.ts.map +1 -0
- package/internal/utils/path.js +79 -0
- package/internal/utils/path.js.map +1 -0
- package/internal/utils/path.mjs +74 -0
- package/internal/utils/path.mjs.map +1 -0
- package/internal/utils/sleep.d.mts +2 -0
- package/internal/utils/sleep.d.mts.map +1 -0
- package/internal/utils/sleep.d.ts +2 -0
- package/internal/utils/sleep.d.ts.map +1 -0
- package/internal/utils/sleep.js +7 -0
- package/internal/utils/sleep.js.map +1 -0
- package/internal/utils/sleep.mjs +3 -0
- package/internal/utils/sleep.mjs.map +1 -0
- package/internal/utils/uuid.d.mts +5 -0
- package/internal/utils/uuid.d.mts.map +1 -0
- package/internal/utils/uuid.d.ts +5 -0
- package/internal/utils/uuid.d.ts.map +1 -0
- package/internal/utils/uuid.js +19 -0
- package/internal/utils/uuid.js.map +1 -0
- package/internal/utils/uuid.mjs +15 -0
- package/internal/utils/uuid.mjs.map +1 -0
- package/internal/utils/values.d.mts +18 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +18 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +112 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +94 -0
- package/internal/utils/values.mjs.map +1 -0
- package/internal/utils.d.mts +7 -0
- package/internal/utils.d.mts.map +1 -0
- package/internal/utils.d.ts +7 -0
- package/internal/utils.d.ts.map +1 -0
- package/internal/utils.js +11 -0
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +8 -0
- package/internal/utils.mjs.map +1 -0
- package/package.json +147 -0
- package/pagination.d.mts +2 -0
- package/pagination.d.mts.map +1 -0
- package/pagination.d.ts +2 -0
- package/pagination.d.ts.map +1 -0
- package/pagination.js +6 -0
- package/pagination.js.map +1 -0
- package/pagination.mjs +2 -0
- package/pagination.mjs.map +1 -0
- package/resource.d.mts +2 -0
- package/resource.d.mts.map +1 -0
- package/resource.d.ts +2 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +6 -0
- package/resource.js.map +1 -0
- package/resource.mjs +2 -0
- package/resource.mjs.map +1 -0
- package/resources/domains.d.mts +238 -0
- package/resources/domains.d.mts.map +1 -0
- package/resources/domains.d.ts +238 -0
- package/resources/domains.d.ts.map +1 -0
- package/resources/domains.js +82 -0
- package/resources/domains.js.map +1 -0
- package/resources/domains.mjs +78 -0
- package/resources/domains.mjs.map +1 -0
- package/resources/emails.d.mts +602 -0
- package/resources/emails.d.mts.map +1 -0
- package/resources/emails.d.ts +602 -0
- package/resources/emails.d.ts.map +1 -0
- package/resources/emails.js +173 -0
- package/resources/emails.js.map +1 -0
- package/resources/emails.mjs +169 -0
- package/resources/emails.mjs.map +1 -0
- package/resources/index.d.mts +7 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts +7 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +17 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +8 -0
- package/resources/index.mjs.map +1 -0
- package/resources/shared.d.mts +7 -0
- package/resources/shared.d.mts.map +1 -0
- package/resources/shared.d.ts +7 -0
- package/resources/shared.d.ts.map +1 -0
- package/resources/shared.js +4 -0
- package/resources/shared.js.map +1 -0
- package/resources/shared.mjs +3 -0
- package/resources/shared.mjs.map +1 -0
- package/resources/suppressions.d.mts +181 -0
- package/resources/suppressions.d.mts.map +1 -0
- package/resources/suppressions.d.ts +181 -0
- package/resources/suppressions.d.ts.map +1 -0
- package/resources/suppressions.js +84 -0
- package/resources/suppressions.js.map +1 -0
- package/resources/suppressions.mjs +80 -0
- package/resources/suppressions.mjs.map +1 -0
- package/resources/tracking.d.mts +288 -0
- package/resources/tracking.d.mts.map +1 -0
- package/resources/tracking.d.ts +288 -0
- package/resources/tracking.d.ts.map +1 -0
- package/resources/tracking.js +96 -0
- package/resources/tracking.js.map +1 -0
- package/resources/tracking.mjs +92 -0
- package/resources/tracking.mjs.map +1 -0
- package/resources/webhooks.d.mts +307 -0
- package/resources/webhooks.d.mts.map +1 -0
- package/resources/webhooks.d.ts +307 -0
- package/resources/webhooks.d.ts.map +1 -0
- package/resources/webhooks.js +108 -0
- package/resources/webhooks.js.map +1 -0
- package/resources/webhooks.mjs +104 -0
- package/resources/webhooks.mjs.map +1 -0
- package/resources.d.mts +2 -0
- package/resources.d.mts.map +1 -0
- package/resources.d.ts +2 -0
- package/resources.d.ts.map +1 -0
- package/resources.js +5 -0
- package/resources.js.map +1 -0
- package/resources.mjs +2 -0
- package/resources.mjs.map +1 -0
- package/src/api-promise.ts +2 -0
- package/src/client.ts +898 -0
- package/src/core/README.md +3 -0
- package/src/core/api-promise.ts +89 -0
- package/src/core/error.ts +130 -0
- package/src/core/pagination.ts +187 -0
- package/src/core/resource.ts +11 -0
- package/src/core/uploads.ts +2 -0
- package/src/error.ts +2 -0
- package/src/index.ts +23 -0
- package/src/internal/README.md +3 -0
- package/src/internal/builtin-types.ts +93 -0
- package/src/internal/detect-platform.ts +196 -0
- package/src/internal/errors.ts +33 -0
- package/src/internal/headers.ts +97 -0
- package/src/internal/parse.ts +50 -0
- package/src/internal/request-options.ts +91 -0
- package/src/internal/shim-types.ts +26 -0
- package/src/internal/shims.ts +107 -0
- package/src/internal/to-file.ts +154 -0
- package/src/internal/types.ts +95 -0
- package/src/internal/uploads.ts +187 -0
- package/src/internal/utils/base64.ts +40 -0
- package/src/internal/utils/bytes.ts +32 -0
- package/src/internal/utils/env.ts +18 -0
- package/src/internal/utils/log.ts +126 -0
- package/src/internal/utils/path.ts +88 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +17 -0
- package/src/internal/utils/values.ts +105 -0
- package/src/internal/utils.ts +8 -0
- package/src/lib/.keep +4 -0
- package/src/pagination.ts +2 -0
- package/src/resource.ts +2 -0
- package/src/resources/domains.ts +320 -0
- package/src/resources/emails.ts +770 -0
- package/src/resources/index.ts +65 -0
- package/src/resources/shared.ts +8 -0
- package/src/resources/suppressions.ts +253 -0
- package/src/resources/tracking.ts +380 -0
- package/src/resources/webhooks.ts +456 -0
- package/src/resources.ts +1 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +2 -0
- package/src/version.ts +1 -0
- package/uploads.d.mts +2 -0
- package/uploads.d.mts.map +1 -0
- package/uploads.d.ts +2 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +6 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +2 -0
- package/uploads.mjs.map +1 -0
- package/version.d.mts +2 -0
- package/version.d.mts.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Emails = void 0;
|
|
5
|
+
const resource_1 = require("../core/resource.js");
|
|
6
|
+
const pagination_1 = require("../core/pagination.js");
|
|
7
|
+
const headers_1 = require("../internal/headers.js");
|
|
8
|
+
const path_1 = require("../internal/utils/path.js");
|
|
9
|
+
class Emails extends resource_1.APIResource {
|
|
10
|
+
/**
|
|
11
|
+
* Retrieve detailed information about a specific email including delivery status,
|
|
12
|
+
* timestamps, and optionally the email content.
|
|
13
|
+
*
|
|
14
|
+
* Use the `expand` parameter to include additional data like the HTML/text body,
|
|
15
|
+
* headers, or delivery attempts.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const email = await client.emails.retrieve('emailId');
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
retrieve(emailID, query = {}, options) {
|
|
23
|
+
return this._client.get((0, path_1.path) `/emails/${emailID}`, { query, ...options });
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Retrieve a paginated list of sent emails. Results are ordered by send time,
|
|
27
|
+
* newest first.
|
|
28
|
+
*
|
|
29
|
+
* Use filters to narrow down results by status, recipient, sender, or tag.
|
|
30
|
+
*
|
|
31
|
+
* **Related endpoints:**
|
|
32
|
+
*
|
|
33
|
+
* - `GET /emails/{id}` - Get full details of a specific email
|
|
34
|
+
* - `POST /emails` - Send a new email
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* // Automatically fetches more pages as needed.
|
|
39
|
+
* for await (const emailListResponse of client.emails.list()) {
|
|
40
|
+
* // ...
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
list(query = {}, options) {
|
|
45
|
+
return this._client.getAPIList('/emails', (pagination_1.PageNumberPagination), { query, ...options });
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Get the history of delivery attempts for an email, including SMTP response codes
|
|
49
|
+
* and timestamps.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const response = await client.emails.retrieveDeliveries(
|
|
54
|
+
* 'emailId',
|
|
55
|
+
* );
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
retrieveDeliveries(emailID, options) {
|
|
59
|
+
return this._client.get((0, path_1.path) `/emails/${emailID}/deliveries`, options);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Retry delivery of a failed or soft-bounced email. Creates a new delivery
|
|
63
|
+
* attempt.
|
|
64
|
+
*
|
|
65
|
+
* Only works for emails that have failed or are in a retryable state.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* const response = await client.emails.retry('emailId');
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
retry(emailID, options) {
|
|
73
|
+
return this._client.post((0, path_1.path) `/emails/${emailID}/retry`, options);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Send a single email message. The email is accepted for immediate delivery and
|
|
77
|
+
* typically delivered within seconds.
|
|
78
|
+
*
|
|
79
|
+
* **Example use case:** Send a password reset email to a user.
|
|
80
|
+
*
|
|
81
|
+
* **Required fields:** `from`, `to`, `subject`, and either `html` or `text`
|
|
82
|
+
*
|
|
83
|
+
* **Idempotency:** Supports `Idempotency-Key` header for safe retries.
|
|
84
|
+
*
|
|
85
|
+
* **Related endpoints:**
|
|
86
|
+
*
|
|
87
|
+
* - `GET /emails/{id}` - Track delivery status
|
|
88
|
+
* - `GET /emails/{id}/deliveries` - View delivery attempts
|
|
89
|
+
* - `POST /emails/{id}/retry` - Retry failed delivery
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* const response = await client.emails.send({
|
|
94
|
+
* from: 'Acme <hello@acme.com>',
|
|
95
|
+
* subject: 'Hello World',
|
|
96
|
+
* to: ['user@example.com'],
|
|
97
|
+
* html: '<h1>Welcome!</h1><p>Thanks for signing up.</p>',
|
|
98
|
+
* });
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
send(params, options) {
|
|
102
|
+
const { 'Idempotency-Key': idempotencyKey, ...body } = params;
|
|
103
|
+
return this._client.post('/emails', {
|
|
104
|
+
body,
|
|
105
|
+
...options,
|
|
106
|
+
headers: (0, headers_1.buildHeaders)([
|
|
107
|
+
{ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined) },
|
|
108
|
+
options?.headers,
|
|
109
|
+
]),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Send up to 100 emails in a single request. Useful for sending personalized
|
|
114
|
+
* emails to multiple recipients efficiently.
|
|
115
|
+
*
|
|
116
|
+
* Each email in the batch can have different content and recipients. Failed emails
|
|
117
|
+
* don't affect other emails in the batch.
|
|
118
|
+
*
|
|
119
|
+
* **Idempotency:** Supports `Idempotency-Key` header for safe retries.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* const response = await client.emails.sendBatch({
|
|
124
|
+
* emails: [
|
|
125
|
+
* {
|
|
126
|
+
* to: ['alice@example.com'],
|
|
127
|
+
* subject: 'Hello Alice',
|
|
128
|
+
* html: '<p>Hi Alice, your order is ready!</p>',
|
|
129
|
+
* tag: 'order-ready',
|
|
130
|
+
* },
|
|
131
|
+
* {
|
|
132
|
+
* to: ['bob@example.com'],
|
|
133
|
+
* subject: 'Hello Bob',
|
|
134
|
+
* html: '<p>Hi Bob, your order is ready!</p>',
|
|
135
|
+
* tag: 'order-ready',
|
|
136
|
+
* },
|
|
137
|
+
* ],
|
|
138
|
+
* from: 'notifications@myapp.com',
|
|
139
|
+
* });
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
sendBatch(params, options) {
|
|
143
|
+
const { 'Idempotency-Key': idempotencyKey, ...body } = params;
|
|
144
|
+
return this._client.post('/emails/batch', {
|
|
145
|
+
body,
|
|
146
|
+
...options,
|
|
147
|
+
headers: (0, headers_1.buildHeaders)([
|
|
148
|
+
{ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined) },
|
|
149
|
+
options?.headers,
|
|
150
|
+
]),
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Send a pre-formatted RFC 2822 MIME message. Use this for advanced use cases or
|
|
155
|
+
* when migrating from systems that generate raw email content.
|
|
156
|
+
*
|
|
157
|
+
* The `data` field should contain the base64-encoded raw email.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* const response = await client.emails.sendRaw({
|
|
162
|
+
* data: 'data',
|
|
163
|
+
* mailFrom: 'dev@stainless.com',
|
|
164
|
+
* rcptTo: ['dev@stainless.com'],
|
|
165
|
+
* });
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
sendRaw(body, options) {
|
|
169
|
+
return this._client.post('/emails/raw', { body, ...options });
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
exports.Emails = Emails;
|
|
173
|
+
//# sourceMappingURL=emails.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emails.js","sourceRoot":"","sources":["../src/resources/emails.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,sDAAwG;AACxG,oDAAmD;AAEnD,oDAA8C;AAE9C,MAAa,MAAO,SAA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AAC,EAAE;gBACnF,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,SAAS,CAAC,MAA4B,EAAE,OAAwB;QAC9D,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC9D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE;YACxC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC;gBACpB,EAAE,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE;gBACnF,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,IAAwB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;CACF;AA/KD,wBA+KC"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../core/resource.mjs";
|
|
3
|
+
import { PageNumberPagination } from "../core/pagination.mjs";
|
|
4
|
+
import { buildHeaders } from "../internal/headers.mjs";
|
|
5
|
+
import { path } from "../internal/utils/path.mjs";
|
|
6
|
+
export class Emails extends APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* Retrieve detailed information about a specific email including delivery status,
|
|
9
|
+
* timestamps, and optionally the email content.
|
|
10
|
+
*
|
|
11
|
+
* Use the `expand` parameter to include additional data like the HTML/text body,
|
|
12
|
+
* headers, or delivery attempts.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const email = await client.emails.retrieve('emailId');
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
retrieve(emailID, query = {}, options) {
|
|
20
|
+
return this._client.get(path `/emails/${emailID}`, { query, ...options });
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Retrieve a paginated list of sent emails. Results are ordered by send time,
|
|
24
|
+
* newest first.
|
|
25
|
+
*
|
|
26
|
+
* Use filters to narrow down results by status, recipient, sender, or tag.
|
|
27
|
+
*
|
|
28
|
+
* **Related endpoints:**
|
|
29
|
+
*
|
|
30
|
+
* - `GET /emails/{id}` - Get full details of a specific email
|
|
31
|
+
* - `POST /emails` - Send a new email
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* // Automatically fetches more pages as needed.
|
|
36
|
+
* for await (const emailListResponse of client.emails.list()) {
|
|
37
|
+
* // ...
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
list(query = {}, options) {
|
|
42
|
+
return this._client.getAPIList('/emails', (PageNumberPagination), { query, ...options });
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get the history of delivery attempts for an email, including SMTP response codes
|
|
46
|
+
* and timestamps.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const response = await client.emails.retrieveDeliveries(
|
|
51
|
+
* 'emailId',
|
|
52
|
+
* );
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
retrieveDeliveries(emailID, options) {
|
|
56
|
+
return this._client.get(path `/emails/${emailID}/deliveries`, options);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Retry delivery of a failed or soft-bounced email. Creates a new delivery
|
|
60
|
+
* attempt.
|
|
61
|
+
*
|
|
62
|
+
* Only works for emails that have failed or are in a retryable state.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* const response = await client.emails.retry('emailId');
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
retry(emailID, options) {
|
|
70
|
+
return this._client.post(path `/emails/${emailID}/retry`, options);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Send a single email message. The email is accepted for immediate delivery and
|
|
74
|
+
* typically delivered within seconds.
|
|
75
|
+
*
|
|
76
|
+
* **Example use case:** Send a password reset email to a user.
|
|
77
|
+
*
|
|
78
|
+
* **Required fields:** `from`, `to`, `subject`, and either `html` or `text`
|
|
79
|
+
*
|
|
80
|
+
* **Idempotency:** Supports `Idempotency-Key` header for safe retries.
|
|
81
|
+
*
|
|
82
|
+
* **Related endpoints:**
|
|
83
|
+
*
|
|
84
|
+
* - `GET /emails/{id}` - Track delivery status
|
|
85
|
+
* - `GET /emails/{id}/deliveries` - View delivery attempts
|
|
86
|
+
* - `POST /emails/{id}/retry` - Retry failed delivery
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```ts
|
|
90
|
+
* const response = await client.emails.send({
|
|
91
|
+
* from: 'Acme <hello@acme.com>',
|
|
92
|
+
* subject: 'Hello World',
|
|
93
|
+
* to: ['user@example.com'],
|
|
94
|
+
* html: '<h1>Welcome!</h1><p>Thanks for signing up.</p>',
|
|
95
|
+
* });
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
send(params, options) {
|
|
99
|
+
const { 'Idempotency-Key': idempotencyKey, ...body } = params;
|
|
100
|
+
return this._client.post('/emails', {
|
|
101
|
+
body,
|
|
102
|
+
...options,
|
|
103
|
+
headers: buildHeaders([
|
|
104
|
+
{ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined) },
|
|
105
|
+
options?.headers,
|
|
106
|
+
]),
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Send up to 100 emails in a single request. Useful for sending personalized
|
|
111
|
+
* emails to multiple recipients efficiently.
|
|
112
|
+
*
|
|
113
|
+
* Each email in the batch can have different content and recipients. Failed emails
|
|
114
|
+
* don't affect other emails in the batch.
|
|
115
|
+
*
|
|
116
|
+
* **Idempotency:** Supports `Idempotency-Key` header for safe retries.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* const response = await client.emails.sendBatch({
|
|
121
|
+
* emails: [
|
|
122
|
+
* {
|
|
123
|
+
* to: ['alice@example.com'],
|
|
124
|
+
* subject: 'Hello Alice',
|
|
125
|
+
* html: '<p>Hi Alice, your order is ready!</p>',
|
|
126
|
+
* tag: 'order-ready',
|
|
127
|
+
* },
|
|
128
|
+
* {
|
|
129
|
+
* to: ['bob@example.com'],
|
|
130
|
+
* subject: 'Hello Bob',
|
|
131
|
+
* html: '<p>Hi Bob, your order is ready!</p>',
|
|
132
|
+
* tag: 'order-ready',
|
|
133
|
+
* },
|
|
134
|
+
* ],
|
|
135
|
+
* from: 'notifications@myapp.com',
|
|
136
|
+
* });
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
sendBatch(params, options) {
|
|
140
|
+
const { 'Idempotency-Key': idempotencyKey, ...body } = params;
|
|
141
|
+
return this._client.post('/emails/batch', {
|
|
142
|
+
body,
|
|
143
|
+
...options,
|
|
144
|
+
headers: buildHeaders([
|
|
145
|
+
{ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined) },
|
|
146
|
+
options?.headers,
|
|
147
|
+
]),
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Send a pre-formatted RFC 2822 MIME message. Use this for advanced use cases or
|
|
152
|
+
* when migrating from systems that generate raw email content.
|
|
153
|
+
*
|
|
154
|
+
* The `data` field should contain the base64-encoded raw email.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```ts
|
|
158
|
+
* const response = await client.emails.sendRaw({
|
|
159
|
+
* data: 'data',
|
|
160
|
+
* mailFrom: 'dev@stainless.com',
|
|
161
|
+
* rcptTo: ['dev@stainless.com'],
|
|
162
|
+
* });
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
sendRaw(body, options) {
|
|
166
|
+
return this._client.post('/emails/raw', { body, ...options });
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=emails.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emails.mjs","sourceRoot":"","sources":["../src/resources/emails.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,oBAAoB,EAAgD;OACtE,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;;;;;;;;;;OAWG;IACH,QAAQ,CACN,OAAe,EACf,QAAgD,EAAE,EAClD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,WAAW,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,IAAI,CACF,QAA4C,EAAE,EAC9C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,EAAE,CAAA,oBAAuC,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5G,CAAC;IAED;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,OAAe,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,WAAW,OAAO,aAAa,EAAE,OAAO,CAAC,CAAC;IACxE,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,OAAe,EAAE,OAAwB;QAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,WAAW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+
export * from "./shared.mjs";
|
|
2
|
+
export { Domains, type DNSRecord, type DomainCreateResponse, type DomainRetrieveResponse, type DomainListResponse, type DomainDeleteResponse, type DomainVerifyResponse, type DomainCreateParams, } from "./domains.mjs";
|
|
3
|
+
export { Emails, type EmailRetrieveResponse, type EmailListResponse, type EmailRetrieveDeliveriesResponse, type EmailRetryResponse, type EmailSendResponse, type EmailSendBatchResponse, type EmailSendRawResponse, type EmailRetrieveParams, type EmailListParams, type EmailSendParams, type EmailSendBatchParams, type EmailSendRawParams, type EmailListResponsesPageNumberPagination, } from "./emails.mjs";
|
|
4
|
+
export { Suppressions, type SuppressionCreateResponse, type SuppressionRetrieveResponse, type SuppressionListResponse, type SuppressionDeleteResponse, type SuppressionBulkCreateResponse, type SuppressionCreateParams, type SuppressionListParams, type SuppressionBulkCreateParams, type SuppressionListResponsesPageNumberPagination, } from "./suppressions.mjs";
|
|
5
|
+
export { Tracking, type TrackDomain, type TrackingCreateResponse, type TrackingRetrieveResponse, type TrackingUpdateResponse, type TrackingListResponse, type TrackingDeleteResponse, type TrackingVerifyResponse, type TrackingCreateParams, type TrackingUpdateParams, } from "./tracking.mjs";
|
|
6
|
+
export { Webhooks, type WebhookCreateResponse, type WebhookRetrieveResponse, type WebhookUpdateResponse, type WebhookListResponse, type WebhookDeleteResponse, type WebhookTestResponse, type WebhookCreateParams, type WebhookUpdateParams, type WebhookTestParams, } from "./webhooks.mjs";
|
|
7
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";OAGO,EACL,OAAO,EACP,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,GACxB;OACM,EACL,MAAM,EACN,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,+BAA+B,EACpC,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,sCAAsC,GAC5C;OACM,EACL,YAAY,EACZ,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,6BAA6B,EAClC,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,4CAA4C,GAClD;OACM,EACL,QAAQ,EACR,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B;OACM,EACL,QAAQ,EACR,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,GACvB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./shared.js";
|
|
2
|
+
export { Domains, type DNSRecord, type DomainCreateResponse, type DomainRetrieveResponse, type DomainListResponse, type DomainDeleteResponse, type DomainVerifyResponse, type DomainCreateParams, } from "./domains.js";
|
|
3
|
+
export { Emails, type EmailRetrieveResponse, type EmailListResponse, type EmailRetrieveDeliveriesResponse, type EmailRetryResponse, type EmailSendResponse, type EmailSendBatchResponse, type EmailSendRawResponse, type EmailRetrieveParams, type EmailListParams, type EmailSendParams, type EmailSendBatchParams, type EmailSendRawParams, type EmailListResponsesPageNumberPagination, } from "./emails.js";
|
|
4
|
+
export { Suppressions, type SuppressionCreateResponse, type SuppressionRetrieveResponse, type SuppressionListResponse, type SuppressionDeleteResponse, type SuppressionBulkCreateResponse, type SuppressionCreateParams, type SuppressionListParams, type SuppressionBulkCreateParams, type SuppressionListResponsesPageNumberPagination, } from "./suppressions.js";
|
|
5
|
+
export { Tracking, type TrackDomain, type TrackingCreateResponse, type TrackingRetrieveResponse, type TrackingUpdateResponse, type TrackingListResponse, type TrackingDeleteResponse, type TrackingVerifyResponse, type TrackingCreateParams, type TrackingUpdateParams, } from "./tracking.js";
|
|
6
|
+
export { Webhooks, type WebhookCreateResponse, type WebhookRetrieveResponse, type WebhookUpdateResponse, type WebhookListResponse, type WebhookDeleteResponse, type WebhookTestResponse, type WebhookCreateParams, type WebhookUpdateParams, type WebhookTestParams, } from "./webhooks.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";OAGO,EACL,OAAO,EACP,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,GACxB;OACM,EACL,MAAM,EACN,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,+BAA+B,EACpC,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,sCAAsC,GAC5C;OACM,EACL,YAAY,EACZ,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,6BAA6B,EAClC,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,4CAA4C,GAClD;OACM,EACL,QAAQ,EACR,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B;OACM,EACL,QAAQ,EACR,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,GACvB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Webhooks = exports.Tracking = exports.Suppressions = exports.Emails = exports.Domains = void 0;
|
|
5
|
+
const tslib_1 = require("../internal/tslib.js");
|
|
6
|
+
tslib_1.__exportStar(require("./shared.js"), exports);
|
|
7
|
+
var domains_1 = require("./domains.js");
|
|
8
|
+
Object.defineProperty(exports, "Domains", { enumerable: true, get: function () { return domains_1.Domains; } });
|
|
9
|
+
var emails_1 = require("./emails.js");
|
|
10
|
+
Object.defineProperty(exports, "Emails", { enumerable: true, get: function () { return emails_1.Emails; } });
|
|
11
|
+
var suppressions_1 = require("./suppressions.js");
|
|
12
|
+
Object.defineProperty(exports, "Suppressions", { enumerable: true, get: function () { return suppressions_1.Suppressions; } });
|
|
13
|
+
var tracking_1 = require("./tracking.js");
|
|
14
|
+
Object.defineProperty(exports, "Tracking", { enumerable: true, get: function () { return tracking_1.Tracking; } });
|
|
15
|
+
var webhooks_1 = require("./webhooks.js");
|
|
16
|
+
Object.defineProperty(exports, "Webhooks", { enumerable: true, get: function () { return webhooks_1.Webhooks; } });
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,sDAAyB;AACzB,wCASmB;AARjB,kGAAA,OAAO,OAAA;AAST,sCAekB;AAdhB,gGAAA,MAAM,OAAA;AAeR,kDAWwB;AAVtB,4GAAA,YAAY,OAAA;AAWd,0CAWoB;AAVlB,oGAAA,QAAQ,OAAA;AAWV,0CAWoB;AAVlB,oGAAA,QAAQ,OAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
export * from "./shared.mjs";
|
|
3
|
+
export { Domains, } from "./domains.mjs";
|
|
4
|
+
export { Emails, } from "./emails.mjs";
|
|
5
|
+
export { Suppressions, } from "./suppressions.mjs";
|
|
6
|
+
export { Tracking, } from "./tracking.mjs";
|
|
7
|
+
export { Webhooks, } from "./webhooks.mjs";
|
|
8
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;;OAG/E,EACL,OAAO,GAQR;OACM,EACL,MAAM,GAcP;OACM,EACL,YAAY,GAUb;OACM,EACL,QAAQ,GAUT;OACM,EACL,QAAQ,GAUT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.mts","sourceRoot":"","sources":["../src/resources/shared.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,OAAO;IACtB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/resources/shared.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,OAAO;IACtB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/resources/shared.ts"],"names":[],"mappings":";AAAA,sFAAsF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.mjs","sourceRoot":"","sources":["../src/resources/shared.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.mjs";
|
|
2
|
+
import * as Shared from "./shared.mjs";
|
|
3
|
+
import { APIPromise } from "../core/api-promise.mjs";
|
|
4
|
+
import { PageNumberPagination, type PageNumberPaginationParams, PagePromise } from "../core/pagination.mjs";
|
|
5
|
+
import { RequestOptions } from "../internal/request-options.mjs";
|
|
6
|
+
export declare class Suppressions extends APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* Add an email address to the suppression list. The address will not receive any
|
|
9
|
+
* emails until removed.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const suppression = await client.suppressions.create({
|
|
14
|
+
* address: 'user@example.com',
|
|
15
|
+
* reason: 'user requested removal',
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
create(body: SuppressionCreateParams, options?: RequestOptions): APIPromise<SuppressionCreateResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Check if a specific email address is on the suppression list
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const suppression = await client.suppressions.retrieve(
|
|
26
|
+
* 'dev@stainless.com',
|
|
27
|
+
* );
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
retrieve(email: string, options?: RequestOptions): APIPromise<SuppressionRetrieveResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Get all email addresses on the suppression list. These addresses will not
|
|
33
|
+
* receive any emails.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* // Automatically fetches more pages as needed.
|
|
38
|
+
* for await (const suppressionListResponse of client.suppressions.list()) {
|
|
39
|
+
* // ...
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
list(query?: SuppressionListParams | null | undefined, options?: RequestOptions): PagePromise<SuppressionListResponsesPageNumberPagination, SuppressionListResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* Remove an email address from the suppression list. The address will be able to
|
|
46
|
+
* receive emails again.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const suppression = await client.suppressions.delete(
|
|
51
|
+
* 'dev@stainless.com',
|
|
52
|
+
* );
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
delete(email: string, options?: RequestOptions): APIPromise<SuppressionDeleteResponse>;
|
|
56
|
+
/**
|
|
57
|
+
* Add up to 1000 email addresses to the suppression list at once
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const response = await client.suppressions.bulkCreate({
|
|
62
|
+
* suppressions: [{ address: 'dev@stainless.com' }],
|
|
63
|
+
* });
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
bulkCreate(body: SuppressionBulkCreateParams, options?: RequestOptions): APIPromise<SuppressionBulkCreateResponse>;
|
|
67
|
+
}
|
|
68
|
+
export type SuppressionListResponsesPageNumberPagination = PageNumberPagination<SuppressionListResponse>;
|
|
69
|
+
export interface SuppressionCreateResponse {
|
|
70
|
+
data: SuppressionCreateResponse.Data;
|
|
71
|
+
meta: Shared.APIMeta;
|
|
72
|
+
success: true;
|
|
73
|
+
}
|
|
74
|
+
export declare namespace SuppressionCreateResponse {
|
|
75
|
+
interface Data {
|
|
76
|
+
/**
|
|
77
|
+
* Suppression ID
|
|
78
|
+
*/
|
|
79
|
+
id: string;
|
|
80
|
+
address: string;
|
|
81
|
+
createdAt: string;
|
|
82
|
+
/**
|
|
83
|
+
* Reason for suppression
|
|
84
|
+
*/
|
|
85
|
+
reason?: string;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export interface SuppressionRetrieveResponse {
|
|
89
|
+
data: SuppressionRetrieveResponse.Data;
|
|
90
|
+
meta: Shared.APIMeta;
|
|
91
|
+
success: true;
|
|
92
|
+
}
|
|
93
|
+
export declare namespace SuppressionRetrieveResponse {
|
|
94
|
+
interface Data {
|
|
95
|
+
/**
|
|
96
|
+
* The email address that was checked
|
|
97
|
+
*/
|
|
98
|
+
address: string;
|
|
99
|
+
/**
|
|
100
|
+
* Whether the address is currently suppressed
|
|
101
|
+
*/
|
|
102
|
+
suppressed: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* When the suppression was created (if suppressed)
|
|
105
|
+
*/
|
|
106
|
+
createdAt?: string | null;
|
|
107
|
+
/**
|
|
108
|
+
* Reason for suppression (if suppressed)
|
|
109
|
+
*/
|
|
110
|
+
reason?: string | null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
export interface SuppressionListResponse {
|
|
114
|
+
/**
|
|
115
|
+
* Suppression ID
|
|
116
|
+
*/
|
|
117
|
+
id: string;
|
|
118
|
+
address: string;
|
|
119
|
+
createdAt: string;
|
|
120
|
+
reason?: string;
|
|
121
|
+
}
|
|
122
|
+
export interface SuppressionDeleteResponse {
|
|
123
|
+
data: SuppressionDeleteResponse.Data;
|
|
124
|
+
meta: Shared.APIMeta;
|
|
125
|
+
success: true;
|
|
126
|
+
}
|
|
127
|
+
export declare namespace SuppressionDeleteResponse {
|
|
128
|
+
interface Data {
|
|
129
|
+
message: string;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
export interface SuppressionBulkCreateResponse {
|
|
133
|
+
data: SuppressionBulkCreateResponse.Data;
|
|
134
|
+
meta: Shared.APIMeta;
|
|
135
|
+
success: true;
|
|
136
|
+
}
|
|
137
|
+
export declare namespace SuppressionBulkCreateResponse {
|
|
138
|
+
interface Data {
|
|
139
|
+
/**
|
|
140
|
+
* Newly suppressed addresses
|
|
141
|
+
*/
|
|
142
|
+
added: number;
|
|
143
|
+
/**
|
|
144
|
+
* Invalid addresses skipped
|
|
145
|
+
*/
|
|
146
|
+
failed: number;
|
|
147
|
+
/**
|
|
148
|
+
* Total addresses in request
|
|
149
|
+
*/
|
|
150
|
+
totalRequested: number;
|
|
151
|
+
/**
|
|
152
|
+
* Already suppressed addresses (updated reason)
|
|
153
|
+
*/
|
|
154
|
+
updated: number;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
export interface SuppressionCreateParams {
|
|
158
|
+
/**
|
|
159
|
+
* Email address to suppress
|
|
160
|
+
*/
|
|
161
|
+
address: string;
|
|
162
|
+
/**
|
|
163
|
+
* Reason for suppression
|
|
164
|
+
*/
|
|
165
|
+
reason?: string;
|
|
166
|
+
}
|
|
167
|
+
export interface SuppressionListParams extends PageNumberPaginationParams {
|
|
168
|
+
}
|
|
169
|
+
export interface SuppressionBulkCreateParams {
|
|
170
|
+
suppressions: Array<SuppressionBulkCreateParams.Suppression>;
|
|
171
|
+
}
|
|
172
|
+
export declare namespace SuppressionBulkCreateParams {
|
|
173
|
+
interface Suppression {
|
|
174
|
+
address: string;
|
|
175
|
+
reason?: string;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
export declare namespace Suppressions {
|
|
179
|
+
export { type SuppressionCreateResponse as SuppressionCreateResponse, type SuppressionRetrieveResponse as SuppressionRetrieveResponse, type SuppressionListResponse as SuppressionListResponse, type SuppressionDeleteResponse as SuppressionDeleteResponse, type SuppressionBulkCreateResponse as SuppressionBulkCreateResponse, type SuppressionListResponsesPageNumberPagination as SuppressionListResponsesPageNumberPagination, type SuppressionCreateParams as SuppressionCreateParams, type SuppressionListParams as SuppressionListParams, type SuppressionBulkCreateParams as SuppressionBulkCreateParams, };
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=suppressions.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suppressions.d.mts","sourceRoot":"","sources":["../src/resources/suppressions.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,EAAE,UAAU,EAAE;OACd,EAAE,oBAAoB,EAAE,KAAK,0BAA0B,EAAE,WAAW,EAAE;OACtE,EAAE,cAAc,EAAE;AAGzB,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,IAAI,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,yBAAyB,CAAC;IAItG;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,2BAA2B,CAAC;IAI1F;;;;;;;;;;;OAWG;IACH,IAAI,CACF,KAAK,GAAE,qBAAqB,GAAG,IAAI,GAAG,SAAc,EACpD,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,4CAA4C,EAAE,uBAAuB,CAAC;IAOrF;;;;;;;;;;OAUG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,yBAAyB,CAAC;IAItF;;;;;;;;;OASG;IACH,UAAU,CACR,IAAI,EAAE,2BAA2B,EACjC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,6BAA6B,CAAC;CAG7C;AAED,MAAM,MAAM,4CAA4C,GAAG,oBAAoB,CAAC,uBAAuB,CAAC,CAAC;AAEzG,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,yBAAyB,CAAC,IAAI,CAAC;IAErC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC;IAErB,OAAO,EAAE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