resend 6.3.0-canary.0 → 6.3.0-canary.2

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
@@ -24,6 +24,7 @@ declare const RESEND_ERROR_CODES_BY_KEY: {
24
24
  readonly rate_limit_exceeded: 429;
25
25
  readonly missing_api_key: 401;
26
26
  readonly invalid_api_key: 403;
27
+ readonly suspended_api_key: 403;
27
28
  readonly invalid_from_address: 403;
28
29
  readonly validation_error: 403;
29
30
  readonly not_found: 404;
@@ -32,10 +33,11 @@ declare const RESEND_ERROR_CODES_BY_KEY: {
32
33
  readonly internal_server_error: 500;
33
34
  };
34
35
  type RESEND_ERROR_CODE_KEY = keyof typeof RESEND_ERROR_CODES_BY_KEY;
35
- interface ErrorResponse {
36
+ type ErrorResponse = {
36
37
  message: string;
38
+ statusCode: number | null;
37
39
  name: RESEND_ERROR_CODE_KEY;
38
- }
40
+ };
39
41
  type Tag$1 = {
40
42
  name: string;
41
43
  value: string;
@@ -177,10 +179,12 @@ type RemoveApiKeyResponse = {
177
179
  interface InboundAttachment {
178
180
  id: string;
179
181
  filename?: string;
182
+ size: number;
180
183
  content_type: string;
181
184
  content_disposition: 'inline' | 'attachment';
182
185
  content_id?: string;
183
- content: string;
186
+ download_url: string;
187
+ expires_at: string;
184
188
  }
185
189
 
186
190
  interface GetAttachmentOptions {
@@ -215,65 +219,6 @@ type ListAttachmentsResponse = {
215
219
  error: ErrorResponse;
216
220
  };
217
221
 
218
- interface Audience {
219
- created_at: string;
220
- id: string;
221
- name: string;
222
- }
223
-
224
- interface CreateAudienceOptions {
225
- name: string;
226
- }
227
- interface CreateAudienceRequestOptions extends PostOptions {
228
- }
229
- interface CreateAudienceResponseSuccess extends Pick<Audience, 'name' | 'id'> {
230
- object: 'audience';
231
- }
232
- type CreateAudienceResponse = {
233
- data: CreateAudienceResponseSuccess;
234
- error: null;
235
- } | {
236
- data: null;
237
- error: ErrorResponse;
238
- };
239
-
240
- interface GetAudienceResponseSuccess extends Pick<Audience, 'id' | 'name' | 'created_at'> {
241
- object: 'audience';
242
- }
243
- type GetAudienceResponse = {
244
- data: GetAudienceResponseSuccess;
245
- error: null;
246
- } | {
247
- data: null;
248
- error: ErrorResponse;
249
- };
250
-
251
- type ListAudiencesOptions = PaginationOptions;
252
- type ListAudiencesResponseSuccess = {
253
- object: 'list';
254
- data: Audience[];
255
- has_more: boolean;
256
- };
257
- type ListAudiencesResponse = {
258
- data: ListAudiencesResponseSuccess;
259
- error: null;
260
- } | {
261
- data: null;
262
- error: ErrorResponse;
263
- };
264
-
265
- interface RemoveAudiencesResponseSuccess extends Pick<Audience, 'id'> {
266
- object: 'audience';
267
- deleted: boolean;
268
- }
269
- type RemoveAudiencesResponse = {
270
- data: RemoveAudiencesResponseSuccess;
271
- error: null;
272
- } | {
273
- data: null;
274
- error: ErrorResponse;
275
- };
276
-
277
222
  interface EmailRenderOptions$1 {
278
223
  /**
279
224
  * The React component used to write the message.
@@ -457,6 +402,7 @@ type CreateBatchResponse<Options extends CreateBatchRequestOptions> = {
457
402
  interface Broadcast {
458
403
  id: string;
459
404
  name: string;
405
+ segment_id: string | null;
460
406
  audience_id: string | null;
461
407
  from: string | null;
462
408
  subject: string | null;
@@ -491,19 +437,25 @@ interface EmailRenderOptions {
491
437
  */
492
438
  text: string;
493
439
  }
494
- interface CreateBroadcastBaseOptions {
440
+ interface SegmentOptions {
495
441
  /**
496
- * The name of the broadcast
442
+ * The id of the segment you want to send to
497
443
  *
498
444
  * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
499
445
  */
500
- name?: string;
446
+ segmentId: string;
447
+ /**
448
+ * @deprecated Use segmentId instead
449
+ */
450
+ audienceId: string;
451
+ }
452
+ interface CreateBroadcastBaseOptions {
501
453
  /**
502
- * The id of the audience you want to send to
454
+ * The name of the broadcast
503
455
  *
504
456
  * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
505
457
  */
506
- audienceId: string;
458
+ name?: string;
507
459
  /**
508
460
  * A short snippet of text displayed as a preview in recipients' inboxes, often shown below or beside the subject line.
509
461
  *
@@ -535,7 +487,7 @@ interface CreateBroadcastBaseOptions {
535
487
  */
536
488
  topicId?: string | null;
537
489
  }
538
- type CreateBroadcastOptions = RequireAtLeastOne<EmailRenderOptions> & CreateBroadcastBaseOptions;
490
+ type CreateBroadcastOptions = RequireAtLeastOne<EmailRenderOptions> & RequireAtLeastOne<SegmentOptions> & CreateBroadcastBaseOptions;
539
491
  interface CreateBroadcastRequestOptions extends PostOptions {
540
492
  }
541
493
  interface CreateBroadcastResponseSuccess {
@@ -565,7 +517,7 @@ type ListBroadcastsOptions = PaginationOptions;
565
517
  type ListBroadcastsResponseSuccess = {
566
518
  object: 'list';
567
519
  has_more: boolean;
568
- data: Pick<Broadcast, 'id' | 'name' | 'audience_id' | 'status' | 'created_at' | 'scheduled_at' | 'sent_at'>[];
520
+ data: Pick<Broadcast, 'id' | 'name' | 'audience_id' | 'segment_id' | 'status' | 'created_at' | 'scheduled_at' | 'sent_at'>[];
569
521
  };
570
522
  type ListBroadcastsResponse = {
571
523
  data: ListBroadcastsResponseSuccess;
@@ -617,6 +569,10 @@ interface UpdateBroadcastResponseSuccess {
617
569
  }
618
570
  type UpdateBroadcastOptions = {
619
571
  name?: string;
572
+ segmentId?: string;
573
+ /**
574
+ * @deprecated Use segmentId instead
575
+ */
620
576
  audienceId?: string;
621
577
  from?: string;
622
578
  html?: string;
@@ -955,9 +911,11 @@ interface GetInboundEmailResponseSuccess {
955
911
  html: string | null;
956
912
  text: string | null;
957
913
  headers: Record<string, string>;
914
+ message_id: string;
958
915
  attachments: Array<{
959
916
  id: string;
960
917
  filename: string;
918
+ size: number;
961
919
  content_type: string;
962
920
  content_id: string;
963
921
  content_disposition: string;
@@ -997,7 +955,6 @@ declare class ApiKeys {
997
955
  declare class Receiving$1 {
998
956
  private readonly resend;
999
957
  constructor(resend: Resend);
1000
- private downloadAttachment;
1001
958
  get(options: GetAttachmentOptions): Promise<GetAttachmentResponse>;
1002
959
  list(options: ListAttachmentsOptions): Promise<ListAttachmentsResponse>;
1003
960
  }
@@ -1007,15 +964,6 @@ declare class Attachments {
1007
964
  constructor(resend: Resend);
1008
965
  }
1009
966
 
1010
- declare class Audiences {
1011
- private readonly resend;
1012
- constructor(resend: Resend);
1013
- create(payload: CreateAudienceOptions, options?: CreateAudienceRequestOptions): Promise<CreateAudienceResponse>;
1014
- list(options?: ListAudiencesOptions): Promise<ListAudiencesResponse>;
1015
- get(id: string): Promise<GetAudienceResponse>;
1016
- remove(id: string): Promise<RemoveAudiencesResponse>;
1017
- }
1018
-
1019
967
  declare class Batch {
1020
968
  private readonly resend;
1021
969
  constructor(resend: Resend);
@@ -1034,7 +982,88 @@ declare class Broadcasts {
1034
982
  update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>;
1035
983
  }
1036
984
 
1037
- type ContactAudiencesBaseOptions = {
985
+ type StringBaseContactProperty = {
986
+ type: 'string';
987
+ fallbackValue: string | null;
988
+ };
989
+ type NumberBaseContactProperty = {
990
+ type: 'number';
991
+ fallbackValue: number | null;
992
+ };
993
+ type ContactProperty = {
994
+ id: string;
995
+ object: 'contact_property';
996
+ createdAt: string;
997
+ key: string;
998
+ } & (StringBaseContactProperty | NumberBaseContactProperty);
999
+
1000
+ type StringBaseContactPropertyOptions = {
1001
+ type: 'string';
1002
+ fallbackValue?: string | null;
1003
+ };
1004
+ type NumberBaseContactPropertyOptions = {
1005
+ type: 'number';
1006
+ fallbackValue?: number | null;
1007
+ };
1008
+ type CreateContactPropertyOptions = {
1009
+ key: string;
1010
+ } & (StringBaseContactPropertyOptions | NumberBaseContactPropertyOptions);
1011
+ type CreateContactPropertyResponseSuccess = Pick<ContactProperty, 'id' | 'object'>;
1012
+ interface CreateContactPropertyResponse {
1013
+ data: CreateContactPropertyResponseSuccess | null;
1014
+ error: ErrorResponse | null;
1015
+ }
1016
+
1017
+ type RemoveContactPropertyResponseSuccess = Pick<ContactProperty, 'id' | 'object'> & {
1018
+ deleted: boolean;
1019
+ };
1020
+ interface RemoveContactPropertyResponse {
1021
+ data: RemoveContactPropertyResponseSuccess | null;
1022
+ error: ErrorResponse | null;
1023
+ }
1024
+
1025
+ type GetContactPropertyResponse = {
1026
+ data: ContactProperty;
1027
+ error: null;
1028
+ } | {
1029
+ data: null;
1030
+ error: ErrorResponse;
1031
+ };
1032
+
1033
+ type ListContactPropertiesOptions = PaginationOptions;
1034
+ type ListContactPropertiesResponse = {
1035
+ data: {
1036
+ object: 'list';
1037
+ has_more: boolean;
1038
+ data: ContactProperty[];
1039
+ };
1040
+ error: null;
1041
+ } | {
1042
+ data: null;
1043
+ error: ErrorResponse;
1044
+ };
1045
+
1046
+ type UpdateContactPropertyOptions = {
1047
+ id: string;
1048
+ fallbackValue?: string | number | null;
1049
+ };
1050
+ type UpdateContactPropertyResponseSuccess = Pick<ContactProperty, 'id' | 'object'>;
1051
+ interface UpdateContactPropertyResponse {
1052
+ data: UpdateContactPropertyResponseSuccess | null;
1053
+ error: ErrorResponse | null;
1054
+ }
1055
+
1056
+ declare class ContactProperties {
1057
+ private readonly resend;
1058
+ constructor(resend: Resend);
1059
+ create(options: CreateContactPropertyOptions): Promise<CreateContactPropertyResponse>;
1060
+ list(options?: ListContactPropertiesOptions): Promise<ListContactPropertiesResponse>;
1061
+ get(id: string): Promise<GetContactPropertyResponse>;
1062
+ update(payload: UpdateContactPropertyOptions): Promise<UpdateContactPropertyResponse>;
1063
+ remove(id: string): Promise<RemoveContactPropertyResponse>;
1064
+ }
1065
+
1066
+ type ContactSegmentsBaseOptions = {
1038
1067
  contactId: string;
1039
1068
  email?: never;
1040
1069
  } | {
@@ -1042,69 +1071,73 @@ type ContactAudiencesBaseOptions = {
1042
1071
  email: string;
1043
1072
  };
1044
1073
 
1045
- type AddContactAudiencesOptions = ContactAudiencesBaseOptions & {
1046
- audienceId: string;
1074
+ type AddContactSegmentOptions = ContactSegmentsBaseOptions & {
1075
+ segmentId: string;
1047
1076
  };
1048
- interface AddContactAudiencesResponseSuccess {
1077
+ interface AddContactSegmentResponseSuccess {
1049
1078
  id: string;
1050
1079
  }
1051
- type AddContactAudiencesResponse = {
1052
- data: AddContactAudiencesResponseSuccess;
1080
+ type AddContactSegmentResponse = {
1081
+ data: AddContactSegmentResponseSuccess;
1053
1082
  error: null;
1054
1083
  } | {
1055
1084
  data: null;
1056
1085
  error: ErrorResponse;
1057
1086
  };
1058
1087
 
1059
- type ListContactAudiencesOptions = PaginationOptions & ContactAudiencesBaseOptions;
1060
- type ListContactAudiencesResponseSuccess = PaginatedData<Audience[]>;
1061
- type ListContactAudiencesResponse = {
1062
- data: ListContactAudiencesResponseSuccess;
1088
+ interface Segment {
1089
+ created_at: string;
1090
+ id: string;
1091
+ name: string;
1092
+ }
1093
+
1094
+ type ListContactSegmentsOptions = PaginationOptions & ContactSegmentsBaseOptions;
1095
+ type ListContactSegmentsResponseSuccess = PaginatedData<Segment[]>;
1096
+ type ListContactSegmentsResponse = {
1097
+ data: ListContactSegmentsResponseSuccess;
1063
1098
  error: null;
1064
1099
  } | {
1065
1100
  data: null;
1066
1101
  error: ErrorResponse;
1067
1102
  };
1068
1103
 
1069
- type RemoveContactAudiencesOptions = ContactAudiencesBaseOptions & {
1070
- audienceId: string;
1104
+ type RemoveContactSegmentOptions = ContactSegmentsBaseOptions & {
1105
+ segmentId: string;
1071
1106
  };
1072
- interface RemoveContactAudiencesResponseSuccess {
1107
+ interface RemoveContactSegmentResponseSuccess {
1073
1108
  id: string;
1074
1109
  deleted: boolean;
1075
1110
  }
1076
- type RemoveContactAudiencesResponse = {
1077
- data: RemoveContactAudiencesResponseSuccess;
1111
+ type RemoveContactSegmentResponse = {
1112
+ data: RemoveContactSegmentResponseSuccess;
1078
1113
  error: null;
1079
1114
  } | {
1080
1115
  data: null;
1081
1116
  error: ErrorResponse;
1082
1117
  };
1083
1118
 
1084
- declare class ContactAudiences {
1119
+ declare class ContactSegments {
1085
1120
  private readonly resend;
1086
1121
  constructor(resend: Resend);
1087
- list(options: ListContactAudiencesOptions): Promise<ListContactAudiencesResponse>;
1088
- add(options: AddContactAudiencesOptions): Promise<AddContactAudiencesResponse>;
1089
- remove(options: RemoveContactAudiencesOptions): Promise<RemoveContactAudiencesResponse>;
1122
+ list(options: ListContactSegmentsOptions): Promise<ListContactSegmentsResponse>;
1123
+ add(options: AddContactSegmentOptions): Promise<AddContactSegmentResponse>;
1124
+ remove(options: RemoveContactSegmentOptions): Promise<RemoveContactSegmentResponse>;
1090
1125
  }
1091
1126
 
1092
- interface GetContactTopicsBaseOptions {
1127
+ interface ListContactTopicsBaseOptions {
1093
1128
  id?: string;
1094
1129
  email?: string;
1095
1130
  }
1096
- type GetContactTopicsOptions = GetContactTopicsBaseOptions & PaginationOptions;
1131
+ type ListContactTopicsOptions = ListContactTopicsBaseOptions & PaginationOptions;
1097
1132
  interface ContactTopic {
1098
1133
  id: string;
1099
1134
  name: string;
1100
1135
  description: string | null;
1101
1136
  subscription: 'opt_in' | 'opt_out';
1102
1137
  }
1103
- type GetContactTopicsResponse = {
1104
- data: PaginatedData<{
1105
- email: string;
1106
- topics: ContactTopic[];
1107
- }>;
1138
+ type ListContactTopicsResponseSuccess = PaginatedData<ContactTopic[]>;
1139
+ type ListContactTopicsResponse = {
1140
+ data: ListContactTopicsResponseSuccess;
1108
1141
  error: null;
1109
1142
  } | {
1110
1143
  data: null;
@@ -1133,13 +1166,13 @@ declare class ContactTopics {
1133
1166
  private readonly resend;
1134
1167
  constructor(resend: Resend);
1135
1168
  update(payload: UpdateContactTopicsOptions): Promise<UpdateContactTopicsResponse>;
1136
- get(options: GetContactTopicsOptions): Promise<GetContactTopicsResponse>;
1169
+ list(options: ListContactTopicsOptions): Promise<ListContactTopicsResponse>;
1137
1170
  }
1138
1171
 
1139
1172
  declare class Contacts {
1140
1173
  private readonly resend;
1141
1174
  readonly topics: ContactTopics;
1142
- readonly audiences: ContactAudiences;
1175
+ readonly segments: ContactSegments;
1143
1176
  constructor(resend: Resend);
1144
1177
  create(payload: CreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
1145
1178
  list(options?: ListContactsOptions | ListAudienceContactsOptions): Promise<ListContactsResponse>;
@@ -1193,6 +1226,68 @@ declare class Emails {
1193
1226
  cancel(id: string): Promise<CancelEmailResponse>;
1194
1227
  }
1195
1228
 
1229
+ interface CreateSegmentOptions {
1230
+ name: string;
1231
+ }
1232
+ interface CreateSegmentRequestOptions extends PostOptions {
1233
+ }
1234
+ interface CreateSegmentResponseSuccess extends Pick<Segment, 'name' | 'id'> {
1235
+ object: 'segment';
1236
+ }
1237
+ type CreateSegmentResponse = {
1238
+ data: CreateSegmentResponseSuccess;
1239
+ error: null;
1240
+ } | {
1241
+ data: null;
1242
+ error: ErrorResponse;
1243
+ };
1244
+
1245
+ interface GetSegmentResponseSuccess extends Pick<Segment, 'id' | 'name' | 'created_at'> {
1246
+ object: 'segment';
1247
+ }
1248
+ type GetSegmentResponse = {
1249
+ data: GetSegmentResponseSuccess;
1250
+ error: null;
1251
+ } | {
1252
+ data: null;
1253
+ error: ErrorResponse;
1254
+ };
1255
+
1256
+ type ListSegmentsOptions = PaginationOptions;
1257
+ type ListSegmentsResponseSuccess = {
1258
+ object: 'list';
1259
+ data: Segment[];
1260
+ has_more: boolean;
1261
+ };
1262
+ type ListSegmentsResponse = {
1263
+ data: ListSegmentsResponseSuccess;
1264
+ error: null;
1265
+ } | {
1266
+ data: null;
1267
+ error: ErrorResponse;
1268
+ };
1269
+
1270
+ interface RemoveSegmentResponseSuccess extends Pick<Segment, 'id'> {
1271
+ object: 'segment';
1272
+ deleted: boolean;
1273
+ }
1274
+ type RemoveSegmentResponse = {
1275
+ data: RemoveSegmentResponseSuccess;
1276
+ error: null;
1277
+ } | {
1278
+ data: null;
1279
+ error: ErrorResponse;
1280
+ };
1281
+
1282
+ declare class Segments {
1283
+ private readonly resend;
1284
+ constructor(resend: Resend);
1285
+ create(payload: CreateSegmentOptions, options?: CreateSegmentRequestOptions): Promise<CreateSegmentResponse>;
1286
+ list(options?: ListSegmentsOptions): Promise<ListSegmentsResponse>;
1287
+ get(id: string): Promise<GetSegmentResponse>;
1288
+ remove(id: string): Promise<RemoveSegmentResponse>;
1289
+ }
1290
+
1196
1291
  interface Template {
1197
1292
  id: string;
1198
1293
  name: string;
@@ -1210,11 +1305,10 @@ interface Template {
1210
1305
  has_unpublished_versions: boolean;
1211
1306
  current_version_id: string;
1212
1307
  }
1213
- type TemplateVariableListFallbackType = string[] | number[] | boolean[] | Record<string, unknown>[];
1214
1308
  interface TemplateVariable {
1215
1309
  key: string;
1216
- fallback_value: string | number | boolean | Record<string, unknown> | TemplateVariableListFallbackType | null;
1217
- type: 'string' | 'number' | 'boolean' | 'object' | 'list';
1310
+ fallback_value: string | number | null;
1311
+ type: 'string' | 'number';
1218
1312
  created_at: string;
1219
1313
  updated_at: string;
1220
1314
  }
@@ -1229,15 +1323,6 @@ type TemplateVariableCreationOptions = Pick<TemplateVariable, 'key' | 'type'> &
1229
1323
  } | {
1230
1324
  type: 'number';
1231
1325
  fallbackValue?: number | null;
1232
- } | {
1233
- type: 'boolean';
1234
- fallbackValue?: boolean | null;
1235
- } | {
1236
- type: 'object';
1237
- fallbackValue: Record<string, unknown>;
1238
- } | {
1239
- type: 'list';
1240
- fallbackValue: TemplateVariableListFallbackType;
1241
1326
  });
1242
1327
  type TemplateOptionalFieldsForCreation = Partial<Pick<Template, 'subject' | 'text' | 'alias' | 'from'>> & {
1243
1328
  replyTo?: string[] | string;
@@ -1330,15 +1415,6 @@ type TemplateVariableUpdateOptions = Pick<TemplateVariable, 'key' | 'type'> & ({
1330
1415
  } | {
1331
1416
  type: 'number';
1332
1417
  fallbackValue?: number | null;
1333
- } | {
1334
- type: 'boolean';
1335
- fallbackValue?: boolean | null;
1336
- } | {
1337
- type: 'object';
1338
- fallbackValue: Record<string, unknown>;
1339
- } | {
1340
- type: 'list';
1341
- fallbackValue: TemplateVariableListFallbackType;
1342
1418
  });
1343
1419
  interface UpdateTemplateOptions extends Partial<Pick<Template, 'name' | 'subject' | 'html' | 'text' | 'from' | 'alias'>> {
1344
1420
  variables?: TemplateVariableUpdateOptions[];
@@ -1432,17 +1508,110 @@ declare class Topics {
1432
1508
  remove(id: string): Promise<RemoveTopicResponse>;
1433
1509
  }
1434
1510
 
1511
+ interface CreateWebhookOptions {
1512
+ endpoint: string;
1513
+ events: string[];
1514
+ }
1515
+ interface CreateWebhookRequestOptions extends PostOptions {
1516
+ }
1517
+ interface CreateWebhookResponseSuccess {
1518
+ object: 'webhook';
1519
+ id: string;
1520
+ }
1521
+ type CreateWebhookResponse = {
1522
+ data: CreateWebhookResponseSuccess;
1523
+ error: null;
1524
+ } | {
1525
+ data: null;
1526
+ error: ErrorResponse;
1527
+ };
1528
+
1529
+ interface GetWebhookResponseSuccess {
1530
+ object: 'webhook';
1531
+ id: string;
1532
+ created_at: string;
1533
+ status: string;
1534
+ endpoint: string;
1535
+ events: string[] | null;
1536
+ }
1537
+ type GetWebhookResponse = {
1538
+ data: GetWebhookResponseSuccess;
1539
+ error: null;
1540
+ } | {
1541
+ data: null;
1542
+ error: ErrorResponse;
1543
+ };
1544
+
1545
+ type ListWebhooksOptions = PaginationOptions;
1546
+ interface Webhook {
1547
+ id: string;
1548
+ endpoint: string;
1549
+ created_at: string;
1550
+ status: string;
1551
+ events: string[] | null;
1552
+ }
1553
+ type ListWebhooksResponseSuccess = {
1554
+ object: 'list';
1555
+ has_more: boolean;
1556
+ data: Webhook[];
1557
+ };
1558
+ type ListWebhooksResponse = {
1559
+ data: ListWebhooksResponseSuccess;
1560
+ error: null;
1561
+ } | {
1562
+ data: null;
1563
+ error: ErrorResponse;
1564
+ };
1565
+
1566
+ type RemoveWebhookResponseSuccess = Pick<Webhook, 'id'> & {
1567
+ object: 'webhook';
1568
+ deleted: boolean;
1569
+ };
1570
+ type RemoveWebhookResponse = {
1571
+ data: RemoveWebhookResponseSuccess;
1572
+ error: null;
1573
+ } | {
1574
+ data: null;
1575
+ error: ErrorResponse;
1576
+ };
1577
+
1578
+ interface Headers {
1579
+ id: string;
1580
+ timestamp: string;
1581
+ signature: string;
1582
+ }
1583
+ interface VerifyWebhookOptions {
1584
+ payload: string;
1585
+ headers: Headers;
1586
+ webhookSecret: string;
1587
+ }
1588
+ declare class Webhooks {
1589
+ private readonly resend;
1590
+ constructor(resend: Resend);
1591
+ create(payload: CreateWebhookOptions, options?: CreateWebhookRequestOptions): Promise<CreateWebhookResponse>;
1592
+ get(id: string): Promise<GetWebhookResponse>;
1593
+ list(options?: ListWebhooksOptions): Promise<ListWebhooksResponse>;
1594
+ remove(id: string): Promise<RemoveWebhookResponse>;
1595
+ verify(payload: VerifyWebhookOptions): unknown;
1596
+ }
1597
+
1435
1598
  declare class Resend {
1436
1599
  readonly key?: string | undefined;
1437
1600
  private readonly headers;
1438
1601
  readonly apiKeys: ApiKeys;
1439
1602
  readonly attachments: Attachments;
1440
- readonly audiences: Audiences;
1603
+ readonly segments: Segments;
1604
+ /**
1605
+ * @deprecated Use segments instead
1606
+ */
1607
+ readonly audiences: Segments;
1441
1608
  readonly batch: Batch;
1442
1609
  readonly broadcasts: Broadcasts;
1443
1610
  readonly contacts: Contacts;
1611
+ readonly contactProperties: ContactProperties;
1444
1612
  readonly domains: Domains;
1445
1613
  readonly emails: Emails;
1614
+ readonly webhooks: Webhooks;
1446
1615
  readonly templates: Templates;
1447
1616
  readonly topics: Topics;
1448
1617
  constructor(key?: string | undefined);
@@ -1490,4 +1659,4 @@ declare class Resend {
1490
1659
  }>;
1491
1660
  }
1492
1661
 
1493
- 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 ListApiKeysOptions, type ListApiKeysResponse, type ListApiKeysResponseSuccess, type ListAttachmentsOptions, type ListAttachmentsResponse, type ListAudienceContactsOptions, 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 ListInboundEmail, type ListInboundEmailsOptions, type ListInboundEmailsResponse, type ListInboundEmailsResponseSuccess, type PaginatedData, type PaginationOptions, type PatchOptions, type PostOptions, type PutOptions, type ReceivingRecord, 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 };
1662
+ export { type ApiKey, type Attachment, type Broadcast, type CancelEmailResponse, type CancelEmailResponseSuccess, type Contact, type CreateApiKeyOptions, type CreateApiKeyRequestOptions, type CreateApiKeyResponse, type CreateApiKeyResponseSuccess, 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 CreateSegmentOptions, type CreateSegmentRequestOptions, type CreateSegmentResponse, type CreateSegmentResponseSuccess, type CreateWebhookOptions, type CreateWebhookRequestOptions, type CreateWebhookResponse, type CreateWebhookResponseSuccess, 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 GetBroadcastResponse, type GetBroadcastResponseSuccess, type GetContactOptions, type GetContactResponse, type GetContactResponseSuccess, type GetDomainResponse, type GetDomainResponseSuccess, type GetEmailResponse, type GetEmailResponseSuccess, type GetInboundEmailResponse, type GetInboundEmailResponseSuccess, type GetOptions, type GetSegmentResponse, type GetSegmentResponseSuccess, type GetWebhookResponse, type GetWebhookResponseSuccess, type IdempotentRequest, type InboundAttachment, type ListApiKeysOptions, type ListApiKeysResponse, type ListApiKeysResponseSuccess, type ListAttachmentsOptions, type ListAttachmentsResponse, type ListAudienceContactsOptions, type ListBroadcastsOptions, type ListBroadcastsResponse, type ListBroadcastsResponseSuccess, type ListContactsOptions, type ListContactsResponse, type ListContactsResponseSuccess, type ListDomainsOptions, type ListDomainsResponse, type ListDomainsResponseSuccess, type ListInboundEmail, type ListInboundEmailsOptions, type ListInboundEmailsResponse, type ListInboundEmailsResponseSuccess, type ListSegmentsOptions, type ListSegmentsResponse, type ListSegmentsResponseSuccess, type ListWebhooksOptions, type ListWebhooksResponse, type ListWebhooksResponseSuccess, type PaginatedData, type PaginationOptions, type PatchOptions, type PostOptions, type PutOptions, type ReceivingRecord, type RemoveApiKeyResponse, type RemoveApiKeyResponseSuccess, type RemoveBroadcastResponse, type RemoveBroadcastResponseSuccess, type RemoveContactOptions, type RemoveContactsResponse, type RemoveContactsResponseSuccess, type RemoveDomainsResponse, type RemoveDomainsResponseSuccess, type RemoveSegmentResponse, type RemoveSegmentResponseSuccess, type RemoveWebhookResponse, type RemoveWebhookResponseSuccess, type RequireAtLeastOne, Resend, type Segment, 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, type Webhook };