resend 6.1.2 → 6.2.0-canary.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/dist/index.d.mts CHANGED
@@ -168,6 +168,42 @@ type RemoveApiKeyResponse = {
168
168
  error: ErrorResponse;
169
169
  };
170
170
 
171
+ interface InboundAttachment {
172
+ id: string;
173
+ filename?: string;
174
+ contentType: string;
175
+ contentDisposition: 'inline' | 'attachment';
176
+ contentId?: string;
177
+ content: string;
178
+ }
179
+
180
+ interface GetAttachmentOptions {
181
+ inboundId: string;
182
+ id: string;
183
+ }
184
+ interface GetAttachmentResponseSuccess {
185
+ object: 'attachment';
186
+ data: InboundAttachment;
187
+ }
188
+ type GetAttachmentResponse = {
189
+ data: GetAttachmentResponseSuccess;
190
+ error: null;
191
+ } | {
192
+ data: null;
193
+ error: ErrorResponse;
194
+ };
195
+
196
+ interface ListAttachmentsOptions {
197
+ inboundId: string;
198
+ }
199
+ type ListAttachmentsResponse = {
200
+ data: InboundAttachment[];
201
+ error: null;
202
+ } | {
203
+ data: null;
204
+ error: ErrorResponse;
205
+ };
206
+
171
207
  interface Audience {
172
208
  created_at: string;
173
209
  id: string;
@@ -848,6 +884,38 @@ type UpdateEmailResponse = {
848
884
  error: ErrorResponse;
849
885
  };
850
886
 
887
+ interface InboundEmail {
888
+ id: string;
889
+ to: string[];
890
+ from: string;
891
+ createdAt: string;
892
+ subject: string;
893
+ bcc: string[] | null;
894
+ cc: string[] | null;
895
+ replyTo: string[] | null;
896
+ html: string | null;
897
+ text: string | null;
898
+ attachments: InboundEmailAttachment[];
899
+ }
900
+ interface InboundEmailAttachment {
901
+ id: string;
902
+ filename: string;
903
+ contentType: string;
904
+ contentId: string;
905
+ contentDisposition: string;
906
+ }
907
+
908
+ interface GetInboundEmailResponseSuccess extends InboundEmail {
909
+ object: 'inbound';
910
+ }
911
+ type GetInboundEmailResponse = {
912
+ data: GetInboundEmailResponseSuccess;
913
+ error: null;
914
+ } | {
915
+ data: null;
916
+ error: ErrorResponse;
917
+ };
918
+
851
919
  declare class ApiKeys {
852
920
  private readonly resend;
853
921
  constructor(resend: Resend);
@@ -856,6 +924,13 @@ declare class ApiKeys {
856
924
  remove(id: string): Promise<RemoveApiKeyResponse>;
857
925
  }
858
926
 
927
+ declare class Attachments {
928
+ private readonly resend;
929
+ constructor(resend: Resend);
930
+ get(options: GetAttachmentOptions): Promise<GetAttachmentResponse>;
931
+ list(options: ListAttachmentsOptions): Promise<ListAttachmentsResponse>;
932
+ }
933
+
859
934
  declare class Audiences {
860
935
  private readonly resend;
861
936
  constructor(resend: Resend);
@@ -930,16 +1005,24 @@ declare class Emails {
930
1005
  cancel(id: string): Promise<CancelEmailResponse>;
931
1006
  }
932
1007
 
1008
+ declare class Inbound {
1009
+ private readonly resend;
1010
+ constructor(resend: Resend);
1011
+ get(id: string): Promise<GetInboundEmailResponse>;
1012
+ }
1013
+
933
1014
  declare class Resend {
934
1015
  readonly key?: string | undefined;
935
1016
  private readonly headers;
936
1017
  readonly apiKeys: ApiKeys;
1018
+ readonly attachments: Attachments;
937
1019
  readonly audiences: Audiences;
938
1020
  readonly batch: Batch;
939
1021
  readonly broadcasts: Broadcasts;
940
1022
  readonly contacts: Contacts;
941
1023
  readonly domains: Domains;
942
1024
  readonly emails: Emails;
1025
+ readonly inbound: Inbound;
943
1026
  constructor(key?: string | undefined);
944
1027
  fetchRequest<T>(path: string, options?: {}): Promise<{
945
1028
  data: T;
@@ -985,4 +1068,4 @@ declare class Resend {
985
1068
  }>;
986
1069
  }
987
1070
 
988
- export { type ApiKey, type Attachment, type Audience, type Broadcast, type CancelEmailResponse, type CancelEmailResponseSuccess, type Contact, type CreateApiKeyOptions, type CreateApiKeyRequestOptions, type CreateApiKeyResponse, type CreateApiKeyResponseSuccess, type CreateAudienceOptions, type CreateAudienceRequestOptions, type CreateAudienceResponse, type CreateAudienceResponseSuccess, type CreateBatchOptions, type CreateBatchRequestOptions, type CreateBatchResponse, type CreateBatchSuccessResponse, type CreateBroadcastOptions, type CreateBroadcastRequestOptions, type CreateBroadcastResponse, type CreateBroadcastResponseSuccess, type CreateContactOptions, type CreateContactRequestOptions, type CreateContactResponse, type CreateContactResponseSuccess, type CreateDomainOptions, type CreateDomainRequestOptions, type CreateDomainResponse, type CreateDomainResponseSuccess, type CreateEmailOptions, type CreateEmailRequestOptions, type CreateEmailResponse, type CreateEmailResponseSuccess, type Domain, type DomainApiOptions, type DomainDkimRecord, type DomainNameservers, type DomainRecords, type DomainRegion, type DomainSpfRecord, type DomainStatus, type EmailApiAttachment, type EmailApiOptions, type ErrorResponse, type GetAudienceResponse, type GetAudienceResponseSuccess, type GetBroadcastResponse, type GetBroadcastResponseSuccess, type GetContactOptions, type GetContactResponse, type GetContactResponseSuccess, type GetDomainResponse, type GetDomainResponseSuccess, type GetEmailResponse, type GetEmailResponseSuccess, type GetOptions, type IdempotentRequest, type List, type ListApiKeysOptions, type ListApiKeysResponse, type ListApiKeysResponseSuccess, type ListAudiencesOptions, type ListAudiencesResponse, type ListAudiencesResponseSuccess, type ListBroadcastsOptions, type ListBroadcastsResponse, type ListBroadcastsResponseSuccess, type ListContactsOptions, type ListContactsResponse, type ListContactsResponseSuccess, type ListDomainsOptions, type ListDomainsResponse, type ListDomainsResponseSuccess, type PaginationOptions, type PatchOptions, type PostOptions, type PutOptions, type RemoveApiKeyResponse, type RemoveApiKeyResponseSuccess, type RemoveAudiencesResponse, type RemoveAudiencesResponseSuccess, type RemoveBroadcastResponse, type RemoveBroadcastResponseSuccess, type RemoveContactOptions, type RemoveContactsResponse, type RemoveContactsResponseSuccess, type RemoveDomainsResponse, type RemoveDomainsResponseSuccess, type RequireAtLeastOne, Resend, type SelectingField, type SendBroadcastOptions, type SendBroadcastRequestOptions, type SendBroadcastResponse, type SendBroadcastResponseSuccess, type Tag, type UpdateBroadcastOptions, type UpdateBroadcastResponse, type UpdateBroadcastResponseSuccess, type UpdateContactOptions, type UpdateContactResponse, type UpdateContactResponseSuccess, type UpdateDomainsOptions, type UpdateDomainsResponse, type UpdateDomainsResponseSuccess, type UpdateEmailOptions, type UpdateEmailResponse, type UpdateEmailResponseSuccess, type VerifyDomainsResponse, type VerifyDomainsResponseSuccess };
1071
+ export { type ApiKey, type Attachment, type Audience, type Broadcast, type CancelEmailResponse, type CancelEmailResponseSuccess, type Contact, type CreateApiKeyOptions, type CreateApiKeyRequestOptions, type CreateApiKeyResponse, type CreateApiKeyResponseSuccess, type CreateAudienceOptions, type CreateAudienceRequestOptions, type CreateAudienceResponse, type CreateAudienceResponseSuccess, type CreateBatchOptions, type CreateBatchRequestOptions, type CreateBatchResponse, type CreateBatchSuccessResponse, type CreateBroadcastOptions, type CreateBroadcastRequestOptions, type CreateBroadcastResponse, type CreateBroadcastResponseSuccess, type CreateContactOptions, type CreateContactRequestOptions, type CreateContactResponse, type CreateContactResponseSuccess, type CreateDomainOptions, type CreateDomainRequestOptions, type CreateDomainResponse, type CreateDomainResponseSuccess, type CreateEmailOptions, type CreateEmailRequestOptions, type CreateEmailResponse, type CreateEmailResponseSuccess, type Domain, type DomainApiOptions, type DomainDkimRecord, type DomainNameservers, type DomainRecords, type DomainRegion, type DomainSpfRecord, type DomainStatus, type EmailApiAttachment, type EmailApiOptions, type ErrorResponse, type GetAttachmentOptions, type GetAttachmentResponse, type GetAttachmentResponseSuccess, type GetAudienceResponse, type GetAudienceResponseSuccess, type GetBroadcastResponse, type GetBroadcastResponseSuccess, type GetContactOptions, type GetContactResponse, type GetContactResponseSuccess, type GetDomainResponse, type GetDomainResponseSuccess, type GetEmailResponse, type GetEmailResponseSuccess, type GetInboundEmailResponse, type GetInboundEmailResponseSuccess, type GetOptions, type IdempotentRequest, type InboundAttachment, type InboundEmail, type InboundEmailAttachment, type List, type ListApiKeysOptions, type ListApiKeysResponse, type ListApiKeysResponseSuccess, type ListAttachmentsOptions, type ListAttachmentsResponse, type ListAudiencesOptions, type ListAudiencesResponse, type ListAudiencesResponseSuccess, type ListBroadcastsOptions, type ListBroadcastsResponse, type ListBroadcastsResponseSuccess, type ListContactsOptions, type ListContactsResponse, type ListContactsResponseSuccess, type ListDomainsOptions, type ListDomainsResponse, type ListDomainsResponseSuccess, type PaginationOptions, type PatchOptions, type PostOptions, type PutOptions, type RemoveApiKeyResponse, type RemoveApiKeyResponseSuccess, type RemoveAudiencesResponse, type RemoveAudiencesResponseSuccess, type RemoveBroadcastResponse, type RemoveBroadcastResponseSuccess, type RemoveContactOptions, type RemoveContactsResponse, type RemoveContactsResponseSuccess, type RemoveDomainsResponse, type RemoveDomainsResponseSuccess, type RequireAtLeastOne, Resend, type SelectingField, type SendBroadcastOptions, type SendBroadcastRequestOptions, type SendBroadcastResponse, type SendBroadcastResponseSuccess, type Tag, type UpdateBroadcastOptions, type UpdateBroadcastResponse, type UpdateBroadcastResponseSuccess, type UpdateContactOptions, type UpdateContactResponse, type UpdateContactResponseSuccess, type UpdateDomainsOptions, type UpdateDomainsResponse, type UpdateDomainsResponseSuccess, type UpdateEmailOptions, type UpdateEmailResponse, type UpdateEmailResponseSuccess, type VerifyDomainsResponse, type VerifyDomainsResponseSuccess };
package/dist/index.d.ts CHANGED
@@ -168,6 +168,42 @@ type RemoveApiKeyResponse = {
168
168
  error: ErrorResponse;
169
169
  };
170
170
 
171
+ interface InboundAttachment {
172
+ id: string;
173
+ filename?: string;
174
+ contentType: string;
175
+ contentDisposition: 'inline' | 'attachment';
176
+ contentId?: string;
177
+ content: string;
178
+ }
179
+
180
+ interface GetAttachmentOptions {
181
+ inboundId: string;
182
+ id: string;
183
+ }
184
+ interface GetAttachmentResponseSuccess {
185
+ object: 'attachment';
186
+ data: InboundAttachment;
187
+ }
188
+ type GetAttachmentResponse = {
189
+ data: GetAttachmentResponseSuccess;
190
+ error: null;
191
+ } | {
192
+ data: null;
193
+ error: ErrorResponse;
194
+ };
195
+
196
+ interface ListAttachmentsOptions {
197
+ inboundId: string;
198
+ }
199
+ type ListAttachmentsResponse = {
200
+ data: InboundAttachment[];
201
+ error: null;
202
+ } | {
203
+ data: null;
204
+ error: ErrorResponse;
205
+ };
206
+
171
207
  interface Audience {
172
208
  created_at: string;
173
209
  id: string;
@@ -848,6 +884,38 @@ type UpdateEmailResponse = {
848
884
  error: ErrorResponse;
849
885
  };
850
886
 
887
+ interface InboundEmail {
888
+ id: string;
889
+ to: string[];
890
+ from: string;
891
+ createdAt: string;
892
+ subject: string;
893
+ bcc: string[] | null;
894
+ cc: string[] | null;
895
+ replyTo: string[] | null;
896
+ html: string | null;
897
+ text: string | null;
898
+ attachments: InboundEmailAttachment[];
899
+ }
900
+ interface InboundEmailAttachment {
901
+ id: string;
902
+ filename: string;
903
+ contentType: string;
904
+ contentId: string;
905
+ contentDisposition: string;
906
+ }
907
+
908
+ interface GetInboundEmailResponseSuccess extends InboundEmail {
909
+ object: 'inbound';
910
+ }
911
+ type GetInboundEmailResponse = {
912
+ data: GetInboundEmailResponseSuccess;
913
+ error: null;
914
+ } | {
915
+ data: null;
916
+ error: ErrorResponse;
917
+ };
918
+
851
919
  declare class ApiKeys {
852
920
  private readonly resend;
853
921
  constructor(resend: Resend);
@@ -856,6 +924,13 @@ declare class ApiKeys {
856
924
  remove(id: string): Promise<RemoveApiKeyResponse>;
857
925
  }
858
926
 
927
+ declare class Attachments {
928
+ private readonly resend;
929
+ constructor(resend: Resend);
930
+ get(options: GetAttachmentOptions): Promise<GetAttachmentResponse>;
931
+ list(options: ListAttachmentsOptions): Promise<ListAttachmentsResponse>;
932
+ }
933
+
859
934
  declare class Audiences {
860
935
  private readonly resend;
861
936
  constructor(resend: Resend);
@@ -930,16 +1005,24 @@ declare class Emails {
930
1005
  cancel(id: string): Promise<CancelEmailResponse>;
931
1006
  }
932
1007
 
1008
+ declare class Inbound {
1009
+ private readonly resend;
1010
+ constructor(resend: Resend);
1011
+ get(id: string): Promise<GetInboundEmailResponse>;
1012
+ }
1013
+
933
1014
  declare class Resend {
934
1015
  readonly key?: string | undefined;
935
1016
  private readonly headers;
936
1017
  readonly apiKeys: ApiKeys;
1018
+ readonly attachments: Attachments;
937
1019
  readonly audiences: Audiences;
938
1020
  readonly batch: Batch;
939
1021
  readonly broadcasts: Broadcasts;
940
1022
  readonly contacts: Contacts;
941
1023
  readonly domains: Domains;
942
1024
  readonly emails: Emails;
1025
+ readonly inbound: Inbound;
943
1026
  constructor(key?: string | undefined);
944
1027
  fetchRequest<T>(path: string, options?: {}): Promise<{
945
1028
  data: T;
@@ -985,4 +1068,4 @@ declare class Resend {
985
1068
  }>;
986
1069
  }
987
1070
 
988
- export { type ApiKey, type Attachment, type Audience, type Broadcast, type CancelEmailResponse, type CancelEmailResponseSuccess, type Contact, type CreateApiKeyOptions, type CreateApiKeyRequestOptions, type CreateApiKeyResponse, type CreateApiKeyResponseSuccess, type CreateAudienceOptions, type CreateAudienceRequestOptions, type CreateAudienceResponse, type CreateAudienceResponseSuccess, type CreateBatchOptions, type CreateBatchRequestOptions, type CreateBatchResponse, type CreateBatchSuccessResponse, type CreateBroadcastOptions, type CreateBroadcastRequestOptions, type CreateBroadcastResponse, type CreateBroadcastResponseSuccess, type CreateContactOptions, type CreateContactRequestOptions, type CreateContactResponse, type CreateContactResponseSuccess, type CreateDomainOptions, type CreateDomainRequestOptions, type CreateDomainResponse, type CreateDomainResponseSuccess, type CreateEmailOptions, type CreateEmailRequestOptions, type CreateEmailResponse, type CreateEmailResponseSuccess, type Domain, type DomainApiOptions, type DomainDkimRecord, type DomainNameservers, type DomainRecords, type DomainRegion, type DomainSpfRecord, type DomainStatus, type EmailApiAttachment, type EmailApiOptions, type ErrorResponse, type GetAudienceResponse, type GetAudienceResponseSuccess, type GetBroadcastResponse, type GetBroadcastResponseSuccess, type GetContactOptions, type GetContactResponse, type GetContactResponseSuccess, type GetDomainResponse, type GetDomainResponseSuccess, type GetEmailResponse, type GetEmailResponseSuccess, type GetOptions, type IdempotentRequest, type List, type ListApiKeysOptions, type ListApiKeysResponse, type ListApiKeysResponseSuccess, type ListAudiencesOptions, type ListAudiencesResponse, type ListAudiencesResponseSuccess, type ListBroadcastsOptions, type ListBroadcastsResponse, type ListBroadcastsResponseSuccess, type ListContactsOptions, type ListContactsResponse, type ListContactsResponseSuccess, type ListDomainsOptions, type ListDomainsResponse, type ListDomainsResponseSuccess, type PaginationOptions, type PatchOptions, type PostOptions, type PutOptions, type RemoveApiKeyResponse, type RemoveApiKeyResponseSuccess, type RemoveAudiencesResponse, type RemoveAudiencesResponseSuccess, type RemoveBroadcastResponse, type RemoveBroadcastResponseSuccess, type RemoveContactOptions, type RemoveContactsResponse, type RemoveContactsResponseSuccess, type RemoveDomainsResponse, type RemoveDomainsResponseSuccess, type RequireAtLeastOne, Resend, type SelectingField, type SendBroadcastOptions, type SendBroadcastRequestOptions, type SendBroadcastResponse, type SendBroadcastResponseSuccess, type Tag, type UpdateBroadcastOptions, type UpdateBroadcastResponse, type UpdateBroadcastResponseSuccess, type UpdateContactOptions, type UpdateContactResponse, type UpdateContactResponseSuccess, type UpdateDomainsOptions, type UpdateDomainsResponse, type UpdateDomainsResponseSuccess, type UpdateEmailOptions, type UpdateEmailResponse, type UpdateEmailResponseSuccess, type VerifyDomainsResponse, type VerifyDomainsResponseSuccess };
1071
+ export { type ApiKey, type Attachment, type Audience, type Broadcast, type CancelEmailResponse, type CancelEmailResponseSuccess, type Contact, type CreateApiKeyOptions, type CreateApiKeyRequestOptions, type CreateApiKeyResponse, type CreateApiKeyResponseSuccess, type CreateAudienceOptions, type CreateAudienceRequestOptions, type CreateAudienceResponse, type CreateAudienceResponseSuccess, type CreateBatchOptions, type CreateBatchRequestOptions, type CreateBatchResponse, type CreateBatchSuccessResponse, type CreateBroadcastOptions, type CreateBroadcastRequestOptions, type CreateBroadcastResponse, type CreateBroadcastResponseSuccess, type CreateContactOptions, type CreateContactRequestOptions, type CreateContactResponse, type CreateContactResponseSuccess, type CreateDomainOptions, type CreateDomainRequestOptions, type CreateDomainResponse, type CreateDomainResponseSuccess, type CreateEmailOptions, type CreateEmailRequestOptions, type CreateEmailResponse, type CreateEmailResponseSuccess, type Domain, type DomainApiOptions, type DomainDkimRecord, type DomainNameservers, type DomainRecords, type DomainRegion, type DomainSpfRecord, type DomainStatus, type EmailApiAttachment, type EmailApiOptions, type ErrorResponse, type GetAttachmentOptions, type GetAttachmentResponse, type GetAttachmentResponseSuccess, type GetAudienceResponse, type GetAudienceResponseSuccess, type GetBroadcastResponse, type GetBroadcastResponseSuccess, type GetContactOptions, type GetContactResponse, type GetContactResponseSuccess, type GetDomainResponse, type GetDomainResponseSuccess, type GetEmailResponse, type GetEmailResponseSuccess, type GetInboundEmailResponse, type GetInboundEmailResponseSuccess, type GetOptions, type IdempotentRequest, type InboundAttachment, type InboundEmail, type InboundEmailAttachment, type List, type ListApiKeysOptions, type ListApiKeysResponse, type ListApiKeysResponseSuccess, type ListAttachmentsOptions, type ListAttachmentsResponse, type ListAudiencesOptions, type ListAudiencesResponse, type ListAudiencesResponseSuccess, type ListBroadcastsOptions, type ListBroadcastsResponse, type ListBroadcastsResponseSuccess, type ListContactsOptions, type ListContactsResponse, type ListContactsResponseSuccess, type ListDomainsOptions, type ListDomainsResponse, type ListDomainsResponseSuccess, type PaginationOptions, type PatchOptions, type PostOptions, type PutOptions, type RemoveApiKeyResponse, type RemoveApiKeyResponseSuccess, type RemoveAudiencesResponse, type RemoveAudiencesResponseSuccess, type RemoveBroadcastResponse, type RemoveBroadcastResponseSuccess, type RemoveContactOptions, type RemoveContactsResponse, type RemoveContactsResponseSuccess, type RemoveDomainsResponse, type RemoveDomainsResponseSuccess, type RequireAtLeastOne, Resend, type SelectingField, type SendBroadcastOptions, type SendBroadcastRequestOptions, type SendBroadcastResponse, type SendBroadcastResponseSuccess, type Tag, type UpdateBroadcastOptions, type UpdateBroadcastResponse, type UpdateBroadcastResponseSuccess, type UpdateContactOptions, type UpdateContactResponse, type UpdateContactResponseSuccess, type UpdateDomainsOptions, type UpdateDomainsResponse, type UpdateDomainsResponseSuccess, type UpdateEmailOptions, type UpdateEmailResponse, type UpdateEmailResponseSuccess, type VerifyDomainsResponse, type VerifyDomainsResponseSuccess };
package/dist/index.js CHANGED
@@ -84,7 +84,7 @@ __export(index_exports, {
84
84
  module.exports = __toCommonJS(index_exports);
85
85
 
86
86
  // package.json
87
- var version = "6.1.2";
87
+ var version = "6.2.0-canary.1";
88
88
 
89
89
  // src/common/utils/build-pagination-query.ts
90
90
  function buildPaginationQuery(options) {
@@ -134,6 +134,70 @@ var ApiKeys = class {
134
134
  }
135
135
  };
136
136
 
137
+ // src/attachments/attachments.ts
138
+ var Attachments = class {
139
+ constructor(resend) {
140
+ this.resend = resend;
141
+ }
142
+ get(options) {
143
+ return __async(this, null, function* () {
144
+ const { inboundId, id } = options;
145
+ const data = yield this.resend.get(
146
+ `/emails/inbound/${inboundId}/attachments/${id}`
147
+ );
148
+ if (data.error) {
149
+ return {
150
+ data: null,
151
+ error: data.error
152
+ };
153
+ }
154
+ const apiResponse = data.data;
155
+ const transformedData = {
156
+ object: apiResponse.object,
157
+ data: {
158
+ id: apiResponse.data.id,
159
+ filename: apiResponse.data.filename,
160
+ contentType: apiResponse.data.content_type,
161
+ contentDisposition: apiResponse.data.content_disposition,
162
+ contentId: apiResponse.data.content_id,
163
+ content: apiResponse.data.content
164
+ }
165
+ };
166
+ return {
167
+ data: transformedData,
168
+ error: null
169
+ };
170
+ });
171
+ }
172
+ list(options) {
173
+ return __async(this, null, function* () {
174
+ const { inboundId } = options;
175
+ const data = yield this.resend.get(
176
+ `/emails/inbound/${inboundId}/attachments`
177
+ );
178
+ if (data.error) {
179
+ return {
180
+ data: null,
181
+ error: data.error
182
+ };
183
+ }
184
+ const apiResponse = data.data;
185
+ const transformedData = apiResponse.data.map((attachment) => ({
186
+ id: attachment.id,
187
+ filename: attachment.filename,
188
+ contentType: attachment.content_type,
189
+ contentDisposition: attachment.content_disposition,
190
+ contentId: attachment.content_id,
191
+ content: attachment.content
192
+ }));
193
+ return {
194
+ data: transformedData,
195
+ error: null
196
+ };
197
+ });
198
+ }
199
+ };
200
+
137
201
  // src/audiences/audiences.ts
138
202
  var Audiences = class {
139
203
  constructor(resend) {
@@ -553,6 +617,51 @@ var Emails = class {
553
617
  }
554
618
  };
555
619
 
620
+ // src/inbound/inbound.ts
621
+ var Inbound = class {
622
+ constructor(resend) {
623
+ this.resend = resend;
624
+ }
625
+ get(id) {
626
+ return __async(this, null, function* () {
627
+ const data = yield this.resend.get(
628
+ `/emails/inbound/${id}`
629
+ );
630
+ if (data.error) {
631
+ return {
632
+ data: null,
633
+ error: data.error
634
+ };
635
+ }
636
+ const apiResponse = data.data;
637
+ const transformedData = {
638
+ object: apiResponse.object,
639
+ id: apiResponse.id,
640
+ to: apiResponse.to,
641
+ from: apiResponse.from,
642
+ createdAt: apiResponse.created_at,
643
+ subject: apiResponse.subject,
644
+ bcc: apiResponse.bcc,
645
+ cc: apiResponse.cc,
646
+ replyTo: apiResponse.reply_to,
647
+ html: apiResponse.html,
648
+ text: apiResponse.text,
649
+ attachments: apiResponse.attachments.map((attachment) => ({
650
+ id: attachment.id,
651
+ filename: attachment.filename,
652
+ contentType: attachment.content_type,
653
+ contentId: attachment.content_id,
654
+ contentDisposition: attachment.content_disposition
655
+ }))
656
+ };
657
+ return {
658
+ data: transformedData,
659
+ error: null
660
+ };
661
+ });
662
+ }
663
+ };
664
+
556
665
  // src/resend.ts
557
666
  var defaultBaseUrl = "https://api.resend.com";
558
667
  var defaultUserAgent = `resend-node:${version}`;
@@ -562,12 +671,14 @@ var Resend = class {
562
671
  constructor(key) {
563
672
  this.key = key;
564
673
  this.apiKeys = new ApiKeys(this);
674
+ this.attachments = new Attachments(this);
565
675
  this.audiences = new Audiences(this);
566
676
  this.batch = new Batch(this);
567
677
  this.broadcasts = new Broadcasts(this);
568
678
  this.contacts = new Contacts(this);
569
679
  this.domains = new Domains(this);
570
680
  this.emails = new Emails(this);
681
+ this.inbound = new Inbound(this);
571
682
  if (!key) {
572
683
  if (typeof process !== "undefined" && process.env) {
573
684
  this.key = process.env.RESEND_API_KEY;
package/dist/index.mjs CHANGED
@@ -51,7 +51,7 @@ var __async = (__this, __arguments, generator) => {
51
51
  };
52
52
 
53
53
  // package.json
54
- var version = "6.1.2";
54
+ var version = "6.2.0-canary.1";
55
55
 
56
56
  // src/common/utils/build-pagination-query.ts
57
57
  function buildPaginationQuery(options) {
@@ -101,6 +101,70 @@ var ApiKeys = class {
101
101
  }
102
102
  };
103
103
 
104
+ // src/attachments/attachments.ts
105
+ var Attachments = class {
106
+ constructor(resend) {
107
+ this.resend = resend;
108
+ }
109
+ get(options) {
110
+ return __async(this, null, function* () {
111
+ const { inboundId, id } = options;
112
+ const data = yield this.resend.get(
113
+ `/emails/inbound/${inboundId}/attachments/${id}`
114
+ );
115
+ if (data.error) {
116
+ return {
117
+ data: null,
118
+ error: data.error
119
+ };
120
+ }
121
+ const apiResponse = data.data;
122
+ const transformedData = {
123
+ object: apiResponse.object,
124
+ data: {
125
+ id: apiResponse.data.id,
126
+ filename: apiResponse.data.filename,
127
+ contentType: apiResponse.data.content_type,
128
+ contentDisposition: apiResponse.data.content_disposition,
129
+ contentId: apiResponse.data.content_id,
130
+ content: apiResponse.data.content
131
+ }
132
+ };
133
+ return {
134
+ data: transformedData,
135
+ error: null
136
+ };
137
+ });
138
+ }
139
+ list(options) {
140
+ return __async(this, null, function* () {
141
+ const { inboundId } = options;
142
+ const data = yield this.resend.get(
143
+ `/emails/inbound/${inboundId}/attachments`
144
+ );
145
+ if (data.error) {
146
+ return {
147
+ data: null,
148
+ error: data.error
149
+ };
150
+ }
151
+ const apiResponse = data.data;
152
+ const transformedData = apiResponse.data.map((attachment) => ({
153
+ id: attachment.id,
154
+ filename: attachment.filename,
155
+ contentType: attachment.content_type,
156
+ contentDisposition: attachment.content_disposition,
157
+ contentId: attachment.content_id,
158
+ content: attachment.content
159
+ }));
160
+ return {
161
+ data: transformedData,
162
+ error: null
163
+ };
164
+ });
165
+ }
166
+ };
167
+
104
168
  // src/audiences/audiences.ts
105
169
  var Audiences = class {
106
170
  constructor(resend) {
@@ -520,6 +584,51 @@ var Emails = class {
520
584
  }
521
585
  };
522
586
 
587
+ // src/inbound/inbound.ts
588
+ var Inbound = class {
589
+ constructor(resend) {
590
+ this.resend = resend;
591
+ }
592
+ get(id) {
593
+ return __async(this, null, function* () {
594
+ const data = yield this.resend.get(
595
+ `/emails/inbound/${id}`
596
+ );
597
+ if (data.error) {
598
+ return {
599
+ data: null,
600
+ error: data.error
601
+ };
602
+ }
603
+ const apiResponse = data.data;
604
+ const transformedData = {
605
+ object: apiResponse.object,
606
+ id: apiResponse.id,
607
+ to: apiResponse.to,
608
+ from: apiResponse.from,
609
+ createdAt: apiResponse.created_at,
610
+ subject: apiResponse.subject,
611
+ bcc: apiResponse.bcc,
612
+ cc: apiResponse.cc,
613
+ replyTo: apiResponse.reply_to,
614
+ html: apiResponse.html,
615
+ text: apiResponse.text,
616
+ attachments: apiResponse.attachments.map((attachment) => ({
617
+ id: attachment.id,
618
+ filename: attachment.filename,
619
+ contentType: attachment.content_type,
620
+ contentId: attachment.content_id,
621
+ contentDisposition: attachment.content_disposition
622
+ }))
623
+ };
624
+ return {
625
+ data: transformedData,
626
+ error: null
627
+ };
628
+ });
629
+ }
630
+ };
631
+
523
632
  // src/resend.ts
524
633
  var defaultBaseUrl = "https://api.resend.com";
525
634
  var defaultUserAgent = `resend-node:${version}`;
@@ -529,12 +638,14 @@ var Resend = class {
529
638
  constructor(key) {
530
639
  this.key = key;
531
640
  this.apiKeys = new ApiKeys(this);
641
+ this.attachments = new Attachments(this);
532
642
  this.audiences = new Audiences(this);
533
643
  this.batch = new Batch(this);
534
644
  this.broadcasts = new Broadcasts(this);
535
645
  this.contacts = new Contacts(this);
536
646
  this.domains = new Domains(this);
537
647
  this.emails = new Emails(this);
648
+ this.inbound = new Inbound(this);
538
649
  if (!key) {
539
650
  if (typeof process !== "undefined" && process.env) {
540
651
  this.key = process.env.RESEND_API_KEY;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "6.1.2",
3
+ "version": "6.2.0-canary.1",
4
4
  "description": "Node.js library for the Resend API",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -42,7 +42,7 @@
42
42
  }
43
43
  },
44
44
  "devDependencies": {
45
- "@biomejs/biome": "2.2.0",
45
+ "@biomejs/biome": "2.2.4",
46
46
  "@types/node": "22.18.6",
47
47
  "@types/react": "19.1.15",
48
48
  "pkg-pr-new": "0.0.60",