+140
-734
@@ -13,3 +13,2 @@ import * as React$1 from 'react'; | ||
| custom_return_path?: string; | ||
| capability?: 'send' | 'receive' | 'send-and-receive'; | ||
| } | ||
@@ -55,5 +54,5 @@ | ||
| interface EmailApiOptions { | ||
| from?: string; | ||
| from: string; | ||
| to: string | string[]; | ||
| subject?: string; | ||
| subject: string; | ||
| region?: string; | ||
@@ -66,10 +65,5 @@ headers?: Record<string, string>; | ||
| reply_to?: string | string[]; | ||
| topic_id?: string | null; | ||
| scheduled_at?: string; | ||
| tags?: Tag$1[]; | ||
| attachments?: EmailApiAttachment[]; | ||
| template?: { | ||
| id: string; | ||
| variables?: Record<string, string | number | boolean>; | ||
| }; | ||
| } | ||
@@ -91,2 +85,7 @@ | ||
| interface List<T> { | ||
| readonly object: 'list'; | ||
| data: T[]; | ||
| } | ||
| type PaginationOptions = { | ||
@@ -110,7 +109,2 @@ /** | ||
| }); | ||
| type PaginatedData<Data> = { | ||
| object: 'list'; | ||
| data: Data; | ||
| has_more: boolean; | ||
| }; | ||
@@ -184,22 +178,18 @@ interface PatchOptions { | ||
| interface Attachment$1 { | ||
| interface Audience { | ||
| created_at: string; | ||
| id: string; | ||
| filename?: string; | ||
| size: number; | ||
| content_type: string; | ||
| content_disposition: 'inline' | 'attachment'; | ||
| content_id?: string; | ||
| download_url: string; | ||
| expires_at: string; | ||
| name: string; | ||
| } | ||
| interface GetAttachmentOptions { | ||
| emailId: string; | ||
| id: string; | ||
| interface CreateAudienceOptions { | ||
| name: string; | ||
| } | ||
| type GetAttachmentResponseSuccess = { | ||
| object: 'attachment'; | ||
| } & Attachment$1; | ||
| type GetAttachmentResponse = { | ||
| data: GetAttachmentResponseSuccess; | ||
| interface CreateAudienceRequestOptions extends PostOptions { | ||
| } | ||
| interface CreateAudienceResponseSuccess extends Pick<Audience, 'name' | 'id'> { | ||
| object: 'audience'; | ||
| } | ||
| type CreateAudienceResponse = { | ||
| data: CreateAudienceResponseSuccess; | ||
| error: null; | ||
@@ -211,17 +201,33 @@ } | { | ||
| type ListAttachmentsOptions = PaginationOptions & { | ||
| emailId: string; | ||
| interface GetAudienceResponseSuccess extends Pick<Audience, 'id' | 'name' | 'created_at'> { | ||
| object: 'audience'; | ||
| } | ||
| type GetAudienceResponse = { | ||
| data: GetAudienceResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface ListAttachmentsApiResponse { | ||
| type ListAudiencesOptions = PaginationOptions; | ||
| type ListAudiencesResponseSuccess = { | ||
| object: 'list'; | ||
| data: Audience[]; | ||
| has_more: boolean; | ||
| data: Attachment$1[]; | ||
| }; | ||
| type ListAudiencesResponse = { | ||
| data: ListAudiencesResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface RemoveAudiencesResponseSuccess extends Pick<Audience, 'id'> { | ||
| object: 'audience'; | ||
| deleted: boolean; | ||
| } | ||
| interface ListAttachmentsResponseSuccess { | ||
| object: 'list'; | ||
| has_more: boolean; | ||
| data: Attachment$1[]; | ||
| } | ||
| type ListAttachmentsResponse = { | ||
| data: ListAttachmentsResponseSuccess; | ||
| type RemoveAudiencesResponse = { | ||
| data: RemoveAudiencesResponseSuccess; | ||
| error: null; | ||
@@ -253,12 +259,2 @@ } | { | ||
| } | ||
| interface EmailTemplateOptions { | ||
| template: { | ||
| id: string; | ||
| variables?: Record<string, string | number | boolean>; | ||
| }; | ||
| } | ||
| interface CreateEmailBaseOptionsWithTemplate extends Omit<CreateEmailBaseOptions, 'from' | 'subject'> { | ||
| from?: string; | ||
| subject?: string; | ||
| } | ||
| interface CreateEmailBaseOptions { | ||
@@ -320,8 +316,2 @@ /** | ||
| /** | ||
| * The id of the topic you want to send to | ||
| * | ||
| * @link https://resend.com/docs/api-reference/emails/send-email#body-parameters | ||
| */ | ||
| topicId?: string | null; | ||
| /** | ||
| * Schedule email to be sent later. | ||
@@ -334,9 +324,3 @@ * The date should be in ISO 8601 format (e.g: 2024-08-05T11:52:01.858Z). | ||
| } | ||
| type CreateEmailOptions = ((RequireAtLeastOne<EmailRenderOptions$1> & CreateEmailBaseOptions) & { | ||
| template?: never; | ||
| }) | ((EmailTemplateOptions & CreateEmailBaseOptionsWithTemplate) & { | ||
| react?: never; | ||
| html?: never; | ||
| text?: never; | ||
| }); | ||
| type CreateEmailOptions = RequireAtLeastOne<EmailRenderOptions$1> & CreateEmailBaseOptions; | ||
| interface CreateEmailRequestOptions extends PostOptions, IdempotentRequest { | ||
@@ -419,3 +403,2 @@ } | ||
| name: string; | ||
| segment_id: string | null; | ||
| audience_id: string | null; | ||
@@ -430,3 +413,2 @@ from: string | null; | ||
| sent_at: string | null; | ||
| topic_id?: string | null; | ||
| html: string | null; | ||
@@ -456,21 +438,15 @@ text: string | null; | ||
| } | ||
| interface SegmentOptions { | ||
| interface CreateBroadcastBaseOptions { | ||
| /** | ||
| * The id of the segment you want to send to | ||
| * The name of the broadcast | ||
| * | ||
| * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters | ||
| */ | ||
| segmentId: string; | ||
| name?: string; | ||
| /** | ||
| * @deprecated Use segmentId instead | ||
| */ | ||
| audienceId: string; | ||
| } | ||
| interface CreateBroadcastBaseOptions { | ||
| /** | ||
| * The name of the broadcast | ||
| * The id of the audience you want to send to | ||
| * | ||
| * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters | ||
| */ | ||
| name?: string; | ||
| audienceId: string; | ||
| /** | ||
@@ -500,10 +476,4 @@ * A short snippet of text displayed as a preview in recipients' inboxes, often shown below or beside the subject line. | ||
| subject: string; | ||
| /** | ||
| * The id of the topic you want to send to | ||
| * | ||
| * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters | ||
| */ | ||
| topicId?: string | null; | ||
| } | ||
| type CreateBroadcastOptions = RequireAtLeastOne<EmailRenderOptions> & RequireAtLeastOne<SegmentOptions> & CreateBroadcastBaseOptions; | ||
| type CreateBroadcastOptions = RequireAtLeastOne<EmailRenderOptions> & CreateBroadcastBaseOptions; | ||
| interface CreateBroadcastRequestOptions extends PostOptions { | ||
@@ -538,3 +508,3 @@ } | ||
| has_more: boolean; | ||
| data: Pick<Broadcast, 'id' | 'name' | 'audience_id' | 'segment_id' | 'status' | 'created_at' | 'scheduled_at' | 'sent_at'>[]; | ||
| data: Pick<Broadcast, 'id' | 'name' | 'audience_id' | 'status' | 'created_at' | 'scheduled_at' | 'sent_at'>[]; | ||
| }; | ||
@@ -591,6 +561,2 @@ type ListBroadcastsResponse = { | ||
| name?: string; | ||
| segmentId?: string; | ||
| /** | ||
| * @deprecated Use segmentId instead | ||
| */ | ||
| audienceId?: string; | ||
@@ -604,3 +570,2 @@ from?: string; | ||
| previewText?: string; | ||
| topicId?: string | null; | ||
| }; | ||
@@ -652,3 +617,3 @@ type UpdateBroadcastResponse = { | ||
| interface CreateContactOptions { | ||
| audienceId?: string; | ||
| audienceId: string; | ||
| email: string; | ||
@@ -672,5 +637,5 @@ unsubscribed?: boolean; | ||
| type GetContactOptions = string | ({ | ||
| audienceId?: string; | ||
| } & SelectingField); | ||
| type GetContactOptions = { | ||
| audienceId: string; | ||
| } & SelectingField; | ||
| interface GetContactResponseSuccess extends Pick<Contact, 'id' | 'email' | 'created_at' | 'first_name' | 'last_name' | 'unsubscribed'> { | ||
@@ -687,8 +652,5 @@ object: 'contact'; | ||
| type ListAudienceContactsOptions = { | ||
| type ListContactsOptions = { | ||
| audienceId: string; | ||
| } & PaginationOptions; | ||
| type ListContactsOptions = PaginationOptions & { | ||
| audienceId?: string; | ||
| }; | ||
| interface ListContactsResponseSuccess { | ||
@@ -712,5 +674,5 @@ object: 'list'; | ||
| }; | ||
| type RemoveContactOptions = string | (SelectingField & { | ||
| audienceId?: string; | ||
| }); | ||
| type RemoveContactOptions = SelectingField & { | ||
| audienceId: string; | ||
| }; | ||
| type RemoveContactsResponse = { | ||
@@ -725,3 +687,3 @@ data: RemoveContactsResponseSuccess; | ||
| type UpdateContactOptions = { | ||
| audienceId?: string; | ||
| audienceId: string; | ||
| unsubscribed?: boolean; | ||
@@ -745,3 +707,3 @@ firstName?: string; | ||
| type DomainStatus = 'pending' | 'verified' | 'failed' | 'temporary_failure' | 'not_started'; | ||
| type DomainRecords = DomainSpfRecord | DomainDkimRecord | ReceivingRecord; | ||
| type DomainRecords = DomainSpfRecord | DomainDkimRecord; | ||
| interface DomainSpfRecord { | ||
@@ -769,11 +731,2 @@ record: 'SPF'; | ||
| } | ||
| interface ReceivingRecord { | ||
| record: 'Receiving'; | ||
| name: string; | ||
| value: string; | ||
| type: 'MX'; | ||
| ttl: string; | ||
| status: DomainStatus; | ||
| priority: number; | ||
| } | ||
| interface Domain { | ||
@@ -785,3 +738,2 @@ id: string; | ||
| region: DomainRegion; | ||
| capability: 'send' | 'receive' | 'send-and-receive'; | ||
| } | ||
@@ -793,7 +745,6 @@ | ||
| customReturnPath?: string; | ||
| capability?: 'send' | 'receive' | 'send-and-receive'; | ||
| } | ||
| interface CreateDomainRequestOptions extends PostOptions { | ||
| } | ||
| interface CreateDomainResponseSuccess extends Pick<Domain, 'name' | 'id' | 'status' | 'created_at' | 'region' | 'capability'> { | ||
| interface CreateDomainResponseSuccess extends Pick<Domain, 'name' | 'id' | 'status' | 'created_at' | 'region'> { | ||
| records: DomainRecords[]; | ||
@@ -809,3 +760,3 @@ } | ||
| interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status' | 'capability'> { | ||
| interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status'> { | ||
| object: 'domain'; | ||
@@ -904,3 +855,2 @@ records: DomainRecords[]; | ||
| to: string[]; | ||
| topic_id?: string | null; | ||
| scheduled_at: string | null; | ||
@@ -933,27 +883,17 @@ object: 'email'; | ||
| interface GetInboundEmailResponseSuccess { | ||
| object: 'inbound'; | ||
| type WebhookEvent = 'email.sent' | 'email.delivered' | 'email.delivery_delayed' | 'email.complained' | 'email.bounced' | 'email.opened' | 'email.clicked' | 'email.received' | 'email.failed' | 'contact.created' | 'contact.updated' | 'contact.deleted' | 'domain.created' | 'domain.updated' | 'domain.deleted'; | ||
| interface CreateWebhookOptions { | ||
| endpoint: string; | ||
| events: WebhookEvent[]; | ||
| } | ||
| interface CreateWebhookRequestOptions extends PostOptions { | ||
| } | ||
| interface CreateWebhookResponseSuccess { | ||
| object: 'webhook'; | ||
| id: string; | ||
| to: string[]; | ||
| from: string; | ||
| created_at: string; | ||
| subject: string; | ||
| bcc: string[] | null; | ||
| cc: string[] | null; | ||
| reply_to: string[] | null; | ||
| html: string | null; | ||
| text: string | null; | ||
| headers: Record<string, string>; | ||
| message_id: string; | ||
| attachments: Array<{ | ||
| id: string; | ||
| filename: string; | ||
| size: number; | ||
| content_type: string; | ||
| content_id: string; | ||
| content_disposition: string; | ||
| }>; | ||
| signing_secret: string; | ||
| } | ||
| type GetInboundEmailResponse = { | ||
| data: GetInboundEmailResponseSuccess; | ||
| type CreateWebhookResponse = { | ||
| data: CreateWebhookResponseSuccess; | ||
| error: null; | ||
@@ -965,11 +905,13 @@ } | { | ||
| type ListInboundEmailsOptions = PaginationOptions; | ||
| type ListInboundEmail = Omit<GetInboundEmailResponseSuccess, 'html' | 'text' | 'headers' | 'object'>; | ||
| interface ListInboundEmailsResponseSuccess { | ||
| object: 'list'; | ||
| has_more: boolean; | ||
| data: ListInboundEmail[]; | ||
| interface GetWebhookResponseSuccess { | ||
| object: 'webhook'; | ||
| id: string; | ||
| created_at: string; | ||
| status: 'enabled' | 'disabled'; | ||
| endpoint: string; | ||
| events: WebhookEvent[] | null; | ||
| signing_secret: string; | ||
| } | ||
| type ListInboundEmailsResponse = { | ||
| data: ListInboundEmailsResponseSuccess; | ||
| type GetWebhookResponse = { | ||
| data: GetWebhookResponseSuccess; | ||
| error: null; | ||
@@ -981,90 +923,17 @@ } | { | ||
| declare class ApiKeys { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| create(payload: CreateApiKeyOptions, options?: CreateApiKeyRequestOptions): Promise<CreateApiKeyResponse>; | ||
| list(options?: ListApiKeysOptions): Promise<ListApiKeysResponse>; | ||
| remove(id: string): Promise<RemoveApiKeyResponse>; | ||
| } | ||
| declare class Receiving$1 { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| get(options: GetAttachmentOptions): Promise<GetAttachmentResponse>; | ||
| list(options: ListAttachmentsOptions): Promise<ListAttachmentsResponse>; | ||
| } | ||
| declare class Sending { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| get(options: GetAttachmentOptions): Promise<GetAttachmentResponse>; | ||
| list(options: ListAttachmentsOptions): Promise<ListAttachmentsResponse>; | ||
| } | ||
| declare class Attachments { | ||
| readonly receiving: Receiving$1; | ||
| readonly sending: Sending; | ||
| constructor(resend: Resend); | ||
| } | ||
| declare class Batch { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| send<Options extends CreateBatchRequestOptions>(payload: CreateBatchOptions, options?: Options): Promise<CreateBatchResponse<Options>>; | ||
| create<Options extends CreateBatchRequestOptions>(payload: CreateBatchOptions, options?: Options): Promise<CreateBatchResponse<Options>>; | ||
| } | ||
| declare class Broadcasts { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| create(payload: CreateBroadcastOptions, options?: CreateBroadcastRequestOptions): Promise<SendBroadcastResponse>; | ||
| send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>; | ||
| list(options?: ListBroadcastsOptions): Promise<ListBroadcastsResponse>; | ||
| get(id: string): Promise<GetBroadcastResponse>; | ||
| remove(id: string): Promise<RemoveBroadcastResponse>; | ||
| update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>; | ||
| } | ||
| type StringBaseContactProperty = { | ||
| type: 'string'; | ||
| fallbackValue: string | null; | ||
| }; | ||
| type NumberBaseContactProperty = { | ||
| type: 'number'; | ||
| fallbackValue: number | null; | ||
| }; | ||
| type ContactProperty = { | ||
| type ListWebhooksOptions = PaginationOptions; | ||
| interface Webhook { | ||
| id: string; | ||
| object: 'contact_property'; | ||
| createdAt: string; | ||
| key: string; | ||
| } & (StringBaseContactProperty | NumberBaseContactProperty); | ||
| type StringBaseContactPropertyOptions = { | ||
| type: 'string'; | ||
| fallbackValue?: string | null; | ||
| }; | ||
| type NumberBaseContactPropertyOptions = { | ||
| type: 'number'; | ||
| fallbackValue?: number | null; | ||
| }; | ||
| type CreateContactPropertyOptions = { | ||
| key: string; | ||
| } & (StringBaseContactPropertyOptions | NumberBaseContactPropertyOptions); | ||
| type CreateContactPropertyResponseSuccess = Pick<ContactProperty, 'id' | 'object'>; | ||
| interface CreateContactPropertyResponse { | ||
| data: CreateContactPropertyResponseSuccess | null; | ||
| error: ErrorResponse | null; | ||
| endpoint: string; | ||
| created_at: string; | ||
| status: 'enabled' | 'disabled'; | ||
| events: WebhookEvent[] | null; | ||
| } | ||
| type RemoveContactPropertyResponseSuccess = Pick<ContactProperty, 'id' | 'object'> & { | ||
| deleted: boolean; | ||
| type ListWebhooksResponseSuccess = { | ||
| object: 'list'; | ||
| has_more: boolean; | ||
| data: Webhook[]; | ||
| }; | ||
| interface RemoveContactPropertyResponse { | ||
| data: RemoveContactPropertyResponseSuccess | null; | ||
| error: ErrorResponse | null; | ||
| } | ||
| type GetContactPropertyResponse = { | ||
| data: ContactProperty; | ||
| type ListWebhooksResponse = { | ||
| data: ListWebhooksResponseSuccess; | ||
| error: null; | ||
@@ -1076,51 +945,8 @@ } | { | ||
| type ListContactPropertiesOptions = PaginationOptions; | ||
| type ListContactPropertiesResponse = { | ||
| data: { | ||
| object: 'list'; | ||
| has_more: boolean; | ||
| data: ContactProperty[]; | ||
| }; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| type RemoveWebhookResponseSuccess = Pick<Webhook, 'id'> & { | ||
| object: 'webhook'; | ||
| deleted: boolean; | ||
| }; | ||
| type UpdateContactPropertyOptions = { | ||
| id: string; | ||
| fallbackValue?: string | number | null; | ||
| }; | ||
| type UpdateContactPropertyResponseSuccess = Pick<ContactProperty, 'id' | 'object'>; | ||
| interface UpdateContactPropertyResponse { | ||
| data: UpdateContactPropertyResponseSuccess | null; | ||
| error: ErrorResponse | null; | ||
| } | ||
| declare class ContactProperties { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| create(options: CreateContactPropertyOptions): Promise<CreateContactPropertyResponse>; | ||
| list(options?: ListContactPropertiesOptions): Promise<ListContactPropertiesResponse>; | ||
| get(id: string): Promise<GetContactPropertyResponse>; | ||
| update(payload: UpdateContactPropertyOptions): Promise<UpdateContactPropertyResponse>; | ||
| remove(id: string): Promise<RemoveContactPropertyResponse>; | ||
| } | ||
| type ContactSegmentsBaseOptions = { | ||
| contactId: string; | ||
| email?: never; | ||
| } | { | ||
| contactId?: never; | ||
| email: string; | ||
| }; | ||
| type AddContactSegmentOptions = ContactSegmentsBaseOptions & { | ||
| segmentId: string; | ||
| }; | ||
| interface AddContactSegmentResponseSuccess { | ||
| id: string; | ||
| } | ||
| type AddContactSegmentResponse = { | ||
| data: AddContactSegmentResponseSuccess; | ||
| type RemoveWebhookResponse = { | ||
| data: RemoveWebhookResponseSuccess; | ||
| error: null; | ||
@@ -1132,27 +958,13 @@ } | { | ||
| interface Segment { | ||
| created_at: string; | ||
| id: string; | ||
| name: string; | ||
| interface UpdateWebhookOptions { | ||
| endpoint?: string; | ||
| events?: WebhookEvent[]; | ||
| status?: 'enabled' | 'disabled'; | ||
| } | ||
| type ListContactSegmentsOptions = PaginationOptions & ContactSegmentsBaseOptions; | ||
| type ListContactSegmentsResponseSuccess = PaginatedData<Segment[]>; | ||
| type ListContactSegmentsResponse = { | ||
| data: ListContactSegmentsResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| type RemoveContactSegmentOptions = ContactSegmentsBaseOptions & { | ||
| segmentId: string; | ||
| }; | ||
| interface RemoveContactSegmentResponseSuccess { | ||
| interface UpdateWebhookResponseSuccess { | ||
| object: 'webhook'; | ||
| id: string; | ||
| deleted: boolean; | ||
| } | ||
| type RemoveContactSegmentResponse = { | ||
| data: RemoveContactSegmentResponseSuccess; | ||
| type UpdateWebhookResponse = { | ||
| data: UpdateWebhookResponseSuccess; | ||
| error: null; | ||
@@ -1164,53 +976,35 @@ } | { | ||
| declare class ContactSegments { | ||
| declare class ApiKeys { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| list(options: ListContactSegmentsOptions): Promise<ListContactSegmentsResponse>; | ||
| add(options: AddContactSegmentOptions): Promise<AddContactSegmentResponse>; | ||
| remove(options: RemoveContactSegmentOptions): Promise<RemoveContactSegmentResponse>; | ||
| create(payload: CreateApiKeyOptions, options?: CreateApiKeyRequestOptions): Promise<CreateApiKeyResponse>; | ||
| list(options?: ListApiKeysOptions): Promise<ListApiKeysResponse>; | ||
| remove(id: string): Promise<RemoveApiKeyResponse>; | ||
| } | ||
| interface ListContactTopicsBaseOptions { | ||
| id?: string; | ||
| email?: string; | ||
| declare class Audiences { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| create(payload: CreateAudienceOptions, options?: CreateAudienceRequestOptions): Promise<CreateAudienceResponse>; | ||
| list(options?: ListAudiencesOptions): Promise<ListAudiencesResponse>; | ||
| get(id: string): Promise<GetAudienceResponse>; | ||
| remove(id: string): Promise<RemoveAudiencesResponse>; | ||
| } | ||
| type ListContactTopicsOptions = ListContactTopicsBaseOptions & PaginationOptions; | ||
| interface ContactTopic { | ||
| id: string; | ||
| name: string; | ||
| description: string | null; | ||
| subscription: 'opt_in' | 'opt_out'; | ||
| } | ||
| type ListContactTopicsResponseSuccess = PaginatedData<ContactTopic[]>; | ||
| type ListContactTopicsResponse = { | ||
| data: ListContactTopicsResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface UpdateContactTopicsBaseOptions { | ||
| id?: string; | ||
| email?: string; | ||
| declare class Batch { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| send<Options extends CreateBatchRequestOptions>(payload: CreateBatchOptions, options?: Options): Promise<CreateBatchResponse<Options>>; | ||
| create<Options extends CreateBatchRequestOptions>(payload: CreateBatchOptions, options?: Options): Promise<CreateBatchResponse<Options>>; | ||
| } | ||
| interface UpdateContactTopicsOptions extends UpdateContactTopicsBaseOptions { | ||
| topics: { | ||
| id: string; | ||
| subscription: 'opt_in' | 'opt_out'; | ||
| }[]; | ||
| } | ||
| interface UpdateContactTopicsResponseSuccess { | ||
| id: string; | ||
| } | ||
| interface UpdateContactTopicsResponse { | ||
| data: UpdateContactTopicsResponseSuccess | null; | ||
| error: ErrorResponse | null; | ||
| } | ||
| declare class ContactTopics { | ||
| declare class Broadcasts { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| update(payload: UpdateContactTopicsOptions): Promise<UpdateContactTopicsResponse>; | ||
| list(options: ListContactTopicsOptions): Promise<ListContactTopicsResponse>; | ||
| create(payload: CreateBroadcastOptions, options?: CreateBroadcastRequestOptions): Promise<SendBroadcastResponse>; | ||
| send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>; | ||
| list(options?: ListBroadcastsOptions): Promise<ListBroadcastsResponse>; | ||
| get(id: string): Promise<GetBroadcastResponse>; | ||
| remove(id: string): Promise<RemoveBroadcastResponse>; | ||
| update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>; | ||
| } | ||
@@ -1220,7 +1014,5 @@ | ||
| private readonly resend; | ||
| readonly topics: ContactTopics; | ||
| readonly segments: ContactSegments; | ||
| constructor(resend: Resend); | ||
| create(payload: CreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>; | ||
| list(options?: ListContactsOptions | ListAudienceContactsOptions): Promise<ListContactsResponse>; | ||
| list(options: ListContactsOptions): Promise<ListContactsResponse>; | ||
| get(options: GetContactOptions): Promise<GetContactResponse>; | ||
@@ -1257,12 +1049,4 @@ update(options: UpdateContactOptions): Promise<UpdateContactResponse>; | ||
| declare class Receiving { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| get(id: string): Promise<GetInboundEmailResponse>; | ||
| list(options?: ListInboundEmailsOptions): Promise<ListInboundEmailsResponse>; | ||
| } | ||
| declare class Emails { | ||
| private readonly resend; | ||
| readonly receiving: Receiving; | ||
| constructor(resend: Resend); | ||
@@ -1277,372 +1061,2 @@ send(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>; | ||
| interface CreateSegmentOptions { | ||
| name: string; | ||
| } | ||
| interface CreateSegmentRequestOptions extends PostOptions { | ||
| } | ||
| interface CreateSegmentResponseSuccess extends Pick<Segment, 'name' | 'id'> { | ||
| object: 'segment'; | ||
| } | ||
| type CreateSegmentResponse = { | ||
| data: CreateSegmentResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface GetSegmentResponseSuccess extends Pick<Segment, 'id' | 'name' | 'created_at'> { | ||
| object: 'segment'; | ||
| } | ||
| type GetSegmentResponse = { | ||
| data: GetSegmentResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| type ListSegmentsOptions = PaginationOptions; | ||
| type ListSegmentsResponseSuccess = { | ||
| object: 'list'; | ||
| data: Segment[]; | ||
| has_more: boolean; | ||
| }; | ||
| type ListSegmentsResponse = { | ||
| data: ListSegmentsResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface RemoveSegmentResponseSuccess extends Pick<Segment, 'id'> { | ||
| object: 'segment'; | ||
| deleted: boolean; | ||
| } | ||
| type RemoveSegmentResponse = { | ||
| data: RemoveSegmentResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| declare class Segments { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| create(payload: CreateSegmentOptions, options?: CreateSegmentRequestOptions): Promise<CreateSegmentResponse>; | ||
| list(options?: ListSegmentsOptions): Promise<ListSegmentsResponse>; | ||
| get(id: string): Promise<GetSegmentResponse>; | ||
| remove(id: string): Promise<RemoveSegmentResponse>; | ||
| } | ||
| interface Template { | ||
| id: string; | ||
| name: string; | ||
| subject: string | null; | ||
| html: string; | ||
| text: string | null; | ||
| status: 'draft' | 'published'; | ||
| variables: TemplateVariable[] | null; | ||
| alias: string | null; | ||
| from: string | null; | ||
| reply_to: string[] | null; | ||
| published_at: string | null; | ||
| created_at: string; | ||
| updated_at: string; | ||
| has_unpublished_versions: boolean; | ||
| current_version_id: string; | ||
| } | ||
| interface TemplateVariable { | ||
| key: string; | ||
| fallback_value: string | number | null; | ||
| type: 'string' | 'number'; | ||
| created_at: string; | ||
| updated_at: string; | ||
| } | ||
| type TemplateContentCreationOptions = RequireAtLeastOne<{ | ||
| html: string; | ||
| react: React.ReactNode; | ||
| }>; | ||
| type TemplateVariableCreationOptions = Pick<TemplateVariable, 'key' | 'type'> & ({ | ||
| type: 'string'; | ||
| fallbackValue?: string | null; | ||
| } | { | ||
| type: 'number'; | ||
| fallbackValue?: number | null; | ||
| }); | ||
| type TemplateOptionalFieldsForCreation = Partial<Pick<Template, 'subject' | 'text' | 'alias' | 'from'>> & { | ||
| replyTo?: string[] | string; | ||
| variables?: TemplateVariableCreationOptions[]; | ||
| }; | ||
| type CreateTemplateOptions = Pick<Template, 'name'> & TemplateOptionalFieldsForCreation & TemplateContentCreationOptions; | ||
| interface CreateTemplateResponseSuccess extends Pick<Template, 'id'> { | ||
| object: 'template'; | ||
| } | ||
| type CreateTemplateResponse = { | ||
| data: CreateTemplateResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface DuplicateTemplateResponseSuccess extends Pick<Template, 'id'> { | ||
| object: 'template'; | ||
| } | ||
| type DuplicateTemplateResponse = { | ||
| data: DuplicateTemplateResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface PublishTemplateResponseSuccess extends Pick<Template, 'id'> { | ||
| object: 'template'; | ||
| } | ||
| type PublishTemplateResponse = { | ||
| data: PublishTemplateResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| declare class ChainableTemplateResult<T extends CreateTemplateResponse | DuplicateTemplateResponse> implements PromiseLike<T> { | ||
| private readonly promise; | ||
| private readonly publishFn; | ||
| constructor(promise: Promise<T>, publishFn: (id: string) => Promise<PublishTemplateResponse>); | ||
| then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>; | ||
| publish(): Promise<PublishTemplateResponse>; | ||
| } | ||
| interface GetTemplateResponseSuccess extends Template { | ||
| object: 'template'; | ||
| } | ||
| type GetTemplateResponse = { | ||
| data: GetTemplateResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface TemplateListItem extends Pick<Template, 'id' | 'name' | 'created_at' | 'updated_at' | 'status' | 'published_at' | 'alias'> { | ||
| } | ||
| interface ListTemplatesResponseSuccess { | ||
| object: 'list'; | ||
| data: TemplateListItem[]; | ||
| has_more: boolean; | ||
| } | ||
| type ListTemplatesResponse = { | ||
| data: ListTemplatesResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface RemoveTemplateResponseSuccess { | ||
| object: 'template'; | ||
| id: string; | ||
| deleted: boolean; | ||
| } | ||
| type RemoveTemplateResponse = { | ||
| data: RemoveTemplateResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| type TemplateVariableUpdateOptions = Pick<TemplateVariable, 'key' | 'type'> & ({ | ||
| type: 'string'; | ||
| fallbackValue?: string | null; | ||
| } | { | ||
| type: 'number'; | ||
| fallbackValue?: number | null; | ||
| }); | ||
| interface UpdateTemplateOptions extends Partial<Pick<Template, 'name' | 'subject' | 'html' | 'text' | 'from' | 'alias'>> { | ||
| variables?: TemplateVariableUpdateOptions[]; | ||
| replyTo?: string[] | string; | ||
| } | ||
| interface UpdateTemplateResponseSuccess extends Pick<Template, 'id'> { | ||
| object: 'template'; | ||
| } | ||
| type UpdateTemplateResponse = { | ||
| data: UpdateTemplateResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| declare class Templates { | ||
| private readonly resend; | ||
| private renderAsync?; | ||
| constructor(resend: Resend); | ||
| create(payload: CreateTemplateOptions): ChainableTemplateResult<CreateTemplateResponse>; | ||
| private performCreate; | ||
| remove(identifier: string): Promise<RemoveTemplateResponse>; | ||
| get(identifier: string): Promise<GetTemplateResponse>; | ||
| list(options?: PaginationOptions): Promise<ListTemplatesResponse>; | ||
| duplicate(identifier: string): ChainableTemplateResult<DuplicateTemplateResponse>; | ||
| publish(identifier: string): Promise<PublishTemplateResponse>; | ||
| update(identifier: string, payload: UpdateTemplateOptions): Promise<UpdateTemplateResponse>; | ||
| } | ||
| interface Topic { | ||
| id: string; | ||
| name: string; | ||
| description?: string; | ||
| defaultSubscription: 'opt_in' | 'opt_out'; | ||
| created_at: string; | ||
| } | ||
| interface CreateTopicOptions { | ||
| name: string; | ||
| description?: string; | ||
| defaultSubscription: 'opt_in' | 'opt_out'; | ||
| } | ||
| type CreateTopicResponseSuccess = Pick<Topic, 'id'>; | ||
| interface CreateTopicResponse { | ||
| data: CreateTopicResponseSuccess | null; | ||
| error: ErrorResponse | null; | ||
| } | ||
| type GetTopicResponseSuccess = Topic; | ||
| interface GetTopicResponse { | ||
| data: GetTopicResponseSuccess | null; | ||
| error: ErrorResponse | null; | ||
| } | ||
| interface ListTopicsResponseSuccess { | ||
| data: Topic[]; | ||
| } | ||
| interface ListTopicsResponse { | ||
| data: ListTopicsResponseSuccess | null; | ||
| error: ErrorResponse | null; | ||
| } | ||
| type RemoveTopicResponseSuccess = Pick<Topic, 'id'> & { | ||
| object: 'topic'; | ||
| deleted: boolean; | ||
| }; | ||
| interface RemoveTopicResponse { | ||
| data: RemoveTopicResponseSuccess | null; | ||
| error: ErrorResponse | null; | ||
| } | ||
| interface UpdateTopicOptions { | ||
| id: string; | ||
| name?: string; | ||
| description?: string; | ||
| } | ||
| type UpdateTopicResponseSuccess = Pick<Topic, 'id'>; | ||
| interface UpdateTopicResponse { | ||
| data: UpdateTopicResponseSuccess | null; | ||
| error: ErrorResponse | null; | ||
| } | ||
| declare class Topics { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| create(payload: CreateTopicOptions): Promise<CreateTopicResponse>; | ||
| list(): Promise<ListTopicsResponse>; | ||
| get(id: string): Promise<GetTopicResponse>; | ||
| update(payload: UpdateTopicOptions): Promise<UpdateTopicResponse>; | ||
| remove(id: string): Promise<RemoveTopicResponse>; | ||
| } | ||
| type WebhookEvent = 'email.sent' | 'email.delivered' | 'email.delivery_delayed' | 'email.complained' | 'email.bounced' | 'email.opened' | 'email.clicked' | 'email.received' | 'email.failed' | 'contact.created' | 'contact.updated' | 'contact.deleted' | 'domain.created' | 'domain.updated' | 'domain.deleted'; | ||
| interface CreateWebhookOptions { | ||
| endpoint: string; | ||
| events: WebhookEvent[]; | ||
| } | ||
| interface CreateWebhookRequestOptions extends PostOptions { | ||
| } | ||
| interface CreateWebhookResponseSuccess { | ||
| object: 'webhook'; | ||
| id: string; | ||
| signing_secret: string; | ||
| } | ||
| type CreateWebhookResponse = { | ||
| data: CreateWebhookResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface GetWebhookResponseSuccess { | ||
| object: 'webhook'; | ||
| id: string; | ||
| created_at: string; | ||
| status: 'enabled' | 'disabled'; | ||
| endpoint: string; | ||
| events: WebhookEvent[] | null; | ||
| signing_secret: string; | ||
| } | ||
| type GetWebhookResponse = { | ||
| data: GetWebhookResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| type ListWebhooksOptions = PaginationOptions; | ||
| interface Webhook { | ||
| id: string; | ||
| endpoint: string; | ||
| created_at: string; | ||
| status: 'enabled' | 'disabled'; | ||
| events: WebhookEvent[] | null; | ||
| } | ||
| type ListWebhooksResponseSuccess = { | ||
| object: 'list'; | ||
| has_more: boolean; | ||
| data: Webhook[]; | ||
| }; | ||
| type ListWebhooksResponse = { | ||
| data: ListWebhooksResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| type RemoveWebhookResponseSuccess = Pick<Webhook, 'id'> & { | ||
| object: 'webhook'; | ||
| deleted: boolean; | ||
| }; | ||
| type RemoveWebhookResponse = { | ||
| data: RemoveWebhookResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface UpdateWebhookOptions { | ||
| endpoint?: string; | ||
| events?: WebhookEvent[]; | ||
| status?: 'enabled' | 'disabled'; | ||
| } | ||
| interface UpdateWebhookResponseSuccess { | ||
| object: 'webhook'; | ||
| id: string; | ||
| } | ||
| type UpdateWebhookResponse = { | ||
| data: UpdateWebhookResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface Headers { | ||
@@ -1673,17 +1087,9 @@ id: string; | ||
| readonly apiKeys: ApiKeys; | ||
| readonly attachments: Attachments; | ||
| readonly segments: Segments; | ||
| /** | ||
| * @deprecated Use segments instead | ||
| */ | ||
| readonly audiences: Segments; | ||
| readonly audiences: Audiences; | ||
| readonly batch: Batch; | ||
| readonly broadcasts: Broadcasts; | ||
| readonly contacts: Contacts; | ||
| readonly contactProperties: ContactProperties; | ||
| readonly domains: Domains; | ||
| readonly emails: Emails; | ||
| readonly webhooks: Webhooks; | ||
| readonly templates: Templates; | ||
| readonly topics: Topics; | ||
| constructor(key?: string | undefined); | ||
@@ -1734,2 +1140,2 @@ fetchRequest<T>(path: string, options?: {}): Promise<{ | ||
| 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 ListApiKeysOptions, type ListApiKeysResponse, type ListApiKeysResponseSuccess, type ListAttachmentsApiResponse, type ListAttachmentsOptions, type ListAttachmentsResponse, type ListAttachmentsResponseSuccess, 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 UpdateWebhookOptions, type UpdateWebhookResponse, type UpdateWebhookResponseSuccess, type VerifyDomainsResponse, type VerifyDomainsResponseSuccess, type Webhook, type WebhookEvent }; | ||
| 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 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 GetAudienceResponse, type GetAudienceResponseSuccess, type GetBroadcastResponse, type GetBroadcastResponseSuccess, type GetContactOptions, type GetContactResponse, type GetContactResponseSuccess, type GetDomainResponse, type GetDomainResponseSuccess, type GetEmailResponse, type GetEmailResponseSuccess, type GetOptions, type GetWebhookResponse, type GetWebhookResponseSuccess, 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 ListWebhooksOptions, type ListWebhooksResponse, type ListWebhooksResponseSuccess, 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 RemoveWebhookResponse, type RemoveWebhookResponseSuccess, 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 UpdateWebhookOptions, type UpdateWebhookResponse, type UpdateWebhookResponseSuccess, type VerifyDomainsResponse, type VerifyDomainsResponseSuccess, type Webhook, type WebhookEvent }; |
+140
-734
@@ -13,3 +13,2 @@ import * as React$1 from 'react'; | ||
| custom_return_path?: string; | ||
| capability?: 'send' | 'receive' | 'send-and-receive'; | ||
| } | ||
@@ -55,5 +54,5 @@ | ||
| interface EmailApiOptions { | ||
| from?: string; | ||
| from: string; | ||
| to: string | string[]; | ||
| subject?: string; | ||
| subject: string; | ||
| region?: string; | ||
@@ -66,10 +65,5 @@ headers?: Record<string, string>; | ||
| reply_to?: string | string[]; | ||
| topic_id?: string | null; | ||
| scheduled_at?: string; | ||
| tags?: Tag$1[]; | ||
| attachments?: EmailApiAttachment[]; | ||
| template?: { | ||
| id: string; | ||
| variables?: Record<string, string | number | boolean>; | ||
| }; | ||
| } | ||
@@ -91,2 +85,7 @@ | ||
| interface List<T> { | ||
| readonly object: 'list'; | ||
| data: T[]; | ||
| } | ||
| type PaginationOptions = { | ||
@@ -110,7 +109,2 @@ /** | ||
| }); | ||
| type PaginatedData<Data> = { | ||
| object: 'list'; | ||
| data: Data; | ||
| has_more: boolean; | ||
| }; | ||
@@ -184,22 +178,18 @@ interface PatchOptions { | ||
| interface Attachment$1 { | ||
| interface Audience { | ||
| created_at: string; | ||
| id: string; | ||
| filename?: string; | ||
| size: number; | ||
| content_type: string; | ||
| content_disposition: 'inline' | 'attachment'; | ||
| content_id?: string; | ||
| download_url: string; | ||
| expires_at: string; | ||
| name: string; | ||
| } | ||
| interface GetAttachmentOptions { | ||
| emailId: string; | ||
| id: string; | ||
| interface CreateAudienceOptions { | ||
| name: string; | ||
| } | ||
| type GetAttachmentResponseSuccess = { | ||
| object: 'attachment'; | ||
| } & Attachment$1; | ||
| type GetAttachmentResponse = { | ||
| data: GetAttachmentResponseSuccess; | ||
| interface CreateAudienceRequestOptions extends PostOptions { | ||
| } | ||
| interface CreateAudienceResponseSuccess extends Pick<Audience, 'name' | 'id'> { | ||
| object: 'audience'; | ||
| } | ||
| type CreateAudienceResponse = { | ||
| data: CreateAudienceResponseSuccess; | ||
| error: null; | ||
@@ -211,17 +201,33 @@ } | { | ||
| type ListAttachmentsOptions = PaginationOptions & { | ||
| emailId: string; | ||
| interface GetAudienceResponseSuccess extends Pick<Audience, 'id' | 'name' | 'created_at'> { | ||
| object: 'audience'; | ||
| } | ||
| type GetAudienceResponse = { | ||
| data: GetAudienceResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface ListAttachmentsApiResponse { | ||
| type ListAudiencesOptions = PaginationOptions; | ||
| type ListAudiencesResponseSuccess = { | ||
| object: 'list'; | ||
| data: Audience[]; | ||
| has_more: boolean; | ||
| data: Attachment$1[]; | ||
| }; | ||
| type ListAudiencesResponse = { | ||
| data: ListAudiencesResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface RemoveAudiencesResponseSuccess extends Pick<Audience, 'id'> { | ||
| object: 'audience'; | ||
| deleted: boolean; | ||
| } | ||
| interface ListAttachmentsResponseSuccess { | ||
| object: 'list'; | ||
| has_more: boolean; | ||
| data: Attachment$1[]; | ||
| } | ||
| type ListAttachmentsResponse = { | ||
| data: ListAttachmentsResponseSuccess; | ||
| type RemoveAudiencesResponse = { | ||
| data: RemoveAudiencesResponseSuccess; | ||
| error: null; | ||
@@ -253,12 +259,2 @@ } | { | ||
| } | ||
| interface EmailTemplateOptions { | ||
| template: { | ||
| id: string; | ||
| variables?: Record<string, string | number | boolean>; | ||
| }; | ||
| } | ||
| interface CreateEmailBaseOptionsWithTemplate extends Omit<CreateEmailBaseOptions, 'from' | 'subject'> { | ||
| from?: string; | ||
| subject?: string; | ||
| } | ||
| interface CreateEmailBaseOptions { | ||
@@ -320,8 +316,2 @@ /** | ||
| /** | ||
| * The id of the topic you want to send to | ||
| * | ||
| * @link https://resend.com/docs/api-reference/emails/send-email#body-parameters | ||
| */ | ||
| topicId?: string | null; | ||
| /** | ||
| * Schedule email to be sent later. | ||
@@ -334,9 +324,3 @@ * The date should be in ISO 8601 format (e.g: 2024-08-05T11:52:01.858Z). | ||
| } | ||
| type CreateEmailOptions = ((RequireAtLeastOne<EmailRenderOptions$1> & CreateEmailBaseOptions) & { | ||
| template?: never; | ||
| }) | ((EmailTemplateOptions & CreateEmailBaseOptionsWithTemplate) & { | ||
| react?: never; | ||
| html?: never; | ||
| text?: never; | ||
| }); | ||
| type CreateEmailOptions = RequireAtLeastOne<EmailRenderOptions$1> & CreateEmailBaseOptions; | ||
| interface CreateEmailRequestOptions extends PostOptions, IdempotentRequest { | ||
@@ -419,3 +403,2 @@ } | ||
| name: string; | ||
| segment_id: string | null; | ||
| audience_id: string | null; | ||
@@ -430,3 +413,2 @@ from: string | null; | ||
| sent_at: string | null; | ||
| topic_id?: string | null; | ||
| html: string | null; | ||
@@ -456,21 +438,15 @@ text: string | null; | ||
| } | ||
| interface SegmentOptions { | ||
| interface CreateBroadcastBaseOptions { | ||
| /** | ||
| * The id of the segment you want to send to | ||
| * The name of the broadcast | ||
| * | ||
| * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters | ||
| */ | ||
| segmentId: string; | ||
| name?: string; | ||
| /** | ||
| * @deprecated Use segmentId instead | ||
| */ | ||
| audienceId: string; | ||
| } | ||
| interface CreateBroadcastBaseOptions { | ||
| /** | ||
| * The name of the broadcast | ||
| * The id of the audience you want to send to | ||
| * | ||
| * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters | ||
| */ | ||
| name?: string; | ||
| audienceId: string; | ||
| /** | ||
@@ -500,10 +476,4 @@ * A short snippet of text displayed as a preview in recipients' inboxes, often shown below or beside the subject line. | ||
| subject: string; | ||
| /** | ||
| * The id of the topic you want to send to | ||
| * | ||
| * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters | ||
| */ | ||
| topicId?: string | null; | ||
| } | ||
| type CreateBroadcastOptions = RequireAtLeastOne<EmailRenderOptions> & RequireAtLeastOne<SegmentOptions> & CreateBroadcastBaseOptions; | ||
| type CreateBroadcastOptions = RequireAtLeastOne<EmailRenderOptions> & CreateBroadcastBaseOptions; | ||
| interface CreateBroadcastRequestOptions extends PostOptions { | ||
@@ -538,3 +508,3 @@ } | ||
| has_more: boolean; | ||
| data: Pick<Broadcast, 'id' | 'name' | 'audience_id' | 'segment_id' | 'status' | 'created_at' | 'scheduled_at' | 'sent_at'>[]; | ||
| data: Pick<Broadcast, 'id' | 'name' | 'audience_id' | 'status' | 'created_at' | 'scheduled_at' | 'sent_at'>[]; | ||
| }; | ||
@@ -591,6 +561,2 @@ type ListBroadcastsResponse = { | ||
| name?: string; | ||
| segmentId?: string; | ||
| /** | ||
| * @deprecated Use segmentId instead | ||
| */ | ||
| audienceId?: string; | ||
@@ -604,3 +570,2 @@ from?: string; | ||
| previewText?: string; | ||
| topicId?: string | null; | ||
| }; | ||
@@ -652,3 +617,3 @@ type UpdateBroadcastResponse = { | ||
| interface CreateContactOptions { | ||
| audienceId?: string; | ||
| audienceId: string; | ||
| email: string; | ||
@@ -672,5 +637,5 @@ unsubscribed?: boolean; | ||
| type GetContactOptions = string | ({ | ||
| audienceId?: string; | ||
| } & SelectingField); | ||
| type GetContactOptions = { | ||
| audienceId: string; | ||
| } & SelectingField; | ||
| interface GetContactResponseSuccess extends Pick<Contact, 'id' | 'email' | 'created_at' | 'first_name' | 'last_name' | 'unsubscribed'> { | ||
@@ -687,8 +652,5 @@ object: 'contact'; | ||
| type ListAudienceContactsOptions = { | ||
| type ListContactsOptions = { | ||
| audienceId: string; | ||
| } & PaginationOptions; | ||
| type ListContactsOptions = PaginationOptions & { | ||
| audienceId?: string; | ||
| }; | ||
| interface ListContactsResponseSuccess { | ||
@@ -712,5 +674,5 @@ object: 'list'; | ||
| }; | ||
| type RemoveContactOptions = string | (SelectingField & { | ||
| audienceId?: string; | ||
| }); | ||
| type RemoveContactOptions = SelectingField & { | ||
| audienceId: string; | ||
| }; | ||
| type RemoveContactsResponse = { | ||
@@ -725,3 +687,3 @@ data: RemoveContactsResponseSuccess; | ||
| type UpdateContactOptions = { | ||
| audienceId?: string; | ||
| audienceId: string; | ||
| unsubscribed?: boolean; | ||
@@ -745,3 +707,3 @@ firstName?: string; | ||
| type DomainStatus = 'pending' | 'verified' | 'failed' | 'temporary_failure' | 'not_started'; | ||
| type DomainRecords = DomainSpfRecord | DomainDkimRecord | ReceivingRecord; | ||
| type DomainRecords = DomainSpfRecord | DomainDkimRecord; | ||
| interface DomainSpfRecord { | ||
@@ -769,11 +731,2 @@ record: 'SPF'; | ||
| } | ||
| interface ReceivingRecord { | ||
| record: 'Receiving'; | ||
| name: string; | ||
| value: string; | ||
| type: 'MX'; | ||
| ttl: string; | ||
| status: DomainStatus; | ||
| priority: number; | ||
| } | ||
| interface Domain { | ||
@@ -785,3 +738,2 @@ id: string; | ||
| region: DomainRegion; | ||
| capability: 'send' | 'receive' | 'send-and-receive'; | ||
| } | ||
@@ -793,7 +745,6 @@ | ||
| customReturnPath?: string; | ||
| capability?: 'send' | 'receive' | 'send-and-receive'; | ||
| } | ||
| interface CreateDomainRequestOptions extends PostOptions { | ||
| } | ||
| interface CreateDomainResponseSuccess extends Pick<Domain, 'name' | 'id' | 'status' | 'created_at' | 'region' | 'capability'> { | ||
| interface CreateDomainResponseSuccess extends Pick<Domain, 'name' | 'id' | 'status' | 'created_at' | 'region'> { | ||
| records: DomainRecords[]; | ||
@@ -809,3 +760,3 @@ } | ||
| interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status' | 'capability'> { | ||
| interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status'> { | ||
| object: 'domain'; | ||
@@ -904,3 +855,2 @@ records: DomainRecords[]; | ||
| to: string[]; | ||
| topic_id?: string | null; | ||
| scheduled_at: string | null; | ||
@@ -933,27 +883,17 @@ object: 'email'; | ||
| interface GetInboundEmailResponseSuccess { | ||
| object: 'inbound'; | ||
| type WebhookEvent = 'email.sent' | 'email.delivered' | 'email.delivery_delayed' | 'email.complained' | 'email.bounced' | 'email.opened' | 'email.clicked' | 'email.received' | 'email.failed' | 'contact.created' | 'contact.updated' | 'contact.deleted' | 'domain.created' | 'domain.updated' | 'domain.deleted'; | ||
| interface CreateWebhookOptions { | ||
| endpoint: string; | ||
| events: WebhookEvent[]; | ||
| } | ||
| interface CreateWebhookRequestOptions extends PostOptions { | ||
| } | ||
| interface CreateWebhookResponseSuccess { | ||
| object: 'webhook'; | ||
| id: string; | ||
| to: string[]; | ||
| from: string; | ||
| created_at: string; | ||
| subject: string; | ||
| bcc: string[] | null; | ||
| cc: string[] | null; | ||
| reply_to: string[] | null; | ||
| html: string | null; | ||
| text: string | null; | ||
| headers: Record<string, string>; | ||
| message_id: string; | ||
| attachments: Array<{ | ||
| id: string; | ||
| filename: string; | ||
| size: number; | ||
| content_type: string; | ||
| content_id: string; | ||
| content_disposition: string; | ||
| }>; | ||
| signing_secret: string; | ||
| } | ||
| type GetInboundEmailResponse = { | ||
| data: GetInboundEmailResponseSuccess; | ||
| type CreateWebhookResponse = { | ||
| data: CreateWebhookResponseSuccess; | ||
| error: null; | ||
@@ -965,11 +905,13 @@ } | { | ||
| type ListInboundEmailsOptions = PaginationOptions; | ||
| type ListInboundEmail = Omit<GetInboundEmailResponseSuccess, 'html' | 'text' | 'headers' | 'object'>; | ||
| interface ListInboundEmailsResponseSuccess { | ||
| object: 'list'; | ||
| has_more: boolean; | ||
| data: ListInboundEmail[]; | ||
| interface GetWebhookResponseSuccess { | ||
| object: 'webhook'; | ||
| id: string; | ||
| created_at: string; | ||
| status: 'enabled' | 'disabled'; | ||
| endpoint: string; | ||
| events: WebhookEvent[] | null; | ||
| signing_secret: string; | ||
| } | ||
| type ListInboundEmailsResponse = { | ||
| data: ListInboundEmailsResponseSuccess; | ||
| type GetWebhookResponse = { | ||
| data: GetWebhookResponseSuccess; | ||
| error: null; | ||
@@ -981,90 +923,17 @@ } | { | ||
| declare class ApiKeys { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| create(payload: CreateApiKeyOptions, options?: CreateApiKeyRequestOptions): Promise<CreateApiKeyResponse>; | ||
| list(options?: ListApiKeysOptions): Promise<ListApiKeysResponse>; | ||
| remove(id: string): Promise<RemoveApiKeyResponse>; | ||
| } | ||
| declare class Receiving$1 { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| get(options: GetAttachmentOptions): Promise<GetAttachmentResponse>; | ||
| list(options: ListAttachmentsOptions): Promise<ListAttachmentsResponse>; | ||
| } | ||
| declare class Sending { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| get(options: GetAttachmentOptions): Promise<GetAttachmentResponse>; | ||
| list(options: ListAttachmentsOptions): Promise<ListAttachmentsResponse>; | ||
| } | ||
| declare class Attachments { | ||
| readonly receiving: Receiving$1; | ||
| readonly sending: Sending; | ||
| constructor(resend: Resend); | ||
| } | ||
| declare class Batch { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| send<Options extends CreateBatchRequestOptions>(payload: CreateBatchOptions, options?: Options): Promise<CreateBatchResponse<Options>>; | ||
| create<Options extends CreateBatchRequestOptions>(payload: CreateBatchOptions, options?: Options): Promise<CreateBatchResponse<Options>>; | ||
| } | ||
| declare class Broadcasts { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| create(payload: CreateBroadcastOptions, options?: CreateBroadcastRequestOptions): Promise<SendBroadcastResponse>; | ||
| send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>; | ||
| list(options?: ListBroadcastsOptions): Promise<ListBroadcastsResponse>; | ||
| get(id: string): Promise<GetBroadcastResponse>; | ||
| remove(id: string): Promise<RemoveBroadcastResponse>; | ||
| update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>; | ||
| } | ||
| type StringBaseContactProperty = { | ||
| type: 'string'; | ||
| fallbackValue: string | null; | ||
| }; | ||
| type NumberBaseContactProperty = { | ||
| type: 'number'; | ||
| fallbackValue: number | null; | ||
| }; | ||
| type ContactProperty = { | ||
| type ListWebhooksOptions = PaginationOptions; | ||
| interface Webhook { | ||
| id: string; | ||
| object: 'contact_property'; | ||
| createdAt: string; | ||
| key: string; | ||
| } & (StringBaseContactProperty | NumberBaseContactProperty); | ||
| type StringBaseContactPropertyOptions = { | ||
| type: 'string'; | ||
| fallbackValue?: string | null; | ||
| }; | ||
| type NumberBaseContactPropertyOptions = { | ||
| type: 'number'; | ||
| fallbackValue?: number | null; | ||
| }; | ||
| type CreateContactPropertyOptions = { | ||
| key: string; | ||
| } & (StringBaseContactPropertyOptions | NumberBaseContactPropertyOptions); | ||
| type CreateContactPropertyResponseSuccess = Pick<ContactProperty, 'id' | 'object'>; | ||
| interface CreateContactPropertyResponse { | ||
| data: CreateContactPropertyResponseSuccess | null; | ||
| error: ErrorResponse | null; | ||
| endpoint: string; | ||
| created_at: string; | ||
| status: 'enabled' | 'disabled'; | ||
| events: WebhookEvent[] | null; | ||
| } | ||
| type RemoveContactPropertyResponseSuccess = Pick<ContactProperty, 'id' | 'object'> & { | ||
| deleted: boolean; | ||
| type ListWebhooksResponseSuccess = { | ||
| object: 'list'; | ||
| has_more: boolean; | ||
| data: Webhook[]; | ||
| }; | ||
| interface RemoveContactPropertyResponse { | ||
| data: RemoveContactPropertyResponseSuccess | null; | ||
| error: ErrorResponse | null; | ||
| } | ||
| type GetContactPropertyResponse = { | ||
| data: ContactProperty; | ||
| type ListWebhooksResponse = { | ||
| data: ListWebhooksResponseSuccess; | ||
| error: null; | ||
@@ -1076,51 +945,8 @@ } | { | ||
| type ListContactPropertiesOptions = PaginationOptions; | ||
| type ListContactPropertiesResponse = { | ||
| data: { | ||
| object: 'list'; | ||
| has_more: boolean; | ||
| data: ContactProperty[]; | ||
| }; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| type RemoveWebhookResponseSuccess = Pick<Webhook, 'id'> & { | ||
| object: 'webhook'; | ||
| deleted: boolean; | ||
| }; | ||
| type UpdateContactPropertyOptions = { | ||
| id: string; | ||
| fallbackValue?: string | number | null; | ||
| }; | ||
| type UpdateContactPropertyResponseSuccess = Pick<ContactProperty, 'id' | 'object'>; | ||
| interface UpdateContactPropertyResponse { | ||
| data: UpdateContactPropertyResponseSuccess | null; | ||
| error: ErrorResponse | null; | ||
| } | ||
| declare class ContactProperties { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| create(options: CreateContactPropertyOptions): Promise<CreateContactPropertyResponse>; | ||
| list(options?: ListContactPropertiesOptions): Promise<ListContactPropertiesResponse>; | ||
| get(id: string): Promise<GetContactPropertyResponse>; | ||
| update(payload: UpdateContactPropertyOptions): Promise<UpdateContactPropertyResponse>; | ||
| remove(id: string): Promise<RemoveContactPropertyResponse>; | ||
| } | ||
| type ContactSegmentsBaseOptions = { | ||
| contactId: string; | ||
| email?: never; | ||
| } | { | ||
| contactId?: never; | ||
| email: string; | ||
| }; | ||
| type AddContactSegmentOptions = ContactSegmentsBaseOptions & { | ||
| segmentId: string; | ||
| }; | ||
| interface AddContactSegmentResponseSuccess { | ||
| id: string; | ||
| } | ||
| type AddContactSegmentResponse = { | ||
| data: AddContactSegmentResponseSuccess; | ||
| type RemoveWebhookResponse = { | ||
| data: RemoveWebhookResponseSuccess; | ||
| error: null; | ||
@@ -1132,27 +958,13 @@ } | { | ||
| interface Segment { | ||
| created_at: string; | ||
| id: string; | ||
| name: string; | ||
| interface UpdateWebhookOptions { | ||
| endpoint?: string; | ||
| events?: WebhookEvent[]; | ||
| status?: 'enabled' | 'disabled'; | ||
| } | ||
| type ListContactSegmentsOptions = PaginationOptions & ContactSegmentsBaseOptions; | ||
| type ListContactSegmentsResponseSuccess = PaginatedData<Segment[]>; | ||
| type ListContactSegmentsResponse = { | ||
| data: ListContactSegmentsResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| type RemoveContactSegmentOptions = ContactSegmentsBaseOptions & { | ||
| segmentId: string; | ||
| }; | ||
| interface RemoveContactSegmentResponseSuccess { | ||
| interface UpdateWebhookResponseSuccess { | ||
| object: 'webhook'; | ||
| id: string; | ||
| deleted: boolean; | ||
| } | ||
| type RemoveContactSegmentResponse = { | ||
| data: RemoveContactSegmentResponseSuccess; | ||
| type UpdateWebhookResponse = { | ||
| data: UpdateWebhookResponseSuccess; | ||
| error: null; | ||
@@ -1164,53 +976,35 @@ } | { | ||
| declare class ContactSegments { | ||
| declare class ApiKeys { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| list(options: ListContactSegmentsOptions): Promise<ListContactSegmentsResponse>; | ||
| add(options: AddContactSegmentOptions): Promise<AddContactSegmentResponse>; | ||
| remove(options: RemoveContactSegmentOptions): Promise<RemoveContactSegmentResponse>; | ||
| create(payload: CreateApiKeyOptions, options?: CreateApiKeyRequestOptions): Promise<CreateApiKeyResponse>; | ||
| list(options?: ListApiKeysOptions): Promise<ListApiKeysResponse>; | ||
| remove(id: string): Promise<RemoveApiKeyResponse>; | ||
| } | ||
| interface ListContactTopicsBaseOptions { | ||
| id?: string; | ||
| email?: string; | ||
| declare class Audiences { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| create(payload: CreateAudienceOptions, options?: CreateAudienceRequestOptions): Promise<CreateAudienceResponse>; | ||
| list(options?: ListAudiencesOptions): Promise<ListAudiencesResponse>; | ||
| get(id: string): Promise<GetAudienceResponse>; | ||
| remove(id: string): Promise<RemoveAudiencesResponse>; | ||
| } | ||
| type ListContactTopicsOptions = ListContactTopicsBaseOptions & PaginationOptions; | ||
| interface ContactTopic { | ||
| id: string; | ||
| name: string; | ||
| description: string | null; | ||
| subscription: 'opt_in' | 'opt_out'; | ||
| } | ||
| type ListContactTopicsResponseSuccess = PaginatedData<ContactTopic[]>; | ||
| type ListContactTopicsResponse = { | ||
| data: ListContactTopicsResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface UpdateContactTopicsBaseOptions { | ||
| id?: string; | ||
| email?: string; | ||
| declare class Batch { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| send<Options extends CreateBatchRequestOptions>(payload: CreateBatchOptions, options?: Options): Promise<CreateBatchResponse<Options>>; | ||
| create<Options extends CreateBatchRequestOptions>(payload: CreateBatchOptions, options?: Options): Promise<CreateBatchResponse<Options>>; | ||
| } | ||
| interface UpdateContactTopicsOptions extends UpdateContactTopicsBaseOptions { | ||
| topics: { | ||
| id: string; | ||
| subscription: 'opt_in' | 'opt_out'; | ||
| }[]; | ||
| } | ||
| interface UpdateContactTopicsResponseSuccess { | ||
| id: string; | ||
| } | ||
| interface UpdateContactTopicsResponse { | ||
| data: UpdateContactTopicsResponseSuccess | null; | ||
| error: ErrorResponse | null; | ||
| } | ||
| declare class ContactTopics { | ||
| declare class Broadcasts { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| update(payload: UpdateContactTopicsOptions): Promise<UpdateContactTopicsResponse>; | ||
| list(options: ListContactTopicsOptions): Promise<ListContactTopicsResponse>; | ||
| create(payload: CreateBroadcastOptions, options?: CreateBroadcastRequestOptions): Promise<SendBroadcastResponse>; | ||
| send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>; | ||
| list(options?: ListBroadcastsOptions): Promise<ListBroadcastsResponse>; | ||
| get(id: string): Promise<GetBroadcastResponse>; | ||
| remove(id: string): Promise<RemoveBroadcastResponse>; | ||
| update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>; | ||
| } | ||
@@ -1220,7 +1014,5 @@ | ||
| private readonly resend; | ||
| readonly topics: ContactTopics; | ||
| readonly segments: ContactSegments; | ||
| constructor(resend: Resend); | ||
| create(payload: CreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>; | ||
| list(options?: ListContactsOptions | ListAudienceContactsOptions): Promise<ListContactsResponse>; | ||
| list(options: ListContactsOptions): Promise<ListContactsResponse>; | ||
| get(options: GetContactOptions): Promise<GetContactResponse>; | ||
@@ -1257,12 +1049,4 @@ update(options: UpdateContactOptions): Promise<UpdateContactResponse>; | ||
| declare class Receiving { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| get(id: string): Promise<GetInboundEmailResponse>; | ||
| list(options?: ListInboundEmailsOptions): Promise<ListInboundEmailsResponse>; | ||
| } | ||
| declare class Emails { | ||
| private readonly resend; | ||
| readonly receiving: Receiving; | ||
| constructor(resend: Resend); | ||
@@ -1277,372 +1061,2 @@ send(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>; | ||
| interface CreateSegmentOptions { | ||
| name: string; | ||
| } | ||
| interface CreateSegmentRequestOptions extends PostOptions { | ||
| } | ||
| interface CreateSegmentResponseSuccess extends Pick<Segment, 'name' | 'id'> { | ||
| object: 'segment'; | ||
| } | ||
| type CreateSegmentResponse = { | ||
| data: CreateSegmentResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface GetSegmentResponseSuccess extends Pick<Segment, 'id' | 'name' | 'created_at'> { | ||
| object: 'segment'; | ||
| } | ||
| type GetSegmentResponse = { | ||
| data: GetSegmentResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| type ListSegmentsOptions = PaginationOptions; | ||
| type ListSegmentsResponseSuccess = { | ||
| object: 'list'; | ||
| data: Segment[]; | ||
| has_more: boolean; | ||
| }; | ||
| type ListSegmentsResponse = { | ||
| data: ListSegmentsResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface RemoveSegmentResponseSuccess extends Pick<Segment, 'id'> { | ||
| object: 'segment'; | ||
| deleted: boolean; | ||
| } | ||
| type RemoveSegmentResponse = { | ||
| data: RemoveSegmentResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| declare class Segments { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| create(payload: CreateSegmentOptions, options?: CreateSegmentRequestOptions): Promise<CreateSegmentResponse>; | ||
| list(options?: ListSegmentsOptions): Promise<ListSegmentsResponse>; | ||
| get(id: string): Promise<GetSegmentResponse>; | ||
| remove(id: string): Promise<RemoveSegmentResponse>; | ||
| } | ||
| interface Template { | ||
| id: string; | ||
| name: string; | ||
| subject: string | null; | ||
| html: string; | ||
| text: string | null; | ||
| status: 'draft' | 'published'; | ||
| variables: TemplateVariable[] | null; | ||
| alias: string | null; | ||
| from: string | null; | ||
| reply_to: string[] | null; | ||
| published_at: string | null; | ||
| created_at: string; | ||
| updated_at: string; | ||
| has_unpublished_versions: boolean; | ||
| current_version_id: string; | ||
| } | ||
| interface TemplateVariable { | ||
| key: string; | ||
| fallback_value: string | number | null; | ||
| type: 'string' | 'number'; | ||
| created_at: string; | ||
| updated_at: string; | ||
| } | ||
| type TemplateContentCreationOptions = RequireAtLeastOne<{ | ||
| html: string; | ||
| react: React.ReactNode; | ||
| }>; | ||
| type TemplateVariableCreationOptions = Pick<TemplateVariable, 'key' | 'type'> & ({ | ||
| type: 'string'; | ||
| fallbackValue?: string | null; | ||
| } | { | ||
| type: 'number'; | ||
| fallbackValue?: number | null; | ||
| }); | ||
| type TemplateOptionalFieldsForCreation = Partial<Pick<Template, 'subject' | 'text' | 'alias' | 'from'>> & { | ||
| replyTo?: string[] | string; | ||
| variables?: TemplateVariableCreationOptions[]; | ||
| }; | ||
| type CreateTemplateOptions = Pick<Template, 'name'> & TemplateOptionalFieldsForCreation & TemplateContentCreationOptions; | ||
| interface CreateTemplateResponseSuccess extends Pick<Template, 'id'> { | ||
| object: 'template'; | ||
| } | ||
| type CreateTemplateResponse = { | ||
| data: CreateTemplateResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface DuplicateTemplateResponseSuccess extends Pick<Template, 'id'> { | ||
| object: 'template'; | ||
| } | ||
| type DuplicateTemplateResponse = { | ||
| data: DuplicateTemplateResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface PublishTemplateResponseSuccess extends Pick<Template, 'id'> { | ||
| object: 'template'; | ||
| } | ||
| type PublishTemplateResponse = { | ||
| data: PublishTemplateResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| declare class ChainableTemplateResult<T extends CreateTemplateResponse | DuplicateTemplateResponse> implements PromiseLike<T> { | ||
| private readonly promise; | ||
| private readonly publishFn; | ||
| constructor(promise: Promise<T>, publishFn: (id: string) => Promise<PublishTemplateResponse>); | ||
| then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>; | ||
| publish(): Promise<PublishTemplateResponse>; | ||
| } | ||
| interface GetTemplateResponseSuccess extends Template { | ||
| object: 'template'; | ||
| } | ||
| type GetTemplateResponse = { | ||
| data: GetTemplateResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface TemplateListItem extends Pick<Template, 'id' | 'name' | 'created_at' | 'updated_at' | 'status' | 'published_at' | 'alias'> { | ||
| } | ||
| interface ListTemplatesResponseSuccess { | ||
| object: 'list'; | ||
| data: TemplateListItem[]; | ||
| has_more: boolean; | ||
| } | ||
| type ListTemplatesResponse = { | ||
| data: ListTemplatesResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface RemoveTemplateResponseSuccess { | ||
| object: 'template'; | ||
| id: string; | ||
| deleted: boolean; | ||
| } | ||
| type RemoveTemplateResponse = { | ||
| data: RemoveTemplateResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| type TemplateVariableUpdateOptions = Pick<TemplateVariable, 'key' | 'type'> & ({ | ||
| type: 'string'; | ||
| fallbackValue?: string | null; | ||
| } | { | ||
| type: 'number'; | ||
| fallbackValue?: number | null; | ||
| }); | ||
| interface UpdateTemplateOptions extends Partial<Pick<Template, 'name' | 'subject' | 'html' | 'text' | 'from' | 'alias'>> { | ||
| variables?: TemplateVariableUpdateOptions[]; | ||
| replyTo?: string[] | string; | ||
| } | ||
| interface UpdateTemplateResponseSuccess extends Pick<Template, 'id'> { | ||
| object: 'template'; | ||
| } | ||
| type UpdateTemplateResponse = { | ||
| data: UpdateTemplateResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| declare class Templates { | ||
| private readonly resend; | ||
| private renderAsync?; | ||
| constructor(resend: Resend); | ||
| create(payload: CreateTemplateOptions): ChainableTemplateResult<CreateTemplateResponse>; | ||
| private performCreate; | ||
| remove(identifier: string): Promise<RemoveTemplateResponse>; | ||
| get(identifier: string): Promise<GetTemplateResponse>; | ||
| list(options?: PaginationOptions): Promise<ListTemplatesResponse>; | ||
| duplicate(identifier: string): ChainableTemplateResult<DuplicateTemplateResponse>; | ||
| publish(identifier: string): Promise<PublishTemplateResponse>; | ||
| update(identifier: string, payload: UpdateTemplateOptions): Promise<UpdateTemplateResponse>; | ||
| } | ||
| interface Topic { | ||
| id: string; | ||
| name: string; | ||
| description?: string; | ||
| defaultSubscription: 'opt_in' | 'opt_out'; | ||
| created_at: string; | ||
| } | ||
| interface CreateTopicOptions { | ||
| name: string; | ||
| description?: string; | ||
| defaultSubscription: 'opt_in' | 'opt_out'; | ||
| } | ||
| type CreateTopicResponseSuccess = Pick<Topic, 'id'>; | ||
| interface CreateTopicResponse { | ||
| data: CreateTopicResponseSuccess | null; | ||
| error: ErrorResponse | null; | ||
| } | ||
| type GetTopicResponseSuccess = Topic; | ||
| interface GetTopicResponse { | ||
| data: GetTopicResponseSuccess | null; | ||
| error: ErrorResponse | null; | ||
| } | ||
| interface ListTopicsResponseSuccess { | ||
| data: Topic[]; | ||
| } | ||
| interface ListTopicsResponse { | ||
| data: ListTopicsResponseSuccess | null; | ||
| error: ErrorResponse | null; | ||
| } | ||
| type RemoveTopicResponseSuccess = Pick<Topic, 'id'> & { | ||
| object: 'topic'; | ||
| deleted: boolean; | ||
| }; | ||
| interface RemoveTopicResponse { | ||
| data: RemoveTopicResponseSuccess | null; | ||
| error: ErrorResponse | null; | ||
| } | ||
| interface UpdateTopicOptions { | ||
| id: string; | ||
| name?: string; | ||
| description?: string; | ||
| } | ||
| type UpdateTopicResponseSuccess = Pick<Topic, 'id'>; | ||
| interface UpdateTopicResponse { | ||
| data: UpdateTopicResponseSuccess | null; | ||
| error: ErrorResponse | null; | ||
| } | ||
| declare class Topics { | ||
| private readonly resend; | ||
| constructor(resend: Resend); | ||
| create(payload: CreateTopicOptions): Promise<CreateTopicResponse>; | ||
| list(): Promise<ListTopicsResponse>; | ||
| get(id: string): Promise<GetTopicResponse>; | ||
| update(payload: UpdateTopicOptions): Promise<UpdateTopicResponse>; | ||
| remove(id: string): Promise<RemoveTopicResponse>; | ||
| } | ||
| type WebhookEvent = 'email.sent' | 'email.delivered' | 'email.delivery_delayed' | 'email.complained' | 'email.bounced' | 'email.opened' | 'email.clicked' | 'email.received' | 'email.failed' | 'contact.created' | 'contact.updated' | 'contact.deleted' | 'domain.created' | 'domain.updated' | 'domain.deleted'; | ||
| interface CreateWebhookOptions { | ||
| endpoint: string; | ||
| events: WebhookEvent[]; | ||
| } | ||
| interface CreateWebhookRequestOptions extends PostOptions { | ||
| } | ||
| interface CreateWebhookResponseSuccess { | ||
| object: 'webhook'; | ||
| id: string; | ||
| signing_secret: string; | ||
| } | ||
| type CreateWebhookResponse = { | ||
| data: CreateWebhookResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface GetWebhookResponseSuccess { | ||
| object: 'webhook'; | ||
| id: string; | ||
| created_at: string; | ||
| status: 'enabled' | 'disabled'; | ||
| endpoint: string; | ||
| events: WebhookEvent[] | null; | ||
| signing_secret: string; | ||
| } | ||
| type GetWebhookResponse = { | ||
| data: GetWebhookResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| type ListWebhooksOptions = PaginationOptions; | ||
| interface Webhook { | ||
| id: string; | ||
| endpoint: string; | ||
| created_at: string; | ||
| status: 'enabled' | 'disabled'; | ||
| events: WebhookEvent[] | null; | ||
| } | ||
| type ListWebhooksResponseSuccess = { | ||
| object: 'list'; | ||
| has_more: boolean; | ||
| data: Webhook[]; | ||
| }; | ||
| type ListWebhooksResponse = { | ||
| data: ListWebhooksResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| type RemoveWebhookResponseSuccess = Pick<Webhook, 'id'> & { | ||
| object: 'webhook'; | ||
| deleted: boolean; | ||
| }; | ||
| type RemoveWebhookResponse = { | ||
| data: RemoveWebhookResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface UpdateWebhookOptions { | ||
| endpoint?: string; | ||
| events?: WebhookEvent[]; | ||
| status?: 'enabled' | 'disabled'; | ||
| } | ||
| interface UpdateWebhookResponseSuccess { | ||
| object: 'webhook'; | ||
| id: string; | ||
| } | ||
| type UpdateWebhookResponse = { | ||
| data: UpdateWebhookResponseSuccess; | ||
| error: null; | ||
| } | { | ||
| data: null; | ||
| error: ErrorResponse; | ||
| }; | ||
| interface Headers { | ||
@@ -1673,17 +1087,9 @@ id: string; | ||
| readonly apiKeys: ApiKeys; | ||
| readonly attachments: Attachments; | ||
| readonly segments: Segments; | ||
| /** | ||
| * @deprecated Use segments instead | ||
| */ | ||
| readonly audiences: Segments; | ||
| readonly audiences: Audiences; | ||
| readonly batch: Batch; | ||
| readonly broadcasts: Broadcasts; | ||
| readonly contacts: Contacts; | ||
| readonly contactProperties: ContactProperties; | ||
| readonly domains: Domains; | ||
| readonly emails: Emails; | ||
| readonly webhooks: Webhooks; | ||
| readonly templates: Templates; | ||
| readonly topics: Topics; | ||
| constructor(key?: string | undefined); | ||
@@ -1734,2 +1140,2 @@ fetchRequest<T>(path: string, options?: {}): Promise<{ | ||
| 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 ListApiKeysOptions, type ListApiKeysResponse, type ListApiKeysResponseSuccess, type ListAttachmentsApiResponse, type ListAttachmentsOptions, type ListAttachmentsResponse, type ListAttachmentsResponseSuccess, 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 UpdateWebhookOptions, type UpdateWebhookResponse, type UpdateWebhookResponseSuccess, type VerifyDomainsResponse, type VerifyDomainsResponseSuccess, type Webhook, type WebhookEvent }; | ||
| 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 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 GetAudienceResponse, type GetAudienceResponseSuccess, type GetBroadcastResponse, type GetBroadcastResponseSuccess, type GetContactOptions, type GetContactResponse, type GetContactResponseSuccess, type GetDomainResponse, type GetDomainResponseSuccess, type GetEmailResponse, type GetEmailResponseSuccess, type GetOptions, type GetWebhookResponse, type GetWebhookResponseSuccess, 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 ListWebhooksOptions, type ListWebhooksResponse, type ListWebhooksResponseSuccess, 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 RemoveWebhookResponse, type RemoveWebhookResponseSuccess, 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 UpdateWebhookOptions, type UpdateWebhookResponse, type UpdateWebhookResponseSuccess, type VerifyDomainsResponse, type VerifyDomainsResponseSuccess, type Webhook, type WebhookEvent }; |
+21
-571
@@ -67,3 +67,3 @@ "use strict"; | ||
| // package.json | ||
| var version = "6.3.0-canary.4"; | ||
| var version = "6.3.0"; | ||
@@ -112,40 +112,31 @@ // src/common/utils/build-pagination-query.ts | ||
| // src/attachments/receiving/receiving.ts | ||
| var Receiving = class { | ||
| // src/audiences/audiences.ts | ||
| var Audiences = class { | ||
| constructor(resend) { | ||
| this.resend = resend; | ||
| } | ||
| async get(options) { | ||
| const { emailId, id } = options; | ||
| const data = await this.resend.get( | ||
| `/emails/receiving/${emailId}/attachments/${id}` | ||
| async create(payload, options = {}) { | ||
| const data = await this.resend.post( | ||
| "/audiences", | ||
| payload, | ||
| options | ||
| ); | ||
| return data; | ||
| } | ||
| async list(options) { | ||
| const { emailId } = options; | ||
| async list(options = {}) { | ||
| const queryString = buildPaginationQuery(options); | ||
| const url = queryString ? `/emails/receiving/${emailId}/attachments?${queryString}` : `/emails/receiving/${emailId}/attachments`; | ||
| const url = queryString ? `/audiences?${queryString}` : "/audiences"; | ||
| const data = await this.resend.get(url); | ||
| return data; | ||
| } | ||
| }; | ||
| // src/attachments/sending/sending.ts | ||
| var Sending = class { | ||
| constructor(resend) { | ||
| this.resend = resend; | ||
| } | ||
| async get(options) { | ||
| const { emailId, id } = options; | ||
| async get(id) { | ||
| const data = await this.resend.get( | ||
| `/emails/sending/${emailId}/attachments/${id}` | ||
| `/audiences/${id}` | ||
| ); | ||
| return data; | ||
| } | ||
| async list(options) { | ||
| const { emailId } = options; | ||
| const queryString = buildPaginationQuery(options); | ||
| const url = queryString ? `/emails/sending/${emailId}/attachments?${queryString}` : `/emails/sending/${emailId}/attachments`; | ||
| const data = await this.resend.get(url); | ||
| async remove(id) { | ||
| const data = await this.resend.delete( | ||
| `/audiences/${id}` | ||
| ); | ||
| return data; | ||
@@ -155,10 +146,2 @@ } | ||
| // src/attachments/attachments.ts | ||
| var Attachments = class { | ||
| constructor(resend) { | ||
| this.receiving = new Receiving(resend); | ||
| this.sending = new Sending(resend); | ||
| } | ||
| }; | ||
| // src/common/utils/parse-email-to-api-options.ts | ||
@@ -187,8 +170,3 @@ function parseAttachments(attachments) { | ||
| text: email.text, | ||
| to: email.to, | ||
| template: email.template ? { | ||
| id: email.template.id, | ||
| variables: email.template.variables | ||
| } : void 0, | ||
| topic_id: email.topicId | ||
| to: email.to | ||
| }; | ||
@@ -254,3 +232,2 @@ } | ||
| name: payload.name, | ||
| segment_id: payload.segmentId, | ||
| audience_id: payload.audienceId, | ||
@@ -262,4 +239,3 @@ preview_text: payload.previewText, | ||
| subject: payload.subject, | ||
| text: payload.text, | ||
| topic_id: payload.topicId | ||
| text: payload.text | ||
| }, | ||
@@ -303,3 +279,2 @@ options | ||
| name: payload.name, | ||
| segment_id: payload.segmentId, | ||
| audience_id: payload.audienceId, | ||
@@ -311,4 +286,3 @@ from: payload.from, | ||
| reply_to: payload.replyTo, | ||
| preview_text: payload.previewText, | ||
| topic_id: payload.topicId | ||
| preview_text: payload.previewText | ||
| } | ||
@@ -320,211 +294,2 @@ ); | ||
| // src/common/utils/parse-contact-properties-to-api-options.ts | ||
| function parseContactPropertyFromApi(contactProperty) { | ||
| return { | ||
| id: contactProperty.id, | ||
| key: contactProperty.key, | ||
| object: contactProperty.object, | ||
| createdAt: contactProperty.created_at, | ||
| type: contactProperty.type, | ||
| fallbackValue: contactProperty.fallback_value | ||
| }; | ||
| } | ||
| function parseContactPropertyToApiOptions(contactProperty) { | ||
| if ("key" in contactProperty) { | ||
| return { | ||
| key: contactProperty.key, | ||
| type: contactProperty.type, | ||
| fallback_value: contactProperty.fallbackValue | ||
| }; | ||
| } | ||
| return { | ||
| fallback_value: contactProperty.fallbackValue | ||
| }; | ||
| } | ||
| // src/contact-properties/contact-properties.ts | ||
| var ContactProperties = class { | ||
| constructor(resend) { | ||
| this.resend = resend; | ||
| } | ||
| async create(options) { | ||
| const apiOptions = parseContactPropertyToApiOptions(options); | ||
| const data = await this.resend.post( | ||
| "/contact-properties", | ||
| apiOptions | ||
| ); | ||
| return data; | ||
| } | ||
| async list(options = {}) { | ||
| const queryString = buildPaginationQuery(options); | ||
| const url = queryString ? `/contact-properties?${queryString}` : "/contact-properties"; | ||
| const response = await this.resend.get(url); | ||
| if (response.data) { | ||
| return { | ||
| data: __spreadProps(__spreadValues({}, response.data), { | ||
| data: response.data.data.map( | ||
| (apiContactProperty) => parseContactPropertyFromApi(apiContactProperty) | ||
| ) | ||
| }), | ||
| error: null | ||
| }; | ||
| } | ||
| return response; | ||
| } | ||
| async get(id) { | ||
| if (!id) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const response = await this.resend.get( | ||
| `/contact-properties/${id}` | ||
| ); | ||
| if (response.data) { | ||
| return { | ||
| data: parseContactPropertyFromApi(response.data), | ||
| error: null | ||
| }; | ||
| } | ||
| return response; | ||
| } | ||
| async update(payload) { | ||
| if (!payload.id) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const apiOptions = parseContactPropertyToApiOptions(payload); | ||
| const data = await this.resend.patch( | ||
| `/contact-properties/${payload.id}`, | ||
| apiOptions | ||
| ); | ||
| return data; | ||
| } | ||
| async remove(id) { | ||
| if (!id) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const data = await this.resend.delete( | ||
| `/contact-properties/${id}` | ||
| ); | ||
| return data; | ||
| } | ||
| }; | ||
| // src/contacts/segments/contact-segments.ts | ||
| var ContactSegments = class { | ||
| constructor(resend) { | ||
| this.resend = resend; | ||
| } | ||
| async list(options) { | ||
| if (!options.contactId && !options.email) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` or `email` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const identifier = options.email ? options.email : options.contactId; | ||
| const queryString = buildPaginationQuery(options); | ||
| const url = queryString ? `/contacts/${identifier}/segments?${queryString}` : `/contacts/${identifier}/segments`; | ||
| const data = await this.resend.get(url); | ||
| return data; | ||
| } | ||
| async add(options) { | ||
| if (!options.contactId && !options.email) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` or `email` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const identifier = options.email ? options.email : options.contactId; | ||
| return this.resend.post( | ||
| `/contacts/${identifier}/segments/${options.segmentId}` | ||
| ); | ||
| } | ||
| async remove(options) { | ||
| if (!options.contactId && !options.email) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` or `email` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const identifier = options.email ? options.email : options.contactId; | ||
| return this.resend.delete( | ||
| `/contacts/${identifier}/segments/${options.segmentId}` | ||
| ); | ||
| } | ||
| }; | ||
| // src/contacts/topics/contact-topics.ts | ||
| var ContactTopics = class { | ||
| constructor(resend) { | ||
| this.resend = resend; | ||
| } | ||
| async update(payload) { | ||
| if (!payload.id && !payload.email) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` or `email` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const identifier = payload.email ? payload.email : payload.id; | ||
| const data = await this.resend.patch( | ||
| `/contacts/${identifier}/topics`, | ||
| payload.topics | ||
| ); | ||
| return data; | ||
| } | ||
| async list(options) { | ||
| if (!options.id && !options.email) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` or `email` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const identifier = options.email ? options.email : options.id; | ||
| const queryString = buildPaginationQuery(options); | ||
| const url = queryString ? `/contacts/${identifier}/topics?${queryString}` : `/contacts/${identifier}/topics`; | ||
| const data = await this.resend.get(url); | ||
| return data; | ||
| } | ||
| }; | ||
| // src/contacts/contacts.ts | ||
@@ -534,19 +299,4 @@ var Contacts = class { | ||
| this.resend = resend; | ||
| this.topics = new ContactTopics(this.resend); | ||
| this.segments = new ContactSegments(this.resend); | ||
| } | ||
| async create(payload, options = {}) { | ||
| if (!payload.audienceId) { | ||
| const data2 = await this.resend.post( | ||
| "/contacts", | ||
| { | ||
| unsubscribed: payload.unsubscribed, | ||
| email: payload.email, | ||
| first_name: payload.firstName, | ||
| last_name: payload.lastName | ||
| }, | ||
| options | ||
| ); | ||
| return data2; | ||
| } | ||
| const data = await this.resend.post( | ||
@@ -564,9 +314,3 @@ `/audiences/${payload.audienceId}/contacts`, | ||
| } | ||
| async list(options = {}) { | ||
| if (!("audienceId" in options) || options.audienceId === void 0) { | ||
| const queryString2 = buildPaginationQuery(options); | ||
| const url2 = queryString2 ? `/contacts?${queryString2}` : "/contacts"; | ||
| const data2 = await this.resend.get(url2); | ||
| return data2; | ||
| } | ||
| async list(options) { | ||
| const _a = options, { audienceId } = _a, paginationOptions = __objRest(_a, ["audienceId"]); | ||
@@ -579,8 +323,2 @@ const queryString = buildPaginationQuery(paginationOptions); | ||
| async get(options) { | ||
| if (typeof options === "string") { | ||
| const data2 = await this.resend.get( | ||
| `/contacts/${options}` | ||
| ); | ||
| return data2; | ||
| } | ||
| if (!options.id && !options.email) { | ||
@@ -596,8 +334,2 @@ return { | ||
| } | ||
| if (!options.audienceId) { | ||
| const data2 = await this.resend.get( | ||
| `/contacts/${(options == null ? void 0 : options.email) ? options == null ? void 0 : options.email : options == null ? void 0 : options.id}` | ||
| ); | ||
| return data2; | ||
| } | ||
| const data = await this.resend.get( | ||
@@ -619,13 +351,2 @@ `/audiences/${options.audienceId}/contacts/${(options == null ? void 0 : options.email) ? options == null ? void 0 : options.email : options == null ? void 0 : options.id}` | ||
| } | ||
| if (!options.audienceId) { | ||
| const data2 = await this.resend.patch( | ||
| `/contacts/${(options == null ? void 0 : options.email) ? options == null ? void 0 : options.email : options == null ? void 0 : options.id}`, | ||
| { | ||
| unsubscribed: options.unsubscribed, | ||
| first_name: options.firstName, | ||
| last_name: options.lastName | ||
| } | ||
| ); | ||
| return data2; | ||
| } | ||
| const data = await this.resend.patch( | ||
@@ -642,8 +363,2 @@ `/audiences/${options.audienceId}/contacts/${(options == null ? void 0 : options.email) ? options == null ? void 0 : options.email : options == null ? void 0 : options.id}`, | ||
| async remove(payload) { | ||
| if (typeof payload === "string") { | ||
| const data2 = await this.resend.delete( | ||
| `/contacts/${payload}` | ||
| ); | ||
| return data2; | ||
| } | ||
| if (!payload.id && !payload.email) { | ||
@@ -659,8 +374,2 @@ return { | ||
| } | ||
| if (!payload.audienceId) { | ||
| const data2 = await this.resend.delete( | ||
| `/contacts/${(payload == null ? void 0 : payload.email) ? payload == null ? void 0 : payload.email : payload == null ? void 0 : payload.id}` | ||
| ); | ||
| return data2; | ||
| } | ||
| const data = await this.resend.delete( | ||
@@ -678,3 +387,2 @@ `/audiences/${payload.audienceId}/contacts/${(payload == null ? void 0 : payload.email) ? payload == null ? void 0 : payload.email : payload == null ? void 0 : payload.id}` | ||
| region: domain.region, | ||
| capability: domain.capability, | ||
| custom_return_path: domain.customReturnPath | ||
@@ -734,21 +442,2 @@ }; | ||
| // src/emails/receiving/receiving.ts | ||
| var Receiving2 = class { | ||
| constructor(resend) { | ||
| this.resend = resend; | ||
| } | ||
| async get(id) { | ||
| const data = await this.resend.get( | ||
| `/emails/receiving/${id}` | ||
| ); | ||
| return data; | ||
| } | ||
| async list(options = {}) { | ||
| const queryString = buildPaginationQuery(options); | ||
| const url = queryString ? `/emails/receiving?${queryString}` : "/emails/receiving"; | ||
| const data = await this.resend.get(url); | ||
| return data; | ||
| } | ||
| }; | ||
| // src/emails/emails.ts | ||
@@ -758,3 +447,2 @@ var Emails = class { | ||
| this.resend = resend; | ||
| this.receiving = new Receiving2(resend); | ||
| } | ||
@@ -804,232 +492,2 @@ async send(payload, options = {}) { | ||
| // src/segments/segments.ts | ||
| var Segments = class { | ||
| constructor(resend) { | ||
| this.resend = resend; | ||
| } | ||
| async create(payload, options = {}) { | ||
| const data = await this.resend.post( | ||
| "/segments", | ||
| payload, | ||
| options | ||
| ); | ||
| return data; | ||
| } | ||
| async list(options = {}) { | ||
| const queryString = buildPaginationQuery(options); | ||
| const url = queryString ? `/segments?${queryString}` : "/segments"; | ||
| const data = await this.resend.get(url); | ||
| return data; | ||
| } | ||
| async get(id) { | ||
| const data = await this.resend.get( | ||
| `/segments/${id}` | ||
| ); | ||
| return data; | ||
| } | ||
| async remove(id) { | ||
| const data = await this.resend.delete( | ||
| `/segments/${id}` | ||
| ); | ||
| return data; | ||
| } | ||
| }; | ||
| // src/common/utils/get-pagination-query-properties.ts | ||
| function getPaginationQueryProperties(options = {}) { | ||
| const query = new URLSearchParams(); | ||
| if (options.before) query.set("before", options.before); | ||
| if (options.after) query.set("after", options.after); | ||
| if (options.limit) query.set("limit", options.limit.toString()); | ||
| return query.size > 0 ? `?${query.toString()}` : ""; | ||
| } | ||
| // src/common/utils/parse-template-to-api-options.ts | ||
| function parseVariables(variables) { | ||
| return variables == null ? void 0 : variables.map((variable) => ({ | ||
| key: variable.key, | ||
| type: variable.type, | ||
| fallback_value: variable.fallbackValue | ||
| })); | ||
| } | ||
| function parseTemplateToApiOptions(template) { | ||
| return { | ||
| name: "name" in template ? template.name : void 0, | ||
| subject: template.subject, | ||
| html: template.html, | ||
| text: template.text, | ||
| alias: template.alias, | ||
| from: template.from, | ||
| reply_to: template.replyTo, | ||
| variables: parseVariables(template.variables) | ||
| }; | ||
| } | ||
| // src/templates/chainable-template-result.ts | ||
| var ChainableTemplateResult = class { | ||
| constructor(promise, publishFn) { | ||
| this.promise = promise; | ||
| this.publishFn = publishFn; | ||
| } | ||
| // If user calls `then` or only awaits for the result of create() or duplicate(), the behavior should be | ||
| // exactly as if they called create() or duplicate() directly. This will act as a normal promise | ||
| // biome-ignore lint/suspicious/noThenProperty: This class intentionally implements PromiseLike | ||
| then(onfulfilled, onrejected) { | ||
| return this.promise.then(onfulfilled, onrejected); | ||
| } | ||
| async publish() { | ||
| const { data, error } = await this.promise; | ||
| if (error) { | ||
| return { | ||
| data: null, | ||
| error | ||
| }; | ||
| } | ||
| const publishResult = await this.publishFn(data.id); | ||
| return publishResult; | ||
| } | ||
| }; | ||
| // src/templates/templates.ts | ||
| var Templates = class { | ||
| constructor(resend) { | ||
| this.resend = resend; | ||
| } | ||
| create(payload) { | ||
| const createPromise = this.performCreate(payload); | ||
| return new ChainableTemplateResult(createPromise, this.publish.bind(this)); | ||
| } | ||
| // This creation process is being done separately from the public create so that | ||
| // the user can chain the publish operation after the create operation. Otherwise, due | ||
| // to the async nature of the renderAsync, the return type would be | ||
| // Promise<ChainableTemplateResult<CreateTemplateResponse>> which wouldn't be chainable. | ||
| async performCreate(payload) { | ||
| if (payload.react) { | ||
| if (!this.renderAsync) { | ||
| try { | ||
| const { renderAsync } = await import("@react-email/render"); | ||
| this.renderAsync = renderAsync; | ||
| } catch (e) { | ||
| throw new Error( | ||
| "Failed to render React component. Make sure to install `@react-email/render`" | ||
| ); | ||
| } | ||
| } | ||
| payload.html = await this.renderAsync( | ||
| payload.react | ||
| ); | ||
| } | ||
| return this.resend.post( | ||
| "/templates", | ||
| parseTemplateToApiOptions(payload) | ||
| ); | ||
| } | ||
| async remove(identifier) { | ||
| const data = await this.resend.delete( | ||
| `/templates/${identifier}` | ||
| ); | ||
| return data; | ||
| } | ||
| async get(identifier) { | ||
| const data = await this.resend.get( | ||
| `/templates/${identifier}` | ||
| ); | ||
| return data; | ||
| } | ||
| async list(options = {}) { | ||
| return this.resend.get( | ||
| `/templates${getPaginationQueryProperties(options)}` | ||
| ); | ||
| } | ||
| duplicate(identifier) { | ||
| const promiseDuplicate = this.resend.post( | ||
| `/templates/${identifier}/duplicate` | ||
| ); | ||
| return new ChainableTemplateResult( | ||
| promiseDuplicate, | ||
| this.publish.bind(this) | ||
| ); | ||
| } | ||
| async publish(identifier) { | ||
| const data = await this.resend.post( | ||
| `/templates/${identifier}/publish` | ||
| ); | ||
| return data; | ||
| } | ||
| async update(identifier, payload) { | ||
| const data = await this.resend.patch( | ||
| `/templates/${identifier}`, | ||
| parseTemplateToApiOptions(payload) | ||
| ); | ||
| return data; | ||
| } | ||
| }; | ||
| // src/topics/topics.ts | ||
| var Topics = class { | ||
| constructor(resend) { | ||
| this.resend = resend; | ||
| } | ||
| async create(payload) { | ||
| const _a = payload, { defaultSubscription } = _a, body = __objRest(_a, ["defaultSubscription"]); | ||
| const data = await this.resend.post("/topics", __spreadProps(__spreadValues({}, body), { | ||
| default_subscription: defaultSubscription | ||
| })); | ||
| return data; | ||
| } | ||
| async list() { | ||
| const data = await this.resend.get("/topics"); | ||
| return data; | ||
| } | ||
| async get(id) { | ||
| if (!id) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const data = await this.resend.get( | ||
| `/topics/${id}` | ||
| ); | ||
| return data; | ||
| } | ||
| async update(payload) { | ||
| if (!payload.id) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const data = await this.resend.patch( | ||
| `/topics/${payload.id}`, | ||
| payload | ||
| ); | ||
| return data; | ||
| } | ||
| async remove(id) { | ||
| if (!id) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const data = await this.resend.delete( | ||
| `/topics/${id}` | ||
| ); | ||
| return data; | ||
| } | ||
| }; | ||
| // src/webhooks/webhooks.ts | ||
@@ -1093,17 +551,9 @@ var import_svix = require("svix"); | ||
| this.apiKeys = new ApiKeys(this); | ||
| this.attachments = new Attachments(this); | ||
| this.segments = new Segments(this); | ||
| /** | ||
| * @deprecated Use segments instead | ||
| */ | ||
| this.audiences = this.segments; | ||
| this.audiences = new Audiences(this); | ||
| this.batch = new Batch(this); | ||
| this.broadcasts = new Broadcasts(this); | ||
| this.contacts = new Contacts(this); | ||
| this.contactProperties = new ContactProperties(this); | ||
| this.domains = new Domains(this); | ||
| this.emails = new Emails(this); | ||
| this.webhooks = new Webhooks(this); | ||
| this.templates = new Templates(this); | ||
| this.topics = new Topics(this); | ||
| if (!key) { | ||
@@ -1110,0 +560,0 @@ if (typeof process !== "undefined" && process.env) { |
+21
-571
@@ -34,3 +34,3 @@ var __defProp = Object.defineProperty; | ||
| // package.json | ||
| var version = "6.3.0-canary.4"; | ||
| var version = "6.3.0"; | ||
@@ -79,40 +79,31 @@ // src/common/utils/build-pagination-query.ts | ||
| // src/attachments/receiving/receiving.ts | ||
| var Receiving = class { | ||
| // src/audiences/audiences.ts | ||
| var Audiences = class { | ||
| constructor(resend) { | ||
| this.resend = resend; | ||
| } | ||
| async get(options) { | ||
| const { emailId, id } = options; | ||
| const data = await this.resend.get( | ||
| `/emails/receiving/${emailId}/attachments/${id}` | ||
| async create(payload, options = {}) { | ||
| const data = await this.resend.post( | ||
| "/audiences", | ||
| payload, | ||
| options | ||
| ); | ||
| return data; | ||
| } | ||
| async list(options) { | ||
| const { emailId } = options; | ||
| async list(options = {}) { | ||
| const queryString = buildPaginationQuery(options); | ||
| const url = queryString ? `/emails/receiving/${emailId}/attachments?${queryString}` : `/emails/receiving/${emailId}/attachments`; | ||
| const url = queryString ? `/audiences?${queryString}` : "/audiences"; | ||
| const data = await this.resend.get(url); | ||
| return data; | ||
| } | ||
| }; | ||
| // src/attachments/sending/sending.ts | ||
| var Sending = class { | ||
| constructor(resend) { | ||
| this.resend = resend; | ||
| } | ||
| async get(options) { | ||
| const { emailId, id } = options; | ||
| async get(id) { | ||
| const data = await this.resend.get( | ||
| `/emails/sending/${emailId}/attachments/${id}` | ||
| `/audiences/${id}` | ||
| ); | ||
| return data; | ||
| } | ||
| async list(options) { | ||
| const { emailId } = options; | ||
| const queryString = buildPaginationQuery(options); | ||
| const url = queryString ? `/emails/sending/${emailId}/attachments?${queryString}` : `/emails/sending/${emailId}/attachments`; | ||
| const data = await this.resend.get(url); | ||
| async remove(id) { | ||
| const data = await this.resend.delete( | ||
| `/audiences/${id}` | ||
| ); | ||
| return data; | ||
@@ -122,10 +113,2 @@ } | ||
| // src/attachments/attachments.ts | ||
| var Attachments = class { | ||
| constructor(resend) { | ||
| this.receiving = new Receiving(resend); | ||
| this.sending = new Sending(resend); | ||
| } | ||
| }; | ||
| // src/common/utils/parse-email-to-api-options.ts | ||
@@ -154,8 +137,3 @@ function parseAttachments(attachments) { | ||
| text: email.text, | ||
| to: email.to, | ||
| template: email.template ? { | ||
| id: email.template.id, | ||
| variables: email.template.variables | ||
| } : void 0, | ||
| topic_id: email.topicId | ||
| to: email.to | ||
| }; | ||
@@ -221,3 +199,2 @@ } | ||
| name: payload.name, | ||
| segment_id: payload.segmentId, | ||
| audience_id: payload.audienceId, | ||
@@ -229,4 +206,3 @@ preview_text: payload.previewText, | ||
| subject: payload.subject, | ||
| text: payload.text, | ||
| topic_id: payload.topicId | ||
| text: payload.text | ||
| }, | ||
@@ -270,3 +246,2 @@ options | ||
| name: payload.name, | ||
| segment_id: payload.segmentId, | ||
| audience_id: payload.audienceId, | ||
@@ -278,4 +253,3 @@ from: payload.from, | ||
| reply_to: payload.replyTo, | ||
| preview_text: payload.previewText, | ||
| topic_id: payload.topicId | ||
| preview_text: payload.previewText | ||
| } | ||
@@ -287,211 +261,2 @@ ); | ||
| // src/common/utils/parse-contact-properties-to-api-options.ts | ||
| function parseContactPropertyFromApi(contactProperty) { | ||
| return { | ||
| id: contactProperty.id, | ||
| key: contactProperty.key, | ||
| object: contactProperty.object, | ||
| createdAt: contactProperty.created_at, | ||
| type: contactProperty.type, | ||
| fallbackValue: contactProperty.fallback_value | ||
| }; | ||
| } | ||
| function parseContactPropertyToApiOptions(contactProperty) { | ||
| if ("key" in contactProperty) { | ||
| return { | ||
| key: contactProperty.key, | ||
| type: contactProperty.type, | ||
| fallback_value: contactProperty.fallbackValue | ||
| }; | ||
| } | ||
| return { | ||
| fallback_value: contactProperty.fallbackValue | ||
| }; | ||
| } | ||
| // src/contact-properties/contact-properties.ts | ||
| var ContactProperties = class { | ||
| constructor(resend) { | ||
| this.resend = resend; | ||
| } | ||
| async create(options) { | ||
| const apiOptions = parseContactPropertyToApiOptions(options); | ||
| const data = await this.resend.post( | ||
| "/contact-properties", | ||
| apiOptions | ||
| ); | ||
| return data; | ||
| } | ||
| async list(options = {}) { | ||
| const queryString = buildPaginationQuery(options); | ||
| const url = queryString ? `/contact-properties?${queryString}` : "/contact-properties"; | ||
| const response = await this.resend.get(url); | ||
| if (response.data) { | ||
| return { | ||
| data: __spreadProps(__spreadValues({}, response.data), { | ||
| data: response.data.data.map( | ||
| (apiContactProperty) => parseContactPropertyFromApi(apiContactProperty) | ||
| ) | ||
| }), | ||
| error: null | ||
| }; | ||
| } | ||
| return response; | ||
| } | ||
| async get(id) { | ||
| if (!id) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const response = await this.resend.get( | ||
| `/contact-properties/${id}` | ||
| ); | ||
| if (response.data) { | ||
| return { | ||
| data: parseContactPropertyFromApi(response.data), | ||
| error: null | ||
| }; | ||
| } | ||
| return response; | ||
| } | ||
| async update(payload) { | ||
| if (!payload.id) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const apiOptions = parseContactPropertyToApiOptions(payload); | ||
| const data = await this.resend.patch( | ||
| `/contact-properties/${payload.id}`, | ||
| apiOptions | ||
| ); | ||
| return data; | ||
| } | ||
| async remove(id) { | ||
| if (!id) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const data = await this.resend.delete( | ||
| `/contact-properties/${id}` | ||
| ); | ||
| return data; | ||
| } | ||
| }; | ||
| // src/contacts/segments/contact-segments.ts | ||
| var ContactSegments = class { | ||
| constructor(resend) { | ||
| this.resend = resend; | ||
| } | ||
| async list(options) { | ||
| if (!options.contactId && !options.email) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` or `email` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const identifier = options.email ? options.email : options.contactId; | ||
| const queryString = buildPaginationQuery(options); | ||
| const url = queryString ? `/contacts/${identifier}/segments?${queryString}` : `/contacts/${identifier}/segments`; | ||
| const data = await this.resend.get(url); | ||
| return data; | ||
| } | ||
| async add(options) { | ||
| if (!options.contactId && !options.email) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` or `email` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const identifier = options.email ? options.email : options.contactId; | ||
| return this.resend.post( | ||
| `/contacts/${identifier}/segments/${options.segmentId}` | ||
| ); | ||
| } | ||
| async remove(options) { | ||
| if (!options.contactId && !options.email) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` or `email` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const identifier = options.email ? options.email : options.contactId; | ||
| return this.resend.delete( | ||
| `/contacts/${identifier}/segments/${options.segmentId}` | ||
| ); | ||
| } | ||
| }; | ||
| // src/contacts/topics/contact-topics.ts | ||
| var ContactTopics = class { | ||
| constructor(resend) { | ||
| this.resend = resend; | ||
| } | ||
| async update(payload) { | ||
| if (!payload.id && !payload.email) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` or `email` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const identifier = payload.email ? payload.email : payload.id; | ||
| const data = await this.resend.patch( | ||
| `/contacts/${identifier}/topics`, | ||
| payload.topics | ||
| ); | ||
| return data; | ||
| } | ||
| async list(options) { | ||
| if (!options.id && !options.email) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` or `email` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const identifier = options.email ? options.email : options.id; | ||
| const queryString = buildPaginationQuery(options); | ||
| const url = queryString ? `/contacts/${identifier}/topics?${queryString}` : `/contacts/${identifier}/topics`; | ||
| const data = await this.resend.get(url); | ||
| return data; | ||
| } | ||
| }; | ||
| // src/contacts/contacts.ts | ||
@@ -501,19 +266,4 @@ var Contacts = class { | ||
| this.resend = resend; | ||
| this.topics = new ContactTopics(this.resend); | ||
| this.segments = new ContactSegments(this.resend); | ||
| } | ||
| async create(payload, options = {}) { | ||
| if (!payload.audienceId) { | ||
| const data2 = await this.resend.post( | ||
| "/contacts", | ||
| { | ||
| unsubscribed: payload.unsubscribed, | ||
| email: payload.email, | ||
| first_name: payload.firstName, | ||
| last_name: payload.lastName | ||
| }, | ||
| options | ||
| ); | ||
| return data2; | ||
| } | ||
| const data = await this.resend.post( | ||
@@ -531,9 +281,3 @@ `/audiences/${payload.audienceId}/contacts`, | ||
| } | ||
| async list(options = {}) { | ||
| if (!("audienceId" in options) || options.audienceId === void 0) { | ||
| const queryString2 = buildPaginationQuery(options); | ||
| const url2 = queryString2 ? `/contacts?${queryString2}` : "/contacts"; | ||
| const data2 = await this.resend.get(url2); | ||
| return data2; | ||
| } | ||
| async list(options) { | ||
| const _a = options, { audienceId } = _a, paginationOptions = __objRest(_a, ["audienceId"]); | ||
@@ -546,8 +290,2 @@ const queryString = buildPaginationQuery(paginationOptions); | ||
| async get(options) { | ||
| if (typeof options === "string") { | ||
| const data2 = await this.resend.get( | ||
| `/contacts/${options}` | ||
| ); | ||
| return data2; | ||
| } | ||
| if (!options.id && !options.email) { | ||
@@ -563,8 +301,2 @@ return { | ||
| } | ||
| if (!options.audienceId) { | ||
| const data2 = await this.resend.get( | ||
| `/contacts/${(options == null ? void 0 : options.email) ? options == null ? void 0 : options.email : options == null ? void 0 : options.id}` | ||
| ); | ||
| return data2; | ||
| } | ||
| const data = await this.resend.get( | ||
@@ -586,13 +318,2 @@ `/audiences/${options.audienceId}/contacts/${(options == null ? void 0 : options.email) ? options == null ? void 0 : options.email : options == null ? void 0 : options.id}` | ||
| } | ||
| if (!options.audienceId) { | ||
| const data2 = await this.resend.patch( | ||
| `/contacts/${(options == null ? void 0 : options.email) ? options == null ? void 0 : options.email : options == null ? void 0 : options.id}`, | ||
| { | ||
| unsubscribed: options.unsubscribed, | ||
| first_name: options.firstName, | ||
| last_name: options.lastName | ||
| } | ||
| ); | ||
| return data2; | ||
| } | ||
| const data = await this.resend.patch( | ||
@@ -609,8 +330,2 @@ `/audiences/${options.audienceId}/contacts/${(options == null ? void 0 : options.email) ? options == null ? void 0 : options.email : options == null ? void 0 : options.id}`, | ||
| async remove(payload) { | ||
| if (typeof payload === "string") { | ||
| const data2 = await this.resend.delete( | ||
| `/contacts/${payload}` | ||
| ); | ||
| return data2; | ||
| } | ||
| if (!payload.id && !payload.email) { | ||
@@ -626,8 +341,2 @@ return { | ||
| } | ||
| if (!payload.audienceId) { | ||
| const data2 = await this.resend.delete( | ||
| `/contacts/${(payload == null ? void 0 : payload.email) ? payload == null ? void 0 : payload.email : payload == null ? void 0 : payload.id}` | ||
| ); | ||
| return data2; | ||
| } | ||
| const data = await this.resend.delete( | ||
@@ -645,3 +354,2 @@ `/audiences/${payload.audienceId}/contacts/${(payload == null ? void 0 : payload.email) ? payload == null ? void 0 : payload.email : payload == null ? void 0 : payload.id}` | ||
| region: domain.region, | ||
| capability: domain.capability, | ||
| custom_return_path: domain.customReturnPath | ||
@@ -701,21 +409,2 @@ }; | ||
| // src/emails/receiving/receiving.ts | ||
| var Receiving2 = class { | ||
| constructor(resend) { | ||
| this.resend = resend; | ||
| } | ||
| async get(id) { | ||
| const data = await this.resend.get( | ||
| `/emails/receiving/${id}` | ||
| ); | ||
| return data; | ||
| } | ||
| async list(options = {}) { | ||
| const queryString = buildPaginationQuery(options); | ||
| const url = queryString ? `/emails/receiving?${queryString}` : "/emails/receiving"; | ||
| const data = await this.resend.get(url); | ||
| return data; | ||
| } | ||
| }; | ||
| // src/emails/emails.ts | ||
@@ -725,3 +414,2 @@ var Emails = class { | ||
| this.resend = resend; | ||
| this.receiving = new Receiving2(resend); | ||
| } | ||
@@ -771,232 +459,2 @@ async send(payload, options = {}) { | ||
| // src/segments/segments.ts | ||
| var Segments = class { | ||
| constructor(resend) { | ||
| this.resend = resend; | ||
| } | ||
| async create(payload, options = {}) { | ||
| const data = await this.resend.post( | ||
| "/segments", | ||
| payload, | ||
| options | ||
| ); | ||
| return data; | ||
| } | ||
| async list(options = {}) { | ||
| const queryString = buildPaginationQuery(options); | ||
| const url = queryString ? `/segments?${queryString}` : "/segments"; | ||
| const data = await this.resend.get(url); | ||
| return data; | ||
| } | ||
| async get(id) { | ||
| const data = await this.resend.get( | ||
| `/segments/${id}` | ||
| ); | ||
| return data; | ||
| } | ||
| async remove(id) { | ||
| const data = await this.resend.delete( | ||
| `/segments/${id}` | ||
| ); | ||
| return data; | ||
| } | ||
| }; | ||
| // src/common/utils/get-pagination-query-properties.ts | ||
| function getPaginationQueryProperties(options = {}) { | ||
| const query = new URLSearchParams(); | ||
| if (options.before) query.set("before", options.before); | ||
| if (options.after) query.set("after", options.after); | ||
| if (options.limit) query.set("limit", options.limit.toString()); | ||
| return query.size > 0 ? `?${query.toString()}` : ""; | ||
| } | ||
| // src/common/utils/parse-template-to-api-options.ts | ||
| function parseVariables(variables) { | ||
| return variables == null ? void 0 : variables.map((variable) => ({ | ||
| key: variable.key, | ||
| type: variable.type, | ||
| fallback_value: variable.fallbackValue | ||
| })); | ||
| } | ||
| function parseTemplateToApiOptions(template) { | ||
| return { | ||
| name: "name" in template ? template.name : void 0, | ||
| subject: template.subject, | ||
| html: template.html, | ||
| text: template.text, | ||
| alias: template.alias, | ||
| from: template.from, | ||
| reply_to: template.replyTo, | ||
| variables: parseVariables(template.variables) | ||
| }; | ||
| } | ||
| // src/templates/chainable-template-result.ts | ||
| var ChainableTemplateResult = class { | ||
| constructor(promise, publishFn) { | ||
| this.promise = promise; | ||
| this.publishFn = publishFn; | ||
| } | ||
| // If user calls `then` or only awaits for the result of create() or duplicate(), the behavior should be | ||
| // exactly as if they called create() or duplicate() directly. This will act as a normal promise | ||
| // biome-ignore lint/suspicious/noThenProperty: This class intentionally implements PromiseLike | ||
| then(onfulfilled, onrejected) { | ||
| return this.promise.then(onfulfilled, onrejected); | ||
| } | ||
| async publish() { | ||
| const { data, error } = await this.promise; | ||
| if (error) { | ||
| return { | ||
| data: null, | ||
| error | ||
| }; | ||
| } | ||
| const publishResult = await this.publishFn(data.id); | ||
| return publishResult; | ||
| } | ||
| }; | ||
| // src/templates/templates.ts | ||
| var Templates = class { | ||
| constructor(resend) { | ||
| this.resend = resend; | ||
| } | ||
| create(payload) { | ||
| const createPromise = this.performCreate(payload); | ||
| return new ChainableTemplateResult(createPromise, this.publish.bind(this)); | ||
| } | ||
| // This creation process is being done separately from the public create so that | ||
| // the user can chain the publish operation after the create operation. Otherwise, due | ||
| // to the async nature of the renderAsync, the return type would be | ||
| // Promise<ChainableTemplateResult<CreateTemplateResponse>> which wouldn't be chainable. | ||
| async performCreate(payload) { | ||
| if (payload.react) { | ||
| if (!this.renderAsync) { | ||
| try { | ||
| const { renderAsync } = await import("@react-email/render"); | ||
| this.renderAsync = renderAsync; | ||
| } catch (e) { | ||
| throw new Error( | ||
| "Failed to render React component. Make sure to install `@react-email/render`" | ||
| ); | ||
| } | ||
| } | ||
| payload.html = await this.renderAsync( | ||
| payload.react | ||
| ); | ||
| } | ||
| return this.resend.post( | ||
| "/templates", | ||
| parseTemplateToApiOptions(payload) | ||
| ); | ||
| } | ||
| async remove(identifier) { | ||
| const data = await this.resend.delete( | ||
| `/templates/${identifier}` | ||
| ); | ||
| return data; | ||
| } | ||
| async get(identifier) { | ||
| const data = await this.resend.get( | ||
| `/templates/${identifier}` | ||
| ); | ||
| return data; | ||
| } | ||
| async list(options = {}) { | ||
| return this.resend.get( | ||
| `/templates${getPaginationQueryProperties(options)}` | ||
| ); | ||
| } | ||
| duplicate(identifier) { | ||
| const promiseDuplicate = this.resend.post( | ||
| `/templates/${identifier}/duplicate` | ||
| ); | ||
| return new ChainableTemplateResult( | ||
| promiseDuplicate, | ||
| this.publish.bind(this) | ||
| ); | ||
| } | ||
| async publish(identifier) { | ||
| const data = await this.resend.post( | ||
| `/templates/${identifier}/publish` | ||
| ); | ||
| return data; | ||
| } | ||
| async update(identifier, payload) { | ||
| const data = await this.resend.patch( | ||
| `/templates/${identifier}`, | ||
| parseTemplateToApiOptions(payload) | ||
| ); | ||
| return data; | ||
| } | ||
| }; | ||
| // src/topics/topics.ts | ||
| var Topics = class { | ||
| constructor(resend) { | ||
| this.resend = resend; | ||
| } | ||
| async create(payload) { | ||
| const _a = payload, { defaultSubscription } = _a, body = __objRest(_a, ["defaultSubscription"]); | ||
| const data = await this.resend.post("/topics", __spreadProps(__spreadValues({}, body), { | ||
| default_subscription: defaultSubscription | ||
| })); | ||
| return data; | ||
| } | ||
| async list() { | ||
| const data = await this.resend.get("/topics"); | ||
| return data; | ||
| } | ||
| async get(id) { | ||
| if (!id) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const data = await this.resend.get( | ||
| `/topics/${id}` | ||
| ); | ||
| return data; | ||
| } | ||
| async update(payload) { | ||
| if (!payload.id) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const data = await this.resend.patch( | ||
| `/topics/${payload.id}`, | ||
| payload | ||
| ); | ||
| return data; | ||
| } | ||
| async remove(id) { | ||
| if (!id) { | ||
| return { | ||
| data: null, | ||
| error: { | ||
| message: "Missing `id` field.", | ||
| statusCode: null, | ||
| name: "missing_required_field" | ||
| } | ||
| }; | ||
| } | ||
| const data = await this.resend.delete( | ||
| `/topics/${id}` | ||
| ); | ||
| return data; | ||
| } | ||
| }; | ||
| // src/webhooks/webhooks.ts | ||
@@ -1060,17 +518,9 @@ import { Webhook } from "svix"; | ||
| this.apiKeys = new ApiKeys(this); | ||
| this.attachments = new Attachments(this); | ||
| this.segments = new Segments(this); | ||
| /** | ||
| * @deprecated Use segments instead | ||
| */ | ||
| this.audiences = this.segments; | ||
| this.audiences = new Audiences(this); | ||
| this.batch = new Batch(this); | ||
| this.broadcasts = new Broadcasts(this); | ||
| this.contacts = new Contacts(this); | ||
| this.contactProperties = new ContactProperties(this); | ||
| this.domains = new Domains(this); | ||
| this.emails = new Emails(this); | ||
| this.webhooks = new Webhooks(this); | ||
| this.templates = new Templates(this); | ||
| this.topics = new Topics(this); | ||
| if (!key) { | ||
@@ -1077,0 +527,0 @@ if (typeof process !== "undefined" && process.env) { |
+10
-19
| { | ||
| "name": "resend", | ||
| "version": "6.3.0-canary.4", | ||
| "version": "6.3.0", | ||
| "description": "Node.js library for the Resend API", | ||
@@ -34,10 +34,7 @@ "main": "./dist/index.js", | ||
| "test": "vitest run", | ||
| "test:watch": "vitest", | ||
| "typecheck": "tsc --noEmit", | ||
| "test:record": "rimraf --glob \"**/__recordings__\" && cross-env TEST_MODE=record vitest run", | ||
| "test:dev": "cross-env TEST_MODE=dev vitest run" | ||
| "test:watch": "vitest" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/resend/resend-node.git" | ||
| "url": "git+https://github.com/resendlabs/resend-node.git" | ||
| }, | ||
@@ -47,5 +44,5 @@ "author": "", | ||
| "bugs": { | ||
| "url": "https://github.com/resend/resend-node/issues" | ||
| "url": "https://github.com/resendlabs/resend-node/issues" | ||
| }, | ||
| "homepage": "https://github.com/resend/resend-node#readme", | ||
| "homepage": "https://github.com/resendlabs/resend-node#readme", | ||
| "dependencies": { | ||
@@ -63,18 +60,12 @@ "svix": "1.76.1" | ||
| "devDependencies": { | ||
| "@biomejs/biome": "2.2.5", | ||
| "@pollyjs/adapter-fetch": "6.0.7", | ||
| "@pollyjs/core": "6.0.6", | ||
| "@pollyjs/persister-fs": "6.0.6", | ||
| "@types/node": "22.18.9", | ||
| "@types/react": "19.2.0", | ||
| "cross-env": "10.1.0", | ||
| "dotenv": "17.2.3", | ||
| "@biomejs/biome": "2.2.0", | ||
| "@types/node": "22.18.6", | ||
| "@types/react": "19.1.15", | ||
| "pkg-pr-new": "0.0.60", | ||
| "rimraf": "6.0.1", | ||
| "tsup": "8.5.0", | ||
| "typescript": "5.9.3", | ||
| "typescript": "5.9.2", | ||
| "vitest": "3.2.4", | ||
| "vitest-fetch-mock": "0.4.5" | ||
| }, | ||
| "packageManager": "pnpm@10.18.2" | ||
| "packageManager": "pnpm@10.17.1" | ||
| } |
+4
-4
@@ -39,6 +39,6 @@ | ||
| - [Node.js](https://github.com/resend/resend-node-example) | ||
| - [Next.js (App Router)](https://github.com/resend/resend-nextjs-app-router-example) | ||
| - [Next.js (Pages Router)](https://github.com/resend/resend-nextjs-pages-router-example) | ||
| - [Express](https://github.com/resend/resend-express-example) | ||
| - [Node.js](https://github.com/resendlabs/resend-node-example) | ||
| - [Next.js (App Router)](https://github.com/resendlabs/resend-nextjs-app-router-example) | ||
| - [Next.js (Pages Router)](https://github.com/resendlabs/resend-nextjs-pages-router-example) | ||
| - [Express](https://github.com/resendlabs/resend-express-example) | ||
@@ -45,0 +45,0 @@ ## Setup |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
8
-42.86%0
-100%19
-29.63%108811
-37.38%2330
-41.16%