@trycourier/courier 7.19.2 → 7.21.0

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/client.d.mts +0 -3
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +0 -3
  5. package/client.d.ts.map +1 -1
  6. package/client.js +0 -3
  7. package/client.js.map +1 -1
  8. package/client.mjs +0 -3
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/index.d.mts +0 -1
  12. package/resources/index.d.mts.map +1 -1
  13. package/resources/index.d.ts +0 -1
  14. package/resources/index.d.ts.map +1 -1
  15. package/resources/index.js +1 -3
  16. package/resources/index.js.map +1 -1
  17. package/resources/index.mjs +0 -1
  18. package/resources/index.mjs.map +1 -1
  19. package/resources/notifications/notifications.d.mts +25 -0
  20. package/resources/notifications/notifications.d.mts.map +1 -1
  21. package/resources/notifications/notifications.d.ts +25 -0
  22. package/resources/notifications/notifications.d.ts.map +1 -1
  23. package/resources/notifications/notifications.js +17 -0
  24. package/resources/notifications/notifications.js.map +1 -1
  25. package/resources/notifications/notifications.mjs +17 -0
  26. package/resources/notifications/notifications.mjs.map +1 -1
  27. package/src/client.ts +0 -25
  28. package/src/resources/index.ts +0 -11
  29. package/src/resources/notifications/notifications.ts +30 -0
  30. package/src/version.ts +1 -1
  31. package/version.d.mts +1 -1
  32. package/version.d.ts +1 -1
  33. package/version.js +1 -1
  34. package/version.mjs +1 -1
  35. package/resources/bulk.d.mts +0 -155
  36. package/resources/bulk.d.mts.map +0 -1
  37. package/resources/bulk.d.ts +0 -155
  38. package/resources/bulk.d.ts.map +0 -1
  39. package/resources/bulk.js +0 -58
  40. package/resources/bulk.js.map +0 -1
  41. package/resources/bulk.mjs +0 -54
  42. package/resources/bulk.mjs.map +0 -1
  43. package/src/resources/bulk.ts +0 -210
