resend 6.32.1-preview-inboxes.6 → 6.33.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.
package/dist/index.cjs CHANGED
@@ -51,7 +51,7 @@ const MOVE_THREAD_FOLDERS = [
51
51
  ];
52
52
  //#endregion
53
53
  //#region package.json
54
- var version = "6.32.1-preview-inboxes.6";
54
+ var version = "6.33.0";
55
55
  //#endregion
56
56
  //#region src/common/utils/build-pagination-query.ts
57
57
  function buildPaginationUrl(base, options) {
@@ -909,7 +909,7 @@ var Receiving = class {
909
909
  }
910
910
  };
911
911
  return {
912
- content: await response.text(),
912
+ content: await response.arrayBuffer(),
913
913
  error: null
914
914
  };
915
915
  } catch {
@@ -1049,9 +1049,10 @@ var InboxDrafts = class {
1049
1049
  return this.resend.get(url, requestOptions);
1050
1050
  }
1051
1051
  async create(payload, options = {}) {
1052
- const { inboxId, threadId, replyToEmailId, ...content } = payload;
1052
+ const { inboxId, threadId, replyToEmailId, attachments, ...content } = payload;
1053
1053
  return this.resend.post(`/inboxes/${inboxId}/drafts`, {
1054
1054
  ...content,
1055
+ attachments: parseAttachments(attachments),
1055
1056
  thread_id: threadId,
1056
1057
  reply_to_email_id: replyToEmailId
1057
1058
  }, options);
@@ -1061,16 +1062,19 @@ var InboxDrafts = class {
1061
1062
  return this.resend.get(`/inboxes/${inboxId}/drafts/${draftId}`, requestOptions);
1062
1063
  }
1063
1064
  async update(options, requestOptions = {}) {
1064
- const { inboxId, draftId, ...content } = options;
1065
- return this.resend.patch(`/inboxes/${inboxId}/drafts/${draftId}`, content, requestOptions);
1065
+ const { inboxId, draftId, attachments, ...content } = options;
1066
+ return this.resend.patch(`/inboxes/${inboxId}/drafts/${draftId}`, {
1067
+ ...content,
1068
+ attachments: attachments === null ? null : parseAttachments(attachments)
1069
+ }, requestOptions);
1066
1070
  }
1067
1071
  async remove(options, requestOptions = {}) {
1068
1072
  const { inboxId, draftId } = options;
1069
1073
  return this.resend.delete(`/inboxes/${inboxId}/drafts/${draftId}`, void 0, requestOptions);
1070
1074
  }
1071
1075
  async send(payload, options = {}) {
1072
- const { inboxId, draftId } = payload;
1073
- return this.resend.post(`/inboxes/${inboxId}/drafts/${draftId}/send`, void 0, options);
1076
+ const { inboxId, draftId, headers } = payload;
1077
+ return this.resend.post(`/inboxes/${inboxId}/drafts/${draftId}/send`, headers ? { headers } : void 0, options);
1074
1078
  }
1075
1079
  };
1076
1080
  //#endregion
@@ -1117,25 +1121,29 @@ var InboxThreadEmails = class {
1117
1121
  return this.resend.get(`/inboxes/${inboxId}/threads/${threadId}/emails/${emailId}`, requestOptions);
1118
1122
  }
1119
1123
  async reply(payload, options = {}) {
1120
- const { inboxId, threadId, emailId, cc, bcc, html, text, subject, replyAll } = payload;
1124
+ const { inboxId, threadId, emailId, cc, bcc, html, text, subject, replyAll, attachments, headers } = payload;
1121
1125
  return this.resend.post(`/inboxes/${inboxId}/threads/${threadId}/emails/${emailId}/reply`, {
1122
1126
  cc,
1123
1127
  bcc,
1124
1128
  html,
1125
1129
  text,
1126
1130
  subject,
1127
- reply_all: replyAll
1131
+ reply_all: replyAll,
1132
+ attachments: parseAttachments(attachments),
1133
+ headers
1128
1134
  }, options);
1129
1135
  }
1130
1136
  async forward(payload, options = {}) {
1131
- const { inboxId, threadId, emailId, to, cc, bcc, html, text, subject } = payload;
1137
+ const { inboxId, threadId, emailId, to, cc, bcc, html, text, subject, attachments, headers } = payload;
1132
1138
  return this.resend.post(`/inboxes/${inboxId}/threads/${threadId}/emails/${emailId}/forward`, {
1133
1139
  to,
1134
1140
  cc,
1135
1141
  bcc,
1136
1142
  html,
1137
1143
  text,
1138
- subject
1144
+ subject,
1145
+ attachments: parseAttachments(attachments),
1146
+ headers
1139
1147
  }, options);
1140
1148
  }
1141
1149
  };
@@ -1183,11 +1191,12 @@ var InboxThreads = class {
1183
1191
  return this.resend.get(`/inboxes/${inboxId}/threads/${threadId}`, requestOptions);
1184
1192
  }
1185
1193
  async update(options, requestOptions = {}) {
1186
- const { inboxId, threadId, read, folder, labelId } = options;
1194
+ const { inboxId, threadId, read, folder, addLabelIds, removeLabelIds } = options;
1187
1195
  return this.resend.patch(`/inboxes/${inboxId}/threads/${threadId}`, {
1188
1196
  read,
1189
1197
  folder,
1190
- label_id: labelId
1198
+ add_label_ids: addLabelIds,
1199
+ remove_label_ids: removeLabelIds
1191
1200
  }, requestOptions);
1192
1201
  }
1193
1202
  async remove(options, requestOptions = {}) {
package/dist/index.d.cts CHANGED
@@ -1791,33 +1791,20 @@ interface UpdateInboxAgentResponseSuccess {
1791
1791
  }
1792
1792
  type UpdateInboxAgentResponse = Response<UpdateInboxAgentResponseSuccess>;
1793
1793
  //#endregion
1794
- //#region src/inboxes/drafts/interfaces/create-inbox-draft.interface.d.ts
1795
- type CreateInboxDraftContent = RequireAtLeastOne<{
1796
- to?: string | string[];
1797
- cc?: string | string[];
1798
- bcc?: string | string[];
1799
- subject?: string | null;
1800
- text?: string | null;
1801
- html?: string | null;
1802
- }>;
1803
- type CreateInboxDraftOptions = {
1804
- inboxId: string;
1805
- } & CreateInboxDraftContent & ({
1806
- threadId: string;
1807
- replyToEmailId: string;
1808
- } | {
1809
- threadId?: never;
1810
- replyToEmailId?: never;
1811
- });
1812
- interface CreateInboxDraftRequestOptions extends PostOptions {}
1813
- interface CreateInboxDraftResponseSuccess {
1814
- object: 'inbox_draft';
1815
- id: string;
1816
- }
1817
- type CreateInboxDraftResponse = Response<CreateInboxDraftResponseSuccess>;
1818
- //#endregion
1819
1794
  //#region src/inboxes/drafts/interfaces/draft.d.ts
1820
1795
  type InboxDraftType = 'standalone' | 'reply';
1796
+ interface InboxDraftAttachment {
1797
+ id: string;
1798
+ filename: string;
1799
+ content_type: string;
1800
+ size: number;
1801
+ }
1802
+ interface InboxDraftAttachmentOptions {
1803
+ /** Content of the file, as a base64 string or a Buffer. */
1804
+ content: string | Buffer;
1805
+ filename: string;
1806
+ contentType: string;
1807
+ }
1821
1808
  interface InboxDraft {
1822
1809
  object: 'inbox_draft';
1823
1810
  id: string;
@@ -1833,6 +1820,7 @@ interface InboxDraft {
1833
1820
  email_id: string | null;
1834
1821
  created_at: string;
1835
1822
  updated_at: string;
1823
+ attachments: InboxDraftAttachment[];
1836
1824
  }
1837
1825
  interface InboxDraftListItem {
1838
1826
  id: string;
@@ -1845,7 +1833,38 @@ interface InboxDraftListItem {
1845
1833
  thread_id: string | null;
1846
1834
  reply_to_email_id: string | null;
1847
1835
  updated_at: string;
1836
+ attachments: InboxDraftAttachment[];
1837
+ }
1838
+ //#endregion
1839
+ //#region src/inboxes/drafts/interfaces/create-inbox-draft.interface.d.ts
1840
+ type CreateInboxDraftContent = RequireAtLeastOne<{
1841
+ to?: string | string[] | null;
1842
+ cc?: string | string[] | null;
1843
+ bcc?: string | string[] | null;
1844
+ subject?: string | null;
1845
+ text?: string | null;
1846
+ html?: string | null;
1847
+ /**
1848
+ * Files to store on the draft. Each one needs `content`, `filename` and `contentType`.
1849
+ * The files on a draft can total at most 25 MB. An empty file or a blocked file type returns a 422.
1850
+ */
1851
+ attachments?: InboxDraftAttachmentOptions[];
1852
+ }>;
1853
+ type CreateInboxDraftOptions = {
1854
+ inboxId: string;
1855
+ } & CreateInboxDraftContent & ({
1856
+ threadId: string;
1857
+ replyToEmailId: string;
1858
+ } | {
1859
+ threadId?: never;
1860
+ replyToEmailId?: never;
1861
+ });
1862
+ interface CreateInboxDraftRequestOptions extends PostOptions, IdempotentRequest {}
1863
+ interface CreateInboxDraftResponseSuccess {
1864
+ object: 'inbox_draft';
1865
+ id: string;
1848
1866
  }
1867
+ type CreateInboxDraftResponse = Response<CreateInboxDraftResponseSuccess>;
1849
1868
  //#endregion
1850
1869
  //#region src/inboxes/drafts/interfaces/get-inbox-draft.interface.d.ts
1851
1870
  interface GetInboxDraftOptions {
@@ -1882,13 +1901,18 @@ type RemoveInboxDraftResponse = Response<RemoveInboxDraftResponseSuccess>;
1882
1901
  interface SendInboxDraftOptions {
1883
1902
  inboxId: string;
1884
1903
  draftId: string;
1904
+ /**
1905
+ * Custom headers to add to the email.
1906
+ * The `In-Reply-To`, `References` and `Reply-To` headers are set by Resend and cannot be set here.
1907
+ * Sending one of them, in any letter case, returns a 422.
1908
+ * Header names cannot be empty, and names and values cannot contain line breaks or null characters, or the request returns a 422.
1909
+ * `null` means no custom headers.
1910
+ */
1911
+ headers?: Record<string, string> | null;
1885
1912
  }
1886
1913
  interface SendInboxDraftRequestOptions extends PostOptions, IdempotentRequest {}
1887
1914
  interface SendInboxDraftResponseSuccess {
1888
- object: 'inbox_draft';
1889
1915
  id: string;
1890
- thread_id: string;
1891
- email_id: string;
1892
1916
  }
1893
1917
  type SendInboxDraftResponse = Response<SendInboxDraftResponseSuccess>;
1894
1918
  //#endregion
@@ -1903,6 +1927,12 @@ type UpdateInboxDraftOptions = {
1903
1927
  subject?: string | null;
1904
1928
  text?: string | null;
1905
1929
  html?: string | null;
1930
+ /**
1931
+ * Files to store on the draft. Each one needs `content`, `filename` and `contentType`.
1932
+ * The files on a draft can total at most 25 MB. An empty file or a blocked file type returns a 422.
1933
+ * Sending the field replaces every attachment on the draft. Send `[]` or `null` to remove them all.
1934
+ */
1935
+ attachments?: InboxDraftAttachmentOptions[] | null;
1906
1936
  }>;
1907
1937
  type UpdateInboxDraftResponseSuccess = InboxDraft;
1908
1938
  type UpdateInboxDraftResponse = Response<UpdateInboxDraftResponseSuccess>;
@@ -1978,6 +2008,42 @@ interface UpdateInboxLabelResponseSuccess {
1978
2008
  }
1979
2009
  type UpdateInboxLabelResponse = Response<UpdateInboxLabelResponseSuccess>;
1980
2010
  //#endregion
2011
+ //#region src/inboxes/threads/interfaces/forward-inbox-thread-email.interface.d.ts
2012
+ interface ForwardInboxThreadEmailOptions {
2013
+ inboxId: string;
2014
+ threadId: string;
2015
+ emailId: string;
2016
+ to: string | string[];
2017
+ cc?: string | string[];
2018
+ bcc?: string | string[];
2019
+ html?: string;
2020
+ text?: string;
2021
+ subject?: string;
2022
+ /**
2023
+ * Files to attach, as on `POST /emails`. Each one needs `content` or `path`.
2024
+ * They share one limit with the attachments of the original message, which the forward also sends.
2025
+ * Together they can have up to 10 files and at most 25 MB of `content`.
2026
+ * A `path` file counts toward the 10 files only, because it is fetched when the email is sent.
2027
+ * An empty file, a blocked file type, a `path` that is not an `http` or `https` URL or that points to `localhost`, `127.0.0.1` or `0.0.0.0`,
2028
+ * or a `content_type` that is not a valid MIME type returns a 422.
2029
+ * An original attachment that was sent from a URL (`path`) cannot be forwarded, and the request returns a 422.
2030
+ */
2031
+ attachments?: Attachment[];
2032
+ /**
2033
+ * Custom headers to add to the email.
2034
+ * The `In-Reply-To`, `References` and `Reply-To` headers are set by Resend and cannot be set here.
2035
+ * Sending one of them, in any letter case, returns a 422.
2036
+ * Header names cannot be empty, and names and values cannot contain line breaks or null characters, or the request returns a 422.
2037
+ * `null` means no custom headers.
2038
+ */
2039
+ headers?: Record<string, string> | null;
2040
+ }
2041
+ interface ForwardInboxThreadEmailRequestOptions extends PostOptions, IdempotentRequest {}
2042
+ interface ForwardInboxThreadEmailResponseSuccess {
2043
+ id: string;
2044
+ }
2045
+ type ForwardInboxThreadEmailResponse = Response<ForwardInboxThreadEmailResponseSuccess>;
2046
+ //#endregion
1981
2047
  //#region src/inboxes/threads/interfaces/thread.d.ts
1982
2048
  interface InboxThreadLabel {
1983
2049
  id: string;
@@ -1992,7 +2058,7 @@ interface InboxThread {
1992
2058
  cc: string[];
1993
2059
  bcc: string[];
1994
2060
  labels: InboxThreadLabel[];
1995
- message_count: number;
2061
+ email_count: number;
1996
2062
  has_attachment: boolean;
1997
2063
  has_draft: boolean;
1998
2064
  read: boolean;
@@ -2029,43 +2095,6 @@ interface InboxMessage {
2029
2095
  received_at: string;
2030
2096
  }
2031
2097
  //#endregion
2032
- //#region src/inboxes/threads/interfaces/reply-inbox-thread-email.interface.d.ts
2033
- type ReplyInboxThreadEmailOptions = {
2034
- inboxId: string;
2035
- threadId: string;
2036
- emailId: string;
2037
- } & RequireAtLeastOne<{
2038
- html?: string;
2039
- text?: string;
2040
- }> & {
2041
- cc?: string | string[];
2042
- bcc?: string | string[];
2043
- subject?: string;
2044
- replyAll?: boolean;
2045
- };
2046
- interface ReplyInboxThreadEmailRequestOptions extends PostOptions, IdempotentRequest {}
2047
- type ReplyInboxThreadEmailResponseSuccess = InboxMessage & {
2048
- direction: 'outbound';
2049
- email_id: string;
2050
- };
2051
- type ReplyInboxThreadEmailResponse = Response<ReplyInboxThreadEmailResponseSuccess>;
2052
- //#endregion
2053
- //#region src/inboxes/threads/interfaces/forward-inbox-thread-email.interface.d.ts
2054
- interface ForwardInboxThreadEmailOptions {
2055
- inboxId: string;
2056
- threadId: string;
2057
- emailId: string;
2058
- to: string | string[];
2059
- cc?: string | string[];
2060
- bcc?: string | string[];
2061
- html?: string;
2062
- text?: string;
2063
- subject?: string;
2064
- }
2065
- interface ForwardInboxThreadEmailRequestOptions extends PostOptions, IdempotentRequest {}
2066
- type ForwardInboxThreadEmailResponseSuccess = ReplyInboxThreadEmailResponseSuccess;
2067
- type ForwardInboxThreadEmailResponse = Response<ForwardInboxThreadEmailResponseSuccess>;
2068
- //#endregion
2069
2098
  //#region src/inboxes/threads/interfaces/get-inbox-thread.interface.d.ts
2070
2099
  interface GetInboxThreadOptions {
2071
2100
  inboxId: string;
@@ -2121,6 +2150,42 @@ interface RemoveInboxThreadResponseSuccess {
2121
2150
  }
2122
2151
  type RemoveInboxThreadResponse = Response<RemoveInboxThreadResponseSuccess>;
2123
2152
  //#endregion
2153
+ //#region src/inboxes/threads/interfaces/reply-inbox-thread-email.interface.d.ts
2154
+ type ReplyInboxThreadEmailOptions = {
2155
+ inboxId: string;
2156
+ threadId: string;
2157
+ emailId: string;
2158
+ } & RequireAtLeastOne<{
2159
+ html?: string;
2160
+ text?: string;
2161
+ }> & {
2162
+ cc?: string | string[];
2163
+ bcc?: string | string[];
2164
+ subject?: string;
2165
+ replyAll?: boolean;
2166
+ /**
2167
+ * Files to attach, as on `POST /emails`. Each one needs `content` or `path`.
2168
+ * Up to 10 files. The `content` of all files can total at most 25 MB.
2169
+ * A `path` file counts toward the 10 files only, because it is fetched when the email is sent.
2170
+ * An empty file, a blocked file type, a `path` that is not an `http` or `https` URL or that points to `localhost`, `127.0.0.1` or `0.0.0.0`,
2171
+ * or a `content_type` that is not a valid MIME type returns a 422.
2172
+ */
2173
+ attachments?: Attachment[];
2174
+ /**
2175
+ * Custom headers to add to the email.
2176
+ * The `In-Reply-To`, `References` and `Reply-To` headers are set by Resend and cannot be set here.
2177
+ * Sending one of them, in any letter case, returns a 422.
2178
+ * Header names cannot be empty, and names and values cannot contain line breaks or null characters, or the request returns a 422.
2179
+ * `null` means no custom headers.
2180
+ */
2181
+ headers?: Record<string, string> | null;
2182
+ };
2183
+ interface ReplyInboxThreadEmailRequestOptions extends PostOptions, IdempotentRequest {}
2184
+ interface ReplyInboxThreadEmailResponseSuccess {
2185
+ id: string;
2186
+ }
2187
+ type ReplyInboxThreadEmailResponse = Response<ReplyInboxThreadEmailResponseSuccess>;
2188
+ //#endregion
2124
2189
  //#region src/inboxes/threads/interfaces/search-inbox-threads.interface.d.ts
2125
2190
  type SearchInboxThreadsOptions = ListInboxThreadsOptions & {
2126
2191
  query?: string;
@@ -2151,8 +2216,10 @@ type UpdateInboxThreadOptions = {
2151
2216
  } & RequireAtLeastOne<{
2152
2217
  read?: boolean;
2153
2218
  folder?: MoveThreadFolder;
2154
- /** Applies the label to the thread. Labels cannot be removed through this endpoint. */
2155
- labelId?: string;
2219
+ /** Label IDs to apply to the thread. Between 1 and 10 IDs. */
2220
+ addLabelIds?: string[];
2221
+ /** Label IDs to remove from the thread. Between 1 and 10 IDs. The labels themselves are kept. */
2222
+ removeLabelIds?: string[];
2156
2223
  }>;
2157
2224
  type UpdateInboxThreadResponseSuccess = InboxThreadSummary;
2158
2225
  type UpdateInboxThreadResponse = Response<UpdateInboxThreadResponseSuccess>;
@@ -3031,16 +3098,49 @@ interface TopicEventData {
3031
3098
  created_at: string;
3032
3099
  updated_at: string;
3033
3100
  }
3034
- interface InboxEventData {
3035
- source: 'api' | 'dashboard' | 'agent' | 'system';
3101
+ type InboxEventSource = 'api' | 'dashboard' | 'agent' | 'system';
3102
+ type InboxEventEmail = Omit<InboxMessage, 'html' | 'text'>;
3103
+ type InboxEventDraft = Omit<InboxDraft, 'html' | 'text'>;
3104
+ interface InboxBaseEventData {
3105
+ source: InboxEventSource;
3036
3106
  inbox_id: string;
3107
+ }
3108
+ interface InboxEventData extends InboxBaseEventData {
3109
+ inbox?: GetInboxResponseSuccess;
3110
+ }
3111
+ interface InboxThreadEventData extends InboxBaseEventData {
3112
+ thread_id: string;
3113
+ thread?: InboxThreadSummary;
3114
+ }
3115
+ interface InboxThreadEmailEventData extends InboxThreadEventData {
3116
+ email_id: string;
3117
+ email?: InboxEventEmail;
3118
+ }
3119
+ interface InboxThreadFolderUpdatedEventData extends InboxThreadEventData {
3120
+ from: MoveThreadFolder;
3121
+ to: MoveThreadFolder;
3122
+ }
3123
+ interface InboxThreadAssignedEventData extends InboxThreadEventData {
3124
+ assignee_email: string | null;
3125
+ assigned_by_email: string | null;
3126
+ previous_assignee_email: string | null;
3127
+ }
3128
+ interface InboxThreadUnassignedEventData extends InboxThreadEventData {
3129
+ previous_assignee_email: string | null;
3130
+ }
3131
+ interface InboxThreadLabelsUpdatedEventData extends InboxThreadEventData {
3132
+ added: InboxThreadLabel[];
3133
+ removed: InboxThreadLabel[];
3134
+ }
3135
+ interface InboxDraftEventData extends InboxBaseEventData {
3037
3136
  thread_id?: string;
3038
- email_id?: string;
3039
- draft_id?: string;
3137
+ draft_id: string;
3040
3138
  thread?: InboxThreadSummary;
3041
- email?: Omit<InboxMessage, 'html' | 'text'>;
3042
- draft?: Omit<InboxDraft, 'html' | 'text'>;
3043
- inbox?: GetInboxResponseSuccess;
3139
+ draft?: InboxEventDraft;
3140
+ }
3141
+ interface InboxDraftSentEventData extends InboxThreadEmailEventData {
3142
+ draft_id: string;
3143
+ draft?: InboxEventDraft;
3044
3144
  }
3045
3145
  interface EmailSentEvent {
3046
3146
  type: 'email.sent';
@@ -3178,74 +3278,62 @@ interface InboxUpdatedEvent {
3178
3278
  interface InboxDeletedEvent {
3179
3279
  type: 'inbox.deleted';
3180
3280
  created_at: string;
3181
- data: InboxEventData;
3281
+ data: InboxBaseEventData;
3182
3282
  }
3183
3283
  interface InboxThreadCreatedEvent {
3184
3284
  type: 'inbox.thread.created';
3185
3285
  created_at: string;
3186
- data: InboxEventData;
3286
+ data: InboxThreadEmailEventData;
3187
3287
  }
3188
3288
  interface InboxThreadFolderUpdatedEvent {
3189
3289
  type: 'inbox.thread.folder.updated';
3190
3290
  created_at: string;
3191
- data: InboxEventData & {
3192
- from: InboxMessageFolder;
3193
- to: InboxMessageFolder;
3194
- };
3291
+ data: InboxThreadFolderUpdatedEventData;
3195
3292
  }
3196
3293
  interface InboxThreadAssignedEvent {
3197
3294
  type: 'inbox.thread.assigned';
3198
3295
  created_at: string;
3199
- data: InboxEventData & {
3200
- assignee_email: string | null;
3201
- assigned_by_email: string | null;
3202
- previous_assignee_email: string | null;
3203
- };
3296
+ data: InboxThreadAssignedEventData;
3204
3297
  }
3205
3298
  interface InboxThreadUnassignedEvent {
3206
3299
  type: 'inbox.thread.unassigned';
3207
3300
  created_at: string;
3208
- data: InboxEventData & {
3209
- previous_assignee_email: string | null;
3210
- };
3301
+ data: InboxThreadUnassignedEventData;
3211
3302
  }
3212
3303
  interface InboxThreadLabelsUpdatedEvent {
3213
3304
  type: 'inbox.thread.labels.updated';
3214
3305
  created_at: string;
3215
- data: InboxEventData & {
3216
- added: InboxThreadLabel[];
3217
- removed: InboxThreadLabel[];
3218
- };
3306
+ data: InboxThreadLabelsUpdatedEventData;
3219
3307
  }
3220
3308
  interface InboxEmailReceivedEvent {
3221
3309
  type: 'inbox.email.received';
3222
3310
  created_at: string;
3223
- data: InboxEventData;
3311
+ data: InboxThreadEmailEventData;
3224
3312
  }
3225
3313
  interface InboxEmailSentEvent {
3226
3314
  type: 'inbox.email.sent';
3227
3315
  created_at: string;
3228
- data: InboxEventData;
3316
+ data: InboxThreadEmailEventData;
3229
3317
  }
3230
3318
  interface InboxDraftCreatedEvent {
3231
3319
  type: 'inbox.draft.created';
3232
3320
  created_at: string;
3233
- data: InboxEventData;
3321
+ data: InboxDraftEventData;
3234
3322
  }
3235
3323
  interface InboxDraftUpdatedEvent {
3236
3324
  type: 'inbox.draft.updated';
3237
3325
  created_at: string;
3238
- data: InboxEventData;
3326
+ data: InboxDraftEventData;
3239
3327
  }
3240
3328
  interface InboxDraftSentEvent {
3241
3329
  type: 'inbox.draft.sent';
3242
3330
  created_at: string;
3243
- data: InboxEventData;
3331
+ data: InboxDraftSentEventData;
3244
3332
  }
3245
3333
  interface InboxDraftDeletedEvent {
3246
3334
  type: 'inbox.draft.deleted';
3247
3335
  created_at: string;
3248
- data: InboxEventData;
3336
+ data: InboxDraftEventData;
3249
3337
  }
3250
3338
  type WebhookEventPayload = EmailSentEvent | EmailScheduledEvent | EmailDeliveredEvent | EmailDeliveryDelayedEvent | EmailComplainedEvent | EmailBouncedEvent | EmailOpenedEvent | EmailClickedEvent | EmailReceivedEvent | EmailFailedEvent | EmailSuppressedEvent | ContactCreatedEvent | ContactUpdatedEvent | ContactDeletedEvent | ContactTopicsUpdatedEvent | DomainCreatedEvent | DomainUpdatedEvent | DomainDeletedEvent | SuppressionAddedEvent | SuppressionRemovedEvent | TopicCreatedEvent | TopicUpdatedEvent | TopicDeletedEvent | InboxCreatedEvent | InboxUpdatedEvent | InboxDeletedEvent | InboxThreadCreatedEvent | InboxThreadFolderUpdatedEvent | InboxThreadAssignedEvent | InboxThreadUnassignedEvent | InboxThreadLabelsUpdatedEvent | InboxEmailReceivedEvent | InboxEmailSentEvent | InboxDraftCreatedEvent | InboxDraftUpdatedEvent | InboxDraftSentEvent | InboxDraftDeletedEvent;
3251
3339
  //#endregion
@@ -3467,4 +3555,4 @@ export declare class Resend {
3467
3555
  delete<T>(path: string, query?: unknown, options?: DeleteOptions): Promise<Response<T>>;
3468
3556
  }
3469
3557
  //#endregion
3470
- export type { ContactCreatedEvent, ContactDeletedEvent, ContactTopicsUpdatedEvent, ContactUpdatedEvent, CreateInboxDraftOptions, CreateInboxDraftRequestOptions, CreateInboxDraftResponse, CreateInboxDraftResponseSuccess, CreateInboxLabelOptions, CreateInboxLabelRequestOptions, CreateInboxLabelResponse, CreateInboxLabelResponseSuccess, CreateInboxOptions, CreateInboxRequestOptions, CreateInboxResponse, CreateInboxResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DomainCreatedEvent, DomainDeletedEvent, DomainUpdatedEvent, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, ErrorResponse, ForwardInboxThreadEmailOptions, ForwardInboxThreadEmailRequestOptions, ForwardInboxThreadEmailResponse, ForwardInboxThreadEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetInboxAgentOptions, GetInboxAgentResponse, GetInboxAgentResponseSuccess, GetInboxDraftOptions, GetInboxDraftResponse, GetInboxDraftResponseSuccess, GetInboxResponse, GetInboxResponseSuccess, GetInboxThreadEmailOptions, GetInboxThreadEmailResponse, GetInboxThreadEmailResponseSuccess, GetInboxThreadOptions, GetInboxThreadResponse, GetInboxThreadResponseSuccess, GetWebhookEventOptions, GetWebhookEventResponse, GetWebhookEventResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, Inbox, InboxAgentAction, InboxAgentSettings, InboxCreatedEvent, InboxDeletedEvent, InboxDraft, InboxDraftCreatedEvent, InboxDraftDeletedEvent, InboxDraftListItem, InboxDraftSentEvent, InboxDraftType, InboxDraftUpdatedEvent, InboxEmailReceivedEvent, InboxEmailSentEvent, InboxLabel, InboxLabelColor, InboxMessage, InboxMessageAttachment, InboxMessageFolder, InboxThread, InboxThreadAssignedEvent, InboxThreadCreatedEvent, InboxThreadFolderUpdatedEvent, InboxThreadLabel, InboxThreadLabelsUpdatedEvent, InboxThreadSearchHighlightKey, InboxThreadSearchResult, InboxThreadSummary, InboxThreadUnassignedEvent, InboxUpdatedEvent, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListInboxDraftsOptions, ListInboxDraftsResponse, ListInboxDraftsResponseSuccess, ListInboxLabelsOptions, ListInboxLabelsResponse, ListInboxLabelsResponseSuccess, ListInboxThreadEmailsOptions, ListInboxThreadEmailsResponse, ListInboxThreadEmailsResponseSuccess, ListInboxThreadsOptions, ListInboxThreadsResponse, ListInboxThreadsResponseSuccess, ListInboxesOptions, ListInboxesResponse, ListInboxesResponseSuccess, ListOAuthGrantsOptions, ListOAuthGrantsResponse, ListOAuthGrantsResponseSuccess, ListWebhookEventAttemptsOptions, ListWebhookEventAttemptsResponse, ListWebhookEventAttemptsResponseSuccess, ListWebhookEventsOptions, ListWebhookEventsResponse, ListWebhookEventsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, MoveThreadFolder, OAuthGrant, RemoveInboxDraftOptions, RemoveInboxDraftResponse, RemoveInboxDraftResponseSuccess, RemoveInboxLabelOptions, RemoveInboxLabelResponse, RemoveInboxLabelResponseSuccess, RemoveInboxResponse, RemoveInboxResponseSuccess, RemoveInboxThreadOptions, RemoveInboxThreadResponse, RemoveInboxThreadResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, ReplayWebhookEventOptions, ReplayWebhookEventResponse, ReplayWebhookEventResponseSuccess, ReplyInboxThreadEmailOptions, ReplyInboxThreadEmailRequestOptions, ReplyInboxThreadEmailResponse, ReplyInboxThreadEmailResponseSuccess, ResendOptions, Response, RevokeOAuthGrantResponse, RevokeOAuthGrantResponseSuccess, RotateWebhookSigningSecretResponse, RotateWebhookSigningSecretResponseSuccess, SearchInboxThreadsOptions, SearchInboxThreadsResponse, SearchInboxThreadsResponseSuccess, SendInboxDraftOptions, SendInboxDraftRequestOptions, SendInboxDraftResponse, SendInboxDraftResponseSuccess, SuppressionAddedEvent, SuppressionRemovedEvent, TopicCreatedEvent, TopicDeletedEvent, TopicUpdatedEvent, UpdateInboxAgentOptions, UpdateInboxAgentResponse, UpdateInboxAgentResponseSuccess, UpdateInboxDraftOptions, UpdateInboxDraftResponse, UpdateInboxDraftResponseSuccess, UpdateInboxLabelOptions, UpdateInboxLabelResponse, UpdateInboxLabelResponseSuccess, UpdateInboxOptions, UpdateInboxResponse, UpdateInboxResponseSuccess, UpdateInboxThreadOptions, UpdateInboxThreadResponse, UpdateInboxThreadResponseSuccess, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, Webhook, WebhookEvent, WebhookEventAttempt, WebhookEventLog, WebhookEventLogStatus, WebhookEventPayload };
3558
+ export type { ContactCreatedEvent, ContactDeletedEvent, ContactTopicsUpdatedEvent, ContactUpdatedEvent, CreateInboxDraftOptions, CreateInboxDraftRequestOptions, CreateInboxDraftResponse, CreateInboxDraftResponseSuccess, CreateInboxLabelOptions, CreateInboxLabelRequestOptions, CreateInboxLabelResponse, CreateInboxLabelResponseSuccess, CreateInboxOptions, CreateInboxRequestOptions, CreateInboxResponse, CreateInboxResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DomainCreatedEvent, DomainDeletedEvent, DomainUpdatedEvent, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, ErrorResponse, ForwardInboxThreadEmailOptions, ForwardInboxThreadEmailRequestOptions, ForwardInboxThreadEmailResponse, ForwardInboxThreadEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetInboxAgentOptions, GetInboxAgentResponse, GetInboxAgentResponseSuccess, GetInboxDraftOptions, GetInboxDraftResponse, GetInboxDraftResponseSuccess, GetInboxResponse, GetInboxResponseSuccess, GetInboxThreadEmailOptions, GetInboxThreadEmailResponse, GetInboxThreadEmailResponseSuccess, GetInboxThreadOptions, GetInboxThreadResponse, GetInboxThreadResponseSuccess, GetWebhookEventOptions, GetWebhookEventResponse, GetWebhookEventResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, Inbox, InboxAgentAction, InboxAgentSettings, InboxCreatedEvent, InboxDeletedEvent, InboxDraft, InboxDraftAttachment, InboxDraftAttachmentOptions, InboxDraftCreatedEvent, InboxDraftDeletedEvent, InboxDraftListItem, InboxDraftSentEvent, InboxDraftType, InboxDraftUpdatedEvent, InboxEmailReceivedEvent, InboxEmailSentEvent, InboxLabel, InboxLabelColor, InboxMessage, InboxMessageAttachment, InboxMessageFolder, InboxThread, InboxThreadAssignedEvent, InboxThreadCreatedEvent, InboxThreadFolderUpdatedEvent, InboxThreadLabel, InboxThreadLabelsUpdatedEvent, InboxThreadSearchHighlightKey, InboxThreadSearchResult, InboxThreadSummary, InboxThreadUnassignedEvent, InboxUpdatedEvent, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListInboxDraftsOptions, ListInboxDraftsResponse, ListInboxDraftsResponseSuccess, ListInboxLabelsOptions, ListInboxLabelsResponse, ListInboxLabelsResponseSuccess, ListInboxThreadEmailsOptions, ListInboxThreadEmailsResponse, ListInboxThreadEmailsResponseSuccess, ListInboxThreadsOptions, ListInboxThreadsResponse, ListInboxThreadsResponseSuccess, ListInboxesOptions, ListInboxesResponse, ListInboxesResponseSuccess, ListOAuthGrantsOptions, ListOAuthGrantsResponse, ListOAuthGrantsResponseSuccess, ListWebhookEventAttemptsOptions, ListWebhookEventAttemptsResponse, ListWebhookEventAttemptsResponseSuccess, ListWebhookEventsOptions, ListWebhookEventsResponse, ListWebhookEventsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, MoveThreadFolder, OAuthGrant, RemoveInboxDraftOptions, RemoveInboxDraftResponse, RemoveInboxDraftResponseSuccess, RemoveInboxLabelOptions, RemoveInboxLabelResponse, RemoveInboxLabelResponseSuccess, RemoveInboxResponse, RemoveInboxResponseSuccess, RemoveInboxThreadOptions, RemoveInboxThreadResponse, RemoveInboxThreadResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, ReplayWebhookEventOptions, ReplayWebhookEventResponse, ReplayWebhookEventResponseSuccess, ReplyInboxThreadEmailOptions, ReplyInboxThreadEmailRequestOptions, ReplyInboxThreadEmailResponse, ReplyInboxThreadEmailResponseSuccess, ResendOptions, Response, RevokeOAuthGrantResponse, RevokeOAuthGrantResponseSuccess, RotateWebhookSigningSecretResponse, RotateWebhookSigningSecretResponseSuccess, SearchInboxThreadsOptions, SearchInboxThreadsResponse, SearchInboxThreadsResponseSuccess, SendInboxDraftOptions, SendInboxDraftRequestOptions, SendInboxDraftResponse, SendInboxDraftResponseSuccess, SuppressionAddedEvent, SuppressionRemovedEvent, TopicCreatedEvent, TopicDeletedEvent, TopicUpdatedEvent, UpdateInboxAgentOptions, UpdateInboxAgentResponse, UpdateInboxAgentResponseSuccess, UpdateInboxDraftOptions, UpdateInboxDraftResponse, UpdateInboxDraftResponseSuccess, UpdateInboxLabelOptions, UpdateInboxLabelResponse, UpdateInboxLabelResponseSuccess, UpdateInboxOptions, UpdateInboxResponse, UpdateInboxResponseSuccess, UpdateInboxThreadOptions, UpdateInboxThreadResponse, UpdateInboxThreadResponseSuccess, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, Webhook, WebhookEvent, WebhookEventAttempt, WebhookEventLog, WebhookEventLogStatus, WebhookEventPayload };
package/dist/index.d.mts CHANGED
@@ -1791,33 +1791,20 @@ interface UpdateInboxAgentResponseSuccess {
1791
1791
  }
1792
1792
  type UpdateInboxAgentResponse = Response<UpdateInboxAgentResponseSuccess>;
1793
1793
  //#endregion
1794
- //#region src/inboxes/drafts/interfaces/create-inbox-draft.interface.d.ts
1795
- type CreateInboxDraftContent = RequireAtLeastOne<{
1796
- to?: string | string[];
1797
- cc?: string | string[];
1798
- bcc?: string | string[];
1799
- subject?: string | null;
1800
- text?: string | null;
1801
- html?: string | null;
1802
- }>;
1803
- type CreateInboxDraftOptions = {
1804
- inboxId: string;
1805
- } & CreateInboxDraftContent & ({
1806
- threadId: string;
1807
- replyToEmailId: string;
1808
- } | {
1809
- threadId?: never;
1810
- replyToEmailId?: never;
1811
- });
1812
- interface CreateInboxDraftRequestOptions extends PostOptions {}
1813
- interface CreateInboxDraftResponseSuccess {
1814
- object: 'inbox_draft';
1815
- id: string;
1816
- }
1817
- type CreateInboxDraftResponse = Response<CreateInboxDraftResponseSuccess>;
1818
- //#endregion
1819
1794
  //#region src/inboxes/drafts/interfaces/draft.d.ts
1820
1795
  type InboxDraftType = 'standalone' | 'reply';
1796
+ interface InboxDraftAttachment {
1797
+ id: string;
1798
+ filename: string;
1799
+ content_type: string;
1800
+ size: number;
1801
+ }
1802
+ interface InboxDraftAttachmentOptions {
1803
+ /** Content of the file, as a base64 string or a Buffer. */
1804
+ content: string | Buffer;
1805
+ filename: string;
1806
+ contentType: string;
1807
+ }
1821
1808
  interface InboxDraft {
1822
1809
  object: 'inbox_draft';
1823
1810
  id: string;
@@ -1833,6 +1820,7 @@ interface InboxDraft {
1833
1820
  email_id: string | null;
1834
1821
  created_at: string;
1835
1822
  updated_at: string;
1823
+ attachments: InboxDraftAttachment[];
1836
1824
  }
1837
1825
  interface InboxDraftListItem {
1838
1826
  id: string;
@@ -1845,7 +1833,38 @@ interface InboxDraftListItem {
1845
1833
  thread_id: string | null;
1846
1834
  reply_to_email_id: string | null;
1847
1835
  updated_at: string;
1836
+ attachments: InboxDraftAttachment[];
1837
+ }
1838
+ //#endregion
1839
+ //#region src/inboxes/drafts/interfaces/create-inbox-draft.interface.d.ts
1840
+ type CreateInboxDraftContent = RequireAtLeastOne<{
1841
+ to?: string | string[] | null;
1842
+ cc?: string | string[] | null;
1843
+ bcc?: string | string[] | null;
1844
+ subject?: string | null;
1845
+ text?: string | null;
1846
+ html?: string | null;
1847
+ /**
1848
+ * Files to store on the draft. Each one needs `content`, `filename` and `contentType`.
1849
+ * The files on a draft can total at most 25 MB. An empty file or a blocked file type returns a 422.
1850
+ */
1851
+ attachments?: InboxDraftAttachmentOptions[];
1852
+ }>;
1853
+ type CreateInboxDraftOptions = {
1854
+ inboxId: string;
1855
+ } & CreateInboxDraftContent & ({
1856
+ threadId: string;
1857
+ replyToEmailId: string;
1858
+ } | {
1859
+ threadId?: never;
1860
+ replyToEmailId?: never;
1861
+ });
1862
+ interface CreateInboxDraftRequestOptions extends PostOptions, IdempotentRequest {}
1863
+ interface CreateInboxDraftResponseSuccess {
1864
+ object: 'inbox_draft';
1865
+ id: string;
1848
1866
  }
1867
+ type CreateInboxDraftResponse = Response<CreateInboxDraftResponseSuccess>;
1849
1868
  //#endregion
1850
1869
  //#region src/inboxes/drafts/interfaces/get-inbox-draft.interface.d.ts
1851
1870
  interface GetInboxDraftOptions {
@@ -1882,13 +1901,18 @@ type RemoveInboxDraftResponse = Response<RemoveInboxDraftResponseSuccess>;
1882
1901
  interface SendInboxDraftOptions {
1883
1902
  inboxId: string;
1884
1903
  draftId: string;
1904
+ /**
1905
+ * Custom headers to add to the email.
1906
+ * The `In-Reply-To`, `References` and `Reply-To` headers are set by Resend and cannot be set here.
1907
+ * Sending one of them, in any letter case, returns a 422.
1908
+ * Header names cannot be empty, and names and values cannot contain line breaks or null characters, or the request returns a 422.
1909
+ * `null` means no custom headers.
1910
+ */
1911
+ headers?: Record<string, string> | null;
1885
1912
  }
1886
1913
  interface SendInboxDraftRequestOptions extends PostOptions, IdempotentRequest {}
1887
1914
  interface SendInboxDraftResponseSuccess {
1888
- object: 'inbox_draft';
1889
1915
  id: string;
1890
- thread_id: string;
1891
- email_id: string;
1892
1916
  }
1893
1917
  type SendInboxDraftResponse = Response<SendInboxDraftResponseSuccess>;
1894
1918
  //#endregion
@@ -1903,6 +1927,12 @@ type UpdateInboxDraftOptions = {
1903
1927
  subject?: string | null;
1904
1928
  text?: string | null;
1905
1929
  html?: string | null;
1930
+ /**
1931
+ * Files to store on the draft. Each one needs `content`, `filename` and `contentType`.
1932
+ * The files on a draft can total at most 25 MB. An empty file or a blocked file type returns a 422.
1933
+ * Sending the field replaces every attachment on the draft. Send `[]` or `null` to remove them all.
1934
+ */
1935
+ attachments?: InboxDraftAttachmentOptions[] | null;
1906
1936
  }>;
1907
1937
  type UpdateInboxDraftResponseSuccess = InboxDraft;
1908
1938
  type UpdateInboxDraftResponse = Response<UpdateInboxDraftResponseSuccess>;
@@ -1978,6 +2008,42 @@ interface UpdateInboxLabelResponseSuccess {
1978
2008
  }
1979
2009
  type UpdateInboxLabelResponse = Response<UpdateInboxLabelResponseSuccess>;
1980
2010
  //#endregion
2011
+ //#region src/inboxes/threads/interfaces/forward-inbox-thread-email.interface.d.ts
2012
+ interface ForwardInboxThreadEmailOptions {
2013
+ inboxId: string;
2014
+ threadId: string;
2015
+ emailId: string;
2016
+ to: string | string[];
2017
+ cc?: string | string[];
2018
+ bcc?: string | string[];
2019
+ html?: string;
2020
+ text?: string;
2021
+ subject?: string;
2022
+ /**
2023
+ * Files to attach, as on `POST /emails`. Each one needs `content` or `path`.
2024
+ * They share one limit with the attachments of the original message, which the forward also sends.
2025
+ * Together they can have up to 10 files and at most 25 MB of `content`.
2026
+ * A `path` file counts toward the 10 files only, because it is fetched when the email is sent.
2027
+ * An empty file, a blocked file type, a `path` that is not an `http` or `https` URL or that points to `localhost`, `127.0.0.1` or `0.0.0.0`,
2028
+ * or a `content_type` that is not a valid MIME type returns a 422.
2029
+ * An original attachment that was sent from a URL (`path`) cannot be forwarded, and the request returns a 422.
2030
+ */
2031
+ attachments?: Attachment[];
2032
+ /**
2033
+ * Custom headers to add to the email.
2034
+ * The `In-Reply-To`, `References` and `Reply-To` headers are set by Resend and cannot be set here.
2035
+ * Sending one of them, in any letter case, returns a 422.
2036
+ * Header names cannot be empty, and names and values cannot contain line breaks or null characters, or the request returns a 422.
2037
+ * `null` means no custom headers.
2038
+ */
2039
+ headers?: Record<string, string> | null;
2040
+ }
2041
+ interface ForwardInboxThreadEmailRequestOptions extends PostOptions, IdempotentRequest {}
2042
+ interface ForwardInboxThreadEmailResponseSuccess {
2043
+ id: string;
2044
+ }
2045
+ type ForwardInboxThreadEmailResponse = Response<ForwardInboxThreadEmailResponseSuccess>;
2046
+ //#endregion
1981
2047
  //#region src/inboxes/threads/interfaces/thread.d.ts
1982
2048
  interface InboxThreadLabel {
1983
2049
  id: string;
@@ -1992,7 +2058,7 @@ interface InboxThread {
1992
2058
  cc: string[];
1993
2059
  bcc: string[];
1994
2060
  labels: InboxThreadLabel[];
1995
- message_count: number;
2061
+ email_count: number;
1996
2062
  has_attachment: boolean;
1997
2063
  has_draft: boolean;
1998
2064
  read: boolean;
@@ -2029,43 +2095,6 @@ interface InboxMessage {
2029
2095
  received_at: string;
2030
2096
  }
2031
2097
  //#endregion
2032
- //#region src/inboxes/threads/interfaces/reply-inbox-thread-email.interface.d.ts
2033
- type ReplyInboxThreadEmailOptions = {
2034
- inboxId: string;
2035
- threadId: string;
2036
- emailId: string;
2037
- } & RequireAtLeastOne<{
2038
- html?: string;
2039
- text?: string;
2040
- }> & {
2041
- cc?: string | string[];
2042
- bcc?: string | string[];
2043
- subject?: string;
2044
- replyAll?: boolean;
2045
- };
2046
- interface ReplyInboxThreadEmailRequestOptions extends PostOptions, IdempotentRequest {}
2047
- type ReplyInboxThreadEmailResponseSuccess = InboxMessage & {
2048
- direction: 'outbound';
2049
- email_id: string;
2050
- };
2051
- type ReplyInboxThreadEmailResponse = Response<ReplyInboxThreadEmailResponseSuccess>;
2052
- //#endregion
2053
- //#region src/inboxes/threads/interfaces/forward-inbox-thread-email.interface.d.ts
2054
- interface ForwardInboxThreadEmailOptions {
2055
- inboxId: string;
2056
- threadId: string;
2057
- emailId: string;
2058
- to: string | string[];
2059
- cc?: string | string[];
2060
- bcc?: string | string[];
2061
- html?: string;
2062
- text?: string;
2063
- subject?: string;
2064
- }
2065
- interface ForwardInboxThreadEmailRequestOptions extends PostOptions, IdempotentRequest {}
2066
- type ForwardInboxThreadEmailResponseSuccess = ReplyInboxThreadEmailResponseSuccess;
2067
- type ForwardInboxThreadEmailResponse = Response<ForwardInboxThreadEmailResponseSuccess>;
2068
- //#endregion
2069
2098
  //#region src/inboxes/threads/interfaces/get-inbox-thread.interface.d.ts
2070
2099
  interface GetInboxThreadOptions {
2071
2100
  inboxId: string;
@@ -2121,6 +2150,42 @@ interface RemoveInboxThreadResponseSuccess {
2121
2150
  }
2122
2151
  type RemoveInboxThreadResponse = Response<RemoveInboxThreadResponseSuccess>;
2123
2152
  //#endregion
2153
+ //#region src/inboxes/threads/interfaces/reply-inbox-thread-email.interface.d.ts
2154
+ type ReplyInboxThreadEmailOptions = {
2155
+ inboxId: string;
2156
+ threadId: string;
2157
+ emailId: string;
2158
+ } & RequireAtLeastOne<{
2159
+ html?: string;
2160
+ text?: string;
2161
+ }> & {
2162
+ cc?: string | string[];
2163
+ bcc?: string | string[];
2164
+ subject?: string;
2165
+ replyAll?: boolean;
2166
+ /**
2167
+ * Files to attach, as on `POST /emails`. Each one needs `content` or `path`.
2168
+ * Up to 10 files. The `content` of all files can total at most 25 MB.
2169
+ * A `path` file counts toward the 10 files only, because it is fetched when the email is sent.
2170
+ * An empty file, a blocked file type, a `path` that is not an `http` or `https` URL or that points to `localhost`, `127.0.0.1` or `0.0.0.0`,
2171
+ * or a `content_type` that is not a valid MIME type returns a 422.
2172
+ */
2173
+ attachments?: Attachment[];
2174
+ /**
2175
+ * Custom headers to add to the email.
2176
+ * The `In-Reply-To`, `References` and `Reply-To` headers are set by Resend and cannot be set here.
2177
+ * Sending one of them, in any letter case, returns a 422.
2178
+ * Header names cannot be empty, and names and values cannot contain line breaks or null characters, or the request returns a 422.
2179
+ * `null` means no custom headers.
2180
+ */
2181
+ headers?: Record<string, string> | null;
2182
+ };
2183
+ interface ReplyInboxThreadEmailRequestOptions extends PostOptions, IdempotentRequest {}
2184
+ interface ReplyInboxThreadEmailResponseSuccess {
2185
+ id: string;
2186
+ }
2187
+ type ReplyInboxThreadEmailResponse = Response<ReplyInboxThreadEmailResponseSuccess>;
2188
+ //#endregion
2124
2189
  //#region src/inboxes/threads/interfaces/search-inbox-threads.interface.d.ts
2125
2190
  type SearchInboxThreadsOptions = ListInboxThreadsOptions & {
2126
2191
  query?: string;
@@ -2151,8 +2216,10 @@ type UpdateInboxThreadOptions = {
2151
2216
  } & RequireAtLeastOne<{
2152
2217
  read?: boolean;
2153
2218
  folder?: MoveThreadFolder;
2154
- /** Applies the label to the thread. Labels cannot be removed through this endpoint. */
2155
- labelId?: string;
2219
+ /** Label IDs to apply to the thread. Between 1 and 10 IDs. */
2220
+ addLabelIds?: string[];
2221
+ /** Label IDs to remove from the thread. Between 1 and 10 IDs. The labels themselves are kept. */
2222
+ removeLabelIds?: string[];
2156
2223
  }>;
2157
2224
  type UpdateInboxThreadResponseSuccess = InboxThreadSummary;
2158
2225
  type UpdateInboxThreadResponse = Response<UpdateInboxThreadResponseSuccess>;
@@ -3031,16 +3098,49 @@ interface TopicEventData {
3031
3098
  created_at: string;
3032
3099
  updated_at: string;
3033
3100
  }
3034
- interface InboxEventData {
3035
- source: 'api' | 'dashboard' | 'agent' | 'system';
3101
+ type InboxEventSource = 'api' | 'dashboard' | 'agent' | 'system';
3102
+ type InboxEventEmail = Omit<InboxMessage, 'html' | 'text'>;
3103
+ type InboxEventDraft = Omit<InboxDraft, 'html' | 'text'>;
3104
+ interface InboxBaseEventData {
3105
+ source: InboxEventSource;
3036
3106
  inbox_id: string;
3107
+ }
3108
+ interface InboxEventData extends InboxBaseEventData {
3109
+ inbox?: GetInboxResponseSuccess;
3110
+ }
3111
+ interface InboxThreadEventData extends InboxBaseEventData {
3112
+ thread_id: string;
3113
+ thread?: InboxThreadSummary;
3114
+ }
3115
+ interface InboxThreadEmailEventData extends InboxThreadEventData {
3116
+ email_id: string;
3117
+ email?: InboxEventEmail;
3118
+ }
3119
+ interface InboxThreadFolderUpdatedEventData extends InboxThreadEventData {
3120
+ from: MoveThreadFolder;
3121
+ to: MoveThreadFolder;
3122
+ }
3123
+ interface InboxThreadAssignedEventData extends InboxThreadEventData {
3124
+ assignee_email: string | null;
3125
+ assigned_by_email: string | null;
3126
+ previous_assignee_email: string | null;
3127
+ }
3128
+ interface InboxThreadUnassignedEventData extends InboxThreadEventData {
3129
+ previous_assignee_email: string | null;
3130
+ }
3131
+ interface InboxThreadLabelsUpdatedEventData extends InboxThreadEventData {
3132
+ added: InboxThreadLabel[];
3133
+ removed: InboxThreadLabel[];
3134
+ }
3135
+ interface InboxDraftEventData extends InboxBaseEventData {
3037
3136
  thread_id?: string;
3038
- email_id?: string;
3039
- draft_id?: string;
3137
+ draft_id: string;
3040
3138
  thread?: InboxThreadSummary;
3041
- email?: Omit<InboxMessage, 'html' | 'text'>;
3042
- draft?: Omit<InboxDraft, 'html' | 'text'>;
3043
- inbox?: GetInboxResponseSuccess;
3139
+ draft?: InboxEventDraft;
3140
+ }
3141
+ interface InboxDraftSentEventData extends InboxThreadEmailEventData {
3142
+ draft_id: string;
3143
+ draft?: InboxEventDraft;
3044
3144
  }
3045
3145
  interface EmailSentEvent {
3046
3146
  type: 'email.sent';
@@ -3178,74 +3278,62 @@ interface InboxUpdatedEvent {
3178
3278
  interface InboxDeletedEvent {
3179
3279
  type: 'inbox.deleted';
3180
3280
  created_at: string;
3181
- data: InboxEventData;
3281
+ data: InboxBaseEventData;
3182
3282
  }
3183
3283
  interface InboxThreadCreatedEvent {
3184
3284
  type: 'inbox.thread.created';
3185
3285
  created_at: string;
3186
- data: InboxEventData;
3286
+ data: InboxThreadEmailEventData;
3187
3287
  }
3188
3288
  interface InboxThreadFolderUpdatedEvent {
3189
3289
  type: 'inbox.thread.folder.updated';
3190
3290
  created_at: string;
3191
- data: InboxEventData & {
3192
- from: InboxMessageFolder;
3193
- to: InboxMessageFolder;
3194
- };
3291
+ data: InboxThreadFolderUpdatedEventData;
3195
3292
  }
3196
3293
  interface InboxThreadAssignedEvent {
3197
3294
  type: 'inbox.thread.assigned';
3198
3295
  created_at: string;
3199
- data: InboxEventData & {
3200
- assignee_email: string | null;
3201
- assigned_by_email: string | null;
3202
- previous_assignee_email: string | null;
3203
- };
3296
+ data: InboxThreadAssignedEventData;
3204
3297
  }
3205
3298
  interface InboxThreadUnassignedEvent {
3206
3299
  type: 'inbox.thread.unassigned';
3207
3300
  created_at: string;
3208
- data: InboxEventData & {
3209
- previous_assignee_email: string | null;
3210
- };
3301
+ data: InboxThreadUnassignedEventData;
3211
3302
  }
3212
3303
  interface InboxThreadLabelsUpdatedEvent {
3213
3304
  type: 'inbox.thread.labels.updated';
3214
3305
  created_at: string;
3215
- data: InboxEventData & {
3216
- added: InboxThreadLabel[];
3217
- removed: InboxThreadLabel[];
3218
- };
3306
+ data: InboxThreadLabelsUpdatedEventData;
3219
3307
  }
3220
3308
  interface InboxEmailReceivedEvent {
3221
3309
  type: 'inbox.email.received';
3222
3310
  created_at: string;
3223
- data: InboxEventData;
3311
+ data: InboxThreadEmailEventData;
3224
3312
  }
3225
3313
  interface InboxEmailSentEvent {
3226
3314
  type: 'inbox.email.sent';
3227
3315
  created_at: string;
3228
- data: InboxEventData;
3316
+ data: InboxThreadEmailEventData;
3229
3317
  }
3230
3318
  interface InboxDraftCreatedEvent {
3231
3319
  type: 'inbox.draft.created';
3232
3320
  created_at: string;
3233
- data: InboxEventData;
3321
+ data: InboxDraftEventData;
3234
3322
  }
3235
3323
  interface InboxDraftUpdatedEvent {
3236
3324
  type: 'inbox.draft.updated';
3237
3325
  created_at: string;
3238
- data: InboxEventData;
3326
+ data: InboxDraftEventData;
3239
3327
  }
3240
3328
  interface InboxDraftSentEvent {
3241
3329
  type: 'inbox.draft.sent';
3242
3330
  created_at: string;
3243
- data: InboxEventData;
3331
+ data: InboxDraftSentEventData;
3244
3332
  }
3245
3333
  interface InboxDraftDeletedEvent {
3246
3334
  type: 'inbox.draft.deleted';
3247
3335
  created_at: string;
3248
- data: InboxEventData;
3336
+ data: InboxDraftEventData;
3249
3337
  }
3250
3338
  type WebhookEventPayload = EmailSentEvent | EmailScheduledEvent | EmailDeliveredEvent | EmailDeliveryDelayedEvent | EmailComplainedEvent | EmailBouncedEvent | EmailOpenedEvent | EmailClickedEvent | EmailReceivedEvent | EmailFailedEvent | EmailSuppressedEvent | ContactCreatedEvent | ContactUpdatedEvent | ContactDeletedEvent | ContactTopicsUpdatedEvent | DomainCreatedEvent | DomainUpdatedEvent | DomainDeletedEvent | SuppressionAddedEvent | SuppressionRemovedEvent | TopicCreatedEvent | TopicUpdatedEvent | TopicDeletedEvent | InboxCreatedEvent | InboxUpdatedEvent | InboxDeletedEvent | InboxThreadCreatedEvent | InboxThreadFolderUpdatedEvent | InboxThreadAssignedEvent | InboxThreadUnassignedEvent | InboxThreadLabelsUpdatedEvent | InboxEmailReceivedEvent | InboxEmailSentEvent | InboxDraftCreatedEvent | InboxDraftUpdatedEvent | InboxDraftSentEvent | InboxDraftDeletedEvent;
3251
3339
  //#endregion
@@ -3467,4 +3555,4 @@ export declare class Resend {
3467
3555
  delete<T>(path: string, query?: unknown, options?: DeleteOptions): Promise<Response<T>>;
3468
3556
  }
3469
3557
  //#endregion
3470
- export type { ContactCreatedEvent, ContactDeletedEvent, ContactTopicsUpdatedEvent, ContactUpdatedEvent, CreateInboxDraftOptions, CreateInboxDraftRequestOptions, CreateInboxDraftResponse, CreateInboxDraftResponseSuccess, CreateInboxLabelOptions, CreateInboxLabelRequestOptions, CreateInboxLabelResponse, CreateInboxLabelResponseSuccess, CreateInboxOptions, CreateInboxRequestOptions, CreateInboxResponse, CreateInboxResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DomainCreatedEvent, DomainDeletedEvent, DomainUpdatedEvent, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, ErrorResponse, ForwardInboxThreadEmailOptions, ForwardInboxThreadEmailRequestOptions, ForwardInboxThreadEmailResponse, ForwardInboxThreadEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetInboxAgentOptions, GetInboxAgentResponse, GetInboxAgentResponseSuccess, GetInboxDraftOptions, GetInboxDraftResponse, GetInboxDraftResponseSuccess, GetInboxResponse, GetInboxResponseSuccess, GetInboxThreadEmailOptions, GetInboxThreadEmailResponse, GetInboxThreadEmailResponseSuccess, GetInboxThreadOptions, GetInboxThreadResponse, GetInboxThreadResponseSuccess, GetWebhookEventOptions, GetWebhookEventResponse, GetWebhookEventResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, Inbox, InboxAgentAction, InboxAgentSettings, InboxCreatedEvent, InboxDeletedEvent, InboxDraft, InboxDraftCreatedEvent, InboxDraftDeletedEvent, InboxDraftListItem, InboxDraftSentEvent, InboxDraftType, InboxDraftUpdatedEvent, InboxEmailReceivedEvent, InboxEmailSentEvent, InboxLabel, InboxLabelColor, InboxMessage, InboxMessageAttachment, InboxMessageFolder, InboxThread, InboxThreadAssignedEvent, InboxThreadCreatedEvent, InboxThreadFolderUpdatedEvent, InboxThreadLabel, InboxThreadLabelsUpdatedEvent, InboxThreadSearchHighlightKey, InboxThreadSearchResult, InboxThreadSummary, InboxThreadUnassignedEvent, InboxUpdatedEvent, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListInboxDraftsOptions, ListInboxDraftsResponse, ListInboxDraftsResponseSuccess, ListInboxLabelsOptions, ListInboxLabelsResponse, ListInboxLabelsResponseSuccess, ListInboxThreadEmailsOptions, ListInboxThreadEmailsResponse, ListInboxThreadEmailsResponseSuccess, ListInboxThreadsOptions, ListInboxThreadsResponse, ListInboxThreadsResponseSuccess, ListInboxesOptions, ListInboxesResponse, ListInboxesResponseSuccess, ListOAuthGrantsOptions, ListOAuthGrantsResponse, ListOAuthGrantsResponseSuccess, ListWebhookEventAttemptsOptions, ListWebhookEventAttemptsResponse, ListWebhookEventAttemptsResponseSuccess, ListWebhookEventsOptions, ListWebhookEventsResponse, ListWebhookEventsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, MoveThreadFolder, OAuthGrant, RemoveInboxDraftOptions, RemoveInboxDraftResponse, RemoveInboxDraftResponseSuccess, RemoveInboxLabelOptions, RemoveInboxLabelResponse, RemoveInboxLabelResponseSuccess, RemoveInboxResponse, RemoveInboxResponseSuccess, RemoveInboxThreadOptions, RemoveInboxThreadResponse, RemoveInboxThreadResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, ReplayWebhookEventOptions, ReplayWebhookEventResponse, ReplayWebhookEventResponseSuccess, ReplyInboxThreadEmailOptions, ReplyInboxThreadEmailRequestOptions, ReplyInboxThreadEmailResponse, ReplyInboxThreadEmailResponseSuccess, ResendOptions, Response, RevokeOAuthGrantResponse, RevokeOAuthGrantResponseSuccess, RotateWebhookSigningSecretResponse, RotateWebhookSigningSecretResponseSuccess, SearchInboxThreadsOptions, SearchInboxThreadsResponse, SearchInboxThreadsResponseSuccess, SendInboxDraftOptions, SendInboxDraftRequestOptions, SendInboxDraftResponse, SendInboxDraftResponseSuccess, SuppressionAddedEvent, SuppressionRemovedEvent, TopicCreatedEvent, TopicDeletedEvent, TopicUpdatedEvent, UpdateInboxAgentOptions, UpdateInboxAgentResponse, UpdateInboxAgentResponseSuccess, UpdateInboxDraftOptions, UpdateInboxDraftResponse, UpdateInboxDraftResponseSuccess, UpdateInboxLabelOptions, UpdateInboxLabelResponse, UpdateInboxLabelResponseSuccess, UpdateInboxOptions, UpdateInboxResponse, UpdateInboxResponseSuccess, UpdateInboxThreadOptions, UpdateInboxThreadResponse, UpdateInboxThreadResponseSuccess, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, Webhook, WebhookEvent, WebhookEventAttempt, WebhookEventLog, WebhookEventLogStatus, WebhookEventPayload };
3558
+ export type { ContactCreatedEvent, ContactDeletedEvent, ContactTopicsUpdatedEvent, ContactUpdatedEvent, CreateInboxDraftOptions, CreateInboxDraftRequestOptions, CreateInboxDraftResponse, CreateInboxDraftResponseSuccess, CreateInboxLabelOptions, CreateInboxLabelRequestOptions, CreateInboxLabelResponse, CreateInboxLabelResponseSuccess, CreateInboxOptions, CreateInboxRequestOptions, CreateInboxResponse, CreateInboxResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DomainCreatedEvent, DomainDeletedEvent, DomainUpdatedEvent, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, ErrorResponse, ForwardInboxThreadEmailOptions, ForwardInboxThreadEmailRequestOptions, ForwardInboxThreadEmailResponse, ForwardInboxThreadEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetInboxAgentOptions, GetInboxAgentResponse, GetInboxAgentResponseSuccess, GetInboxDraftOptions, GetInboxDraftResponse, GetInboxDraftResponseSuccess, GetInboxResponse, GetInboxResponseSuccess, GetInboxThreadEmailOptions, GetInboxThreadEmailResponse, GetInboxThreadEmailResponseSuccess, GetInboxThreadOptions, GetInboxThreadResponse, GetInboxThreadResponseSuccess, GetWebhookEventOptions, GetWebhookEventResponse, GetWebhookEventResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, Inbox, InboxAgentAction, InboxAgentSettings, InboxCreatedEvent, InboxDeletedEvent, InboxDraft, InboxDraftAttachment, InboxDraftAttachmentOptions, InboxDraftCreatedEvent, InboxDraftDeletedEvent, InboxDraftListItem, InboxDraftSentEvent, InboxDraftType, InboxDraftUpdatedEvent, InboxEmailReceivedEvent, InboxEmailSentEvent, InboxLabel, InboxLabelColor, InboxMessage, InboxMessageAttachment, InboxMessageFolder, InboxThread, InboxThreadAssignedEvent, InboxThreadCreatedEvent, InboxThreadFolderUpdatedEvent, InboxThreadLabel, InboxThreadLabelsUpdatedEvent, InboxThreadSearchHighlightKey, InboxThreadSearchResult, InboxThreadSummary, InboxThreadUnassignedEvent, InboxUpdatedEvent, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListInboxDraftsOptions, ListInboxDraftsResponse, ListInboxDraftsResponseSuccess, ListInboxLabelsOptions, ListInboxLabelsResponse, ListInboxLabelsResponseSuccess, ListInboxThreadEmailsOptions, ListInboxThreadEmailsResponse, ListInboxThreadEmailsResponseSuccess, ListInboxThreadsOptions, ListInboxThreadsResponse, ListInboxThreadsResponseSuccess, ListInboxesOptions, ListInboxesResponse, ListInboxesResponseSuccess, ListOAuthGrantsOptions, ListOAuthGrantsResponse, ListOAuthGrantsResponseSuccess, ListWebhookEventAttemptsOptions, ListWebhookEventAttemptsResponse, ListWebhookEventAttemptsResponseSuccess, ListWebhookEventsOptions, ListWebhookEventsResponse, ListWebhookEventsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, MoveThreadFolder, OAuthGrant, RemoveInboxDraftOptions, RemoveInboxDraftResponse, RemoveInboxDraftResponseSuccess, RemoveInboxLabelOptions, RemoveInboxLabelResponse, RemoveInboxLabelResponseSuccess, RemoveInboxResponse, RemoveInboxResponseSuccess, RemoveInboxThreadOptions, RemoveInboxThreadResponse, RemoveInboxThreadResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, ReplayWebhookEventOptions, ReplayWebhookEventResponse, ReplayWebhookEventResponseSuccess, ReplyInboxThreadEmailOptions, ReplyInboxThreadEmailRequestOptions, ReplyInboxThreadEmailResponse, ReplyInboxThreadEmailResponseSuccess, ResendOptions, Response, RevokeOAuthGrantResponse, RevokeOAuthGrantResponseSuccess, RotateWebhookSigningSecretResponse, RotateWebhookSigningSecretResponseSuccess, SearchInboxThreadsOptions, SearchInboxThreadsResponse, SearchInboxThreadsResponseSuccess, SendInboxDraftOptions, SendInboxDraftRequestOptions, SendInboxDraftResponse, SendInboxDraftResponseSuccess, SuppressionAddedEvent, SuppressionRemovedEvent, TopicCreatedEvent, TopicDeletedEvent, TopicUpdatedEvent, UpdateInboxAgentOptions, UpdateInboxAgentResponse, UpdateInboxAgentResponseSuccess, UpdateInboxDraftOptions, UpdateInboxDraftResponse, UpdateInboxDraftResponseSuccess, UpdateInboxLabelOptions, UpdateInboxLabelResponse, UpdateInboxLabelResponseSuccess, UpdateInboxOptions, UpdateInboxResponse, UpdateInboxResponseSuccess, UpdateInboxThreadOptions, UpdateInboxThreadResponse, UpdateInboxThreadResponseSuccess, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, Webhook, WebhookEvent, WebhookEventAttempt, WebhookEventLog, WebhookEventLogStatus, WebhookEventPayload };
package/dist/index.mjs CHANGED
@@ -27,7 +27,7 @@ const MOVE_THREAD_FOLDERS = [
27
27
  ];
28
28
  //#endregion
29
29
  //#region package.json
30
- var version = "6.32.1-preview-inboxes.6";
30
+ var version = "6.33.0";
31
31
  //#endregion
32
32
  //#region src/common/utils/build-pagination-query.ts
33
33
  function buildPaginationUrl(base, options) {
@@ -885,7 +885,7 @@ var Receiving = class {
885
885
  }
886
886
  };
887
887
  return {
888
- content: await response.text(),
888
+ content: await response.arrayBuffer(),
889
889
  error: null
890
890
  };
891
891
  } catch {
@@ -1025,9 +1025,10 @@ var InboxDrafts = class {
1025
1025
  return this.resend.get(url, requestOptions);
1026
1026
  }
1027
1027
  async create(payload, options = {}) {
1028
- const { inboxId, threadId, replyToEmailId, ...content } = payload;
1028
+ const { inboxId, threadId, replyToEmailId, attachments, ...content } = payload;
1029
1029
  return this.resend.post(`/inboxes/${inboxId}/drafts`, {
1030
1030
  ...content,
1031
+ attachments: parseAttachments(attachments),
1031
1032
  thread_id: threadId,
1032
1033
  reply_to_email_id: replyToEmailId
1033
1034
  }, options);
@@ -1037,16 +1038,19 @@ var InboxDrafts = class {
1037
1038
  return this.resend.get(`/inboxes/${inboxId}/drafts/${draftId}`, requestOptions);
1038
1039
  }
1039
1040
  async update(options, requestOptions = {}) {
1040
- const { inboxId, draftId, ...content } = options;
1041
- return this.resend.patch(`/inboxes/${inboxId}/drafts/${draftId}`, content, requestOptions);
1041
+ const { inboxId, draftId, attachments, ...content } = options;
1042
+ return this.resend.patch(`/inboxes/${inboxId}/drafts/${draftId}`, {
1043
+ ...content,
1044
+ attachments: attachments === null ? null : parseAttachments(attachments)
1045
+ }, requestOptions);
1042
1046
  }
1043
1047
  async remove(options, requestOptions = {}) {
1044
1048
  const { inboxId, draftId } = options;
1045
1049
  return this.resend.delete(`/inboxes/${inboxId}/drafts/${draftId}`, void 0, requestOptions);
1046
1050
  }
1047
1051
  async send(payload, options = {}) {
1048
- const { inboxId, draftId } = payload;
1049
- return this.resend.post(`/inboxes/${inboxId}/drafts/${draftId}/send`, void 0, options);
1052
+ const { inboxId, draftId, headers } = payload;
1053
+ return this.resend.post(`/inboxes/${inboxId}/drafts/${draftId}/send`, headers ? { headers } : void 0, options);
1050
1054
  }
1051
1055
  };
1052
1056
  //#endregion
@@ -1093,25 +1097,29 @@ var InboxThreadEmails = class {
1093
1097
  return this.resend.get(`/inboxes/${inboxId}/threads/${threadId}/emails/${emailId}`, requestOptions);
1094
1098
  }
1095
1099
  async reply(payload, options = {}) {
1096
- const { inboxId, threadId, emailId, cc, bcc, html, text, subject, replyAll } = payload;
1100
+ const { inboxId, threadId, emailId, cc, bcc, html, text, subject, replyAll, attachments, headers } = payload;
1097
1101
  return this.resend.post(`/inboxes/${inboxId}/threads/${threadId}/emails/${emailId}/reply`, {
1098
1102
  cc,
1099
1103
  bcc,
1100
1104
  html,
1101
1105
  text,
1102
1106
  subject,
1103
- reply_all: replyAll
1107
+ reply_all: replyAll,
1108
+ attachments: parseAttachments(attachments),
1109
+ headers
1104
1110
  }, options);
1105
1111
  }
1106
1112
  async forward(payload, options = {}) {
1107
- const { inboxId, threadId, emailId, to, cc, bcc, html, text, subject } = payload;
1113
+ const { inboxId, threadId, emailId, to, cc, bcc, html, text, subject, attachments, headers } = payload;
1108
1114
  return this.resend.post(`/inboxes/${inboxId}/threads/${threadId}/emails/${emailId}/forward`, {
1109
1115
  to,
1110
1116
  cc,
1111
1117
  bcc,
1112
1118
  html,
1113
1119
  text,
1114
- subject
1120
+ subject,
1121
+ attachments: parseAttachments(attachments),
1122
+ headers
1115
1123
  }, options);
1116
1124
  }
1117
1125
  };
@@ -1159,11 +1167,12 @@ var InboxThreads = class {
1159
1167
  return this.resend.get(`/inboxes/${inboxId}/threads/${threadId}`, requestOptions);
1160
1168
  }
1161
1169
  async update(options, requestOptions = {}) {
1162
- const { inboxId, threadId, read, folder, labelId } = options;
1170
+ const { inboxId, threadId, read, folder, addLabelIds, removeLabelIds } = options;
1163
1171
  return this.resend.patch(`/inboxes/${inboxId}/threads/${threadId}`, {
1164
1172
  read,
1165
1173
  folder,
1166
- label_id: labelId
1174
+ add_label_ids: addLabelIds,
1175
+ remove_label_ids: removeLabelIds
1167
1176
  }, requestOptions);
1168
1177
  }
1169
1178
  async remove(options, requestOptions = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "6.32.1-preview-inboxes.6",
3
+ "version": "6.33.0",
4
4
  "description": "Node.js library for the Resend API",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",