@@ -1,155 +0,0 @@
1
- import { APIResource } from "../core/resource.js";
2
- import * as BulkAPI from "./bulk.js";
3
- import * as Shared from "./shared.js";
4
- import { APIPromise } from "../core/api-promise.js";
5
- import { RequestOptions } from "../internal/request-options.js";
6
- export declare class Bulk extends APIResource {
7
- /**
8
- * Ingest user data into a Bulk Job.
9
- *
10
- * **Important**: For email-based bulk jobs, each user must include `profile.email`
11
- * for provider routing to work correctly. The `to.email` field is not sufficient
12
- * for email provider routing.
13
- */
14
- addUsers(jobID: string, body: BulkAddUsersParams, options?: RequestOptions): APIPromise<void>;
15
- /**
16
- * Creates a new bulk job for sending messages to multiple recipients.
17
- *
18
- * **Required**: `message.event` (event ID or notification ID)
19
- *
20
- * **Optional (V2 format)**: `message.template` (notification ID) or
21
- * `message.content` (Elemental content) can be provided to override the
22
- * notification associated with the event.
23
- */
24
- createJob(body: BulkCreateJobParams, options?: RequestOptions): APIPromise<BulkCreateJobResponse>;
25
- /**
26
- * Get Bulk Job Users
27
- */
28
- listUsers(jobID: string, query?: BulkListUsersParams | null | undefined, options?: RequestOptions): APIPromise<BulkListUsersResponse>;
29
- /**
30
- * Get a bulk job
31
- */
32
- retrieveJob(jobID: string, options?: RequestOptions): APIPromise<BulkRetrieveJobResponse>;
33
- /**
34
- * Run a bulk job
35
- */
36
- runJob(jobID: string, options?: RequestOptions): APIPromise<void>;
37
- }
38
- /**
39
- * Bulk message definition. Supports two formats:
40
- *
41
- * - V1 format: Requires `event` field (event ID or notification ID)
42
- * - V2 format: Optionally use `template` (notification ID) or `content` (Elemental
43
- * content) in addition to `event`
44
- */
45
- export interface InboundBulkMessage {
46
- /**
47
- * Event ID or Notification ID (required). Can be either a Notification ID (e.g.,
48
- * "FRH3QXM9E34W4RKP7MRC8NZ1T8V8") or a custom Event ID (e.g., "welcome-email")
49
- * mapped to a notification.
50
- */
51
- event: string;
52
- brand?: string | null;
53
- /**
54
- * Elemental content (optional, for V2 format). When provided, this will be used
55
- * instead of the notification associated with the `event` field.
56
- */
57
- content?: Shared.ElementalContentSugar | Shared.ElementalContent | null;
58
- data?: {
59
- [key: string]: unknown;
60
- } | null;
61
- locale?: {
62
- [key: string]: {
63
- [key: string]: unknown;
64
- };
65
- } | null;
66
- override?: {
67
- [key: string]: unknown;
68
- } | null;
69
- /**
70
- * Notification ID or template ID (optional, for V2 format). When provided, this
71
- * will be used instead of the notification associated with the `event` field.
72
- */
73
- template?: string | null;
74
- }
75
- export interface InboundBulkMessageUser {
76
- /**
77
- * User-specific data that will be merged with message.data
78
- */
79
- data?: unknown;
80
- preferences?: Shared.RecipientPreferences | null;
81
- /**
82
- * User profile information. For email-based bulk jobs, `profile.email` is required
83
- * for provider routing to determine if the message can be delivered. The email
84
- * address should be provided here rather than in `to.email`.
85
- */
86
- profile?: {
87
- [key: string]: unknown;
88
- } | null;
89
- /**
90
- * User ID (legacy field, use profile or to.user_id instead)
91
- */
92
- recipient?: string | null;
93
- /**
94
- * Optional recipient information. Note: For email provider routing, use
95
- * `profile.email` instead of `to.email`. The `to` field is primarily used for
96
- * recipient identification and data merging.
97
- */
98
- to?: Shared.UserRecipient | null;
99
- }
100
- export interface BulkCreateJobResponse {
101
- jobId: string;
102
- }
103
- export interface BulkListUsersResponse {
104
- items: Array<BulkListUsersResponse.Item>;
105
- paging: Shared.Paging;
106
- }
107
- export declare namespace BulkListUsersResponse {
108
- interface Item extends BulkAPI.InboundBulkMessageUser {
109
- status: 'PENDING' | 'ENQUEUED' | 'ERROR';
110
- messageId?: string | null;
111
- }
112
- }
113
- export interface BulkRetrieveJobResponse {
114
- job: BulkRetrieveJobResponse.Job;
115
- }
116
- export declare namespace BulkRetrieveJobResponse {
117
- interface Job {
118
- /**
119
- * Bulk message definition. Supports two formats:
120
- *
121
- * - V1 format: Requires `event` field (event ID or notification ID)
122
- * - V2 format: Optionally use `template` (notification ID) or `content` (Elemental
123
- * content) in addition to `event`
124
- */
125
- definition: BulkAPI.InboundBulkMessage;
126
- enqueued: number;
127
- failures: number;
128
- received: number;
129
- status: 'CREATED' | 'PROCESSING' | 'COMPLETED' | 'ERROR';
130
- }
131
- }
132
- export interface BulkAddUsersParams {
133
- users: Array<InboundBulkMessageUser>;
134
- }
135
- export interface BulkCreateJobParams {
136
- /**
137
- * Bulk message definition. Supports two formats:
138
- *
139
- * - V1 format: Requires `event` field (event ID or notification ID)
140
- * - V2 format: Optionally use `template` (notification ID) or `content` (Elemental
141
- * content) in addition to `event`
142
- */
143
- message: InboundBulkMessage;
144
- }
145
- export interface BulkListUsersParams {
146
- /**
147
- * A unique identifier that allows for fetching the next set of users added to the
148
- * bulk job
149
- */
150
- cursor?: string | null;
151
- }
152
- export declare namespace Bulk {
153
- export { type InboundBulkMessage as InboundBulkMessage, type InboundBulkMessageUser as InboundBulkMessageUser, type BulkCreateJobResponse as BulkCreateJobResponse, type BulkListUsersResponse as BulkListUsersResponse, type BulkRetrieveJobResponse as BulkRetrieveJobResponse, type BulkAddUsersParams as BulkAddUsersParams, type BulkCreateJobParams as BulkCreateJobParams, type BulkListUsersParams as BulkListUsersParams, };
154
- }
155
- //# sourceMappingURL=bulk.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bulk.d.ts","sourceRoot":"","sources":["../src/resources/bulk.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,4BAAyB;AAC/C,OAAO,KAAK,OAAO,kBAAe;AAClC,OAAO,KAAK,MAAM,oBAAiB;AACnC,OAAO,EAAE,UAAU,EAAE,+BAA4B;AAEjD,OAAO,EAAE,cAAc,EAAE,uCAAoC;AAG7D,qBAAa,IAAK,SAAQ,WAAW;IACnC;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAQ7F;;;;;;;;OAQG;IACH,SAAS,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,qBAAqB,CAAC;IAIjG;;OAEG;IACH,SA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AO,EACL,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
package/resources/bulk.js DELETED
@@ -1,58 +0,0 @@
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.Bulk = void 0;
5
- const resource_1 = require("../core/resource.js");
6
- const headers_1 = require("../internal/headers.js");
7
- const path_1 = require("../internal/utils/path.js");
8
- class Bulk extends resource_1.APIResource {
9
- /**
10
- * Ingest user data into a Bulk Job.
11
- *
12
- * **Important**: For email-based bulk jobs, each user must include `profile.email`
13
- * for provider routing to work correctly. The `to.email` field is not sufficient
14
- * for email provider routing.
15
- */
16
- addUsers(jobID, body, options) {
17
- return this._client.post((0, path_1.path) `/bulk/${jobID}`, {
18
- body,
19
- ...options,
20
- headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
21
- });
22
- }
23
- /**
24
- * Creates a new bulk job for sending messages to multiple recipients.
25
- *
26
- * **Required**: `message.event` (event ID or notification ID)
27
- *
28
- * **Optional (V2 format)**: `message.template` (notification ID) or
29
- * `message.content` (Elemental content) can be provided to override the
30
- * notification associated with the event.
31
- */
32
- createJob(body, options) {
33
- return this._client.post('/bulk', { body, ...options });
34
- }
35
- /**
36
- * Get Bulk Job Users
37
- */
38
- listUsers(jobID, query = {}, options) {
39
- return this._client.get((0, path_1.path) `/bulk/${jobID}/users`, { query, ...options });
40
- }
41
- /**
42
- * Get a bulk job
43
- */
44
- retrieveJob(jobID, options) {
45
- return this._client.get((0, path_1.path) `/bulk/${jobID}`, options);
46
- }
47
- /**
48
- * Run a bulk job
49
- */
50
- runJob(jobID, options) {
51
- return this._client.post((0, path_1.path) `/bulk/${jobID}/run`, {
52
- ...options,
53
- headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
54
- });
55
- }
56
- }
57
- exports.Bulk = Bulk;
58
- //# sourceMappingURL=bulk.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bulk.js","sourceRoot":"","sources":["../src/resources/bulk.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,oDAAmD;AAEnD,oDAA8C;AAE9C,MAAa,IAAK,SAAQ,sBAAW;IACnC;;;;;;OAMG;IACH,QAAQ,CAAC,KAAa,EAAE,IAAwB,EAAE,OAAwB;QACxE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,SAAS,KAAK,EAAE,EAAE;YAC7C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,SAAS,CAAC,IAAyB,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,SAAS,CACP,KAAa,EACb,QAAgD,EAAE,EAClD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,SAAS,KAAK,QAAQ,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,KAAa,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,SAAS,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAa,EAAE,OAAwB;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,SAAS,KAAK,MAAM,EAAE;YACjD,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AAxDD,oBAwDC"}
@@ -1,54 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import { APIResource } from "../core/resource.mjs";
3
- import { buildHeaders } from "../internal/headers.mjs";
4
- import { path } from "../internal/utils/path.mjs";
5
- export class Bulk extends APIResource {
6
- /**
7
- * Ingest user data into a Bulk Job.
8
- *
9
- * **Important**: For email-based bulk jobs, each user must include `profile.email`
10
- * for provider routing to work correctly. The `to.email` field is not sufficient
11
- * for email provider routing.
12
- */
13
- addUsers(jobID, body, options) {
14
- return this._client.post(path `/bulk/${jobID}`, {
15
- body,
16
- ...options,
17
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
18
- });
19
- }
20
- /**
21
- * Creates a new bulk job for sending messages to multiple recipients.
22
- *
23
- * **Required**: `message.event` (event ID or notification ID)
24
- *
25
- * **Optional (V2 format)**: `message.template` (notification ID) or
26
- * `message.content` (Elemental content) can be provided to override the
27
- * notification associated with the event.
28
- */
29
- createJob(body, options) {
30
- return this._client.post('/bulk', { body, ...options });
31
- }
32
- /**
33
- * Get Bulk Job Users
34
- */
35
- listUsers(jobID, query = {}, options) {
36
- return this._client.get(path `/bulk/${jobID}/users`, { query, ...options });
37
- }
38
- /**
39
- * Get a bulk job
40
- */
41
- retrieveJob(jobID, options) {
42
- return this._client.get(path `/bulk/${jobID}`, options);
43
- }
44
- /**
45
- * Run a bulk job
46
- */
47
- runJob(jobID, options) {
48
- return this._client.post(path `/bulk/${jobID}/run`, {
49
- ...options,
50
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
51
- });
52
- }
53
- }
54
- //# sourceMappingURL=bulk.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bulk.mjs","sourceRoot":"","sources":["../src/resources/bulk.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAI/C,OAAO,EAAE,YAAY,EAAE,gCAA4B;AAEnD,OAAO,EAAE,IAAI,EAAE,mCAA+B;AAE9C,MAAM,OAAO,IAAK,SAAQ,WAAW;IACnC;;;;;;OAMG;IACH,QAAQ,CAAC,KAAa,EAAE,IAAwB,EAAE,OAAwB;QACxE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,SAAS,KAAK,EAAE,EAAE;YAC7C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,SAAS,CAAC,IAAyB,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,SAAS,CACP,KAAa,EACb,QAAgD,EAAE,EAClD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,SAAS,KAAK,QAAQ,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,KAAa,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,SAAS,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAa,EAAE,OAAwB;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,SAAS,KAAK,MAAM,EAAE;YACjD,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,210 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- import { APIResource } from '../core/resource';
4
- import * as BulkAPI from './bulk';
5
- import * as Shared from './shared';
6
- import { APIPromise } from '../core/api-promise';
7
- import { buildHeaders } from '../internal/headers';
8
- import { RequestOptions } from '../internal/request-options';
9
- import { path } from '../internal/utils/path';
10
-
11
- export class Bulk extends APIResource {
12
- /**
13
- * Ingest user data into a Bulk Job.
14
- *
15
- * **Important**: For email-based bulk jobs, each user must include `profile.email`
16
- * for provider routing to work correctly. The `to.email` field is not sufficient
17
- * for email provider routing.
18
- */
19
- addUsers(jobID: string, body: BulkAddUsersParams, options?: RequestOptions): APIPromise<void> {
20
- return this._client.post(path`/bulk/${jobID}`, {
21
- body,
22
- ...options,
23
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
24
- });
25
- }
26
-
27
- /**
28
- * Creates a new bulk job for sending messages to multiple recipients.
29
- *
30
- * **Required**: `message.event` (event ID or notification ID)
31
- *
32
- * **Optional (V2 format)**: `message.template` (notification ID) or
33
- * `message.content` (Elemental content) can be provided to override the
34
- * notification associated with the event.
35
- */
36
- createJob(body: BulkCreateJobParams, options?: RequestOptions): APIPromise<BulkCreateJobResponse> {
37
- return this._client.post('/bulk', { body, ...options });
38
- }
39
-
40
- /**
41
- * Get Bulk Job Users
42
- */
43
- listUsers(
44
- jobID: string,
45
- query: BulkListUsersParams | null | undefined = {},
46
- options?: RequestOptions,
47
- ): APIPromise<BulkListUsersResponse> {
48
- return this._client.get(path`/bulk/${jobID}/users`, { query, ...options });
49
- }
50
-
51
- /**
52
- * Get a bulk job
53
- */
54
- retrieveJob(jobID: string, options?: RequestOptions): APIPromise<BulkRetrieveJobResponse> {
55
- return this._client.get(path`/bulk/${jobID}`, options);
56
- }
57
-
58
- /**
59
- * Run a bulk job
60
- */
61
- runJob(jobID: string, options?: RequestOptions): APIPromise<void> {
62
- return this._client.post(path`/bulk/${jobID}/run`, {
63
- ...options,
64
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
65
- });
66
- }
67
- }
68
-
69
- /**
70
- * Bulk message definition. Supports two formats:
71
- *
72
- * - V1 format: Requires `event` field (event ID or notification ID)
73
- * - V2 format: Optionally use `template` (notification ID) or `content` (Elemental
74
- * content) in addition to `event`
75
- */
76
- export interface InboundBulkMessage {
77
- /**
78
- * Event ID or Notification ID (required). Can be either a Notification ID (e.g.,
79
- * "FRH3QXM9E34W4RKP7MRC8NZ1T8V8") or a custom Event ID (e.g., "welcome-email")
80
- * mapped to a notification.
81
- */
82
- event: string;
83
-
84
- brand?: string | null;
85
-
86
- /**
87
- * Elemental content (optional, for V2 format). When provided, this will be used
88
- * instead of the notification associated with the `event` field.
89
- */
90
- content?: Shared.ElementalContentSugar | Shared.ElementalContent | null;
91
-
92
- data?: { [key: string]: unknown } | null;
93
-
94
- locale?: { [key: string]: { [key: string]: unknown } } | null;
95
-
96
- override?: { [key: string]: unknown } | null;
97
-
98
- /**
99
- * Notification ID or template ID (optional, for V2 format). When provided, this
100
- * will be used instead of the notification associated with the `event` field.
101
- */
102
- template?: string | null;
103
- }
104
-
105
- export interface InboundBulkMessageUser {
106
- /**
107
- * User-specific data that will be merged with message.data
108
- */
109
- data?: unknown;
110
-
111
- preferences?: Shared.RecipientPreferences | null;
112
-
113
- /**
114
- * User profile information. For email-based bulk jobs, `profile.email` is required
115
- * for provider routing to determine if the message can be delivered. The email
116
- * address should be provided here rather than in `to.email`.
117
- */
118
- profile?: { [key: string]: unknown } | null;
119
-
120
- /**
121
- * User ID (legacy field, use profile or to.user_id instead)
122
- */
123
- recipient?: string | null;
124
-
125
- /**
126
- * Optional recipient information. Note: For email provider routing, use
127
- * `profile.email` instead of `to.email`. The `to` field is primarily used for
128
- * recipient identification and data merging.
129
- */
130
- to?: Shared.UserRecipient | null;
131
- }
132
-
133
- export interface BulkCreateJobResponse {
134
- jobId: string;
135
- }
136
-
137
- export interface BulkListUsersResponse {
138
- items: Array<BulkListUsersResponse.Item>;
139
-
140
- paging: Shared.Paging;
141
- }
142
-
143
- export namespace BulkListUsersResponse {
144
- export interface Item extends BulkAPI.InboundBulkMessageUser {
145
- status: 'PENDING' | 'ENQUEUED' | 'ERROR';
146
-
147
- messageId?: string | null;
148
- }
149
- }
150
-
151
- export interface BulkRetrieveJobResponse {
152
- job: BulkRetrieveJobResponse.Job;
153
- }
154
-
155
- export namespace BulkRetrieveJobResponse {
156
- export interface Job {
157
- /**
158
- * Bulk message definition. Supports two formats:
159
- *
160
- * - V1 format: Requires `event` field (event ID or notification ID)
161
- * - V2 format: Optionally use `template` (notification ID) or `content` (Elemental
162
- * content) in addition to `event`
163
- */
164
- definition: BulkAPI.InboundBulkMessage;
165
-
166
- enqueued: number;
167
-
168
- failures: number;
169
-
170
- received: number;
171
-
172
- status: 'CREATED' | 'PROCESSING' | 'COMPLETED' | 'ERROR';
173
- }
174
- }
175
-
176
- export interface BulkAddUsersParams {
177
- users: Array<InboundBulkMessageUser>;
178
- }
179
-
180
- export interface BulkCreateJobParams {
181
- /**
182
- * Bulk message definition. Supports two formats:
183
- *
184
- * - V1 format: Requires `event` field (event ID or notification ID)
185
- * - V2 format: Optionally use `template` (notification ID) or `content` (Elemental
186
- * content) in addition to `event`
187
- */
188
- message: InboundBulkMessage;
189
- }
190
-
191
- export interface BulkListUsersParams {
192
- /**
193
- * A unique identifier that allows for fetching the next set of users added to the
194
- * bulk job
195
- */
196
- cursor?: string | null;
197
- }
198
-
199
- export declare namespace Bulk {
200
- export {
201
- type InboundBulkMessage as InboundBulkMessage,
202
- type InboundBulkMessageUser as InboundBulkMessageUser,
203
- type BulkCreateJobResponse as BulkCreateJobResponse,
204
- type BulkListUsersResponse as BulkListUsersResponse,
205
- type BulkRetrieveJobResponse as BulkRetrieveJobResponse,
206
- type BulkAddUsersParams as BulkAddUsersParams,
207
- type BulkCreateJobParams as BulkCreateJobParams,
208
- type BulkListUsersParams as BulkListUsersParams,
209
- };
210
- }