Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/contacts/contacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ export class Contacts {
this.segments = new ContactSegments(this.resend);
}

async create(
paylaod: CreateContactOptions,
options?: CreateContactRequestOptions,
): Promise<CreateContactResponse>;
async create(
paylaod: LegacyCreateContactOptions,
options?: CreateContactRequestOptions,
): Promise<CreateContactResponse>;

async create(
payload: CreateContactOptions | LegacyCreateContactOptions,
options: CreateContactRequestOptions = {},
Expand Down
8 changes: 2 additions & 6 deletions src/contacts/interfaces/create-contact-options.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ interface CreateContactPropertiesOptions {
export interface LegacyCreateContactOptions {
/**
* @deprecated Use `segments` instead to add one or more segments to the new contact
*
* @see https://resend.com/docs/dashboard/segments/migrating-from-audiences-to-segments
*/
audienceId: string;
email: string;
unsubscribed?: boolean;
firstName?: string;
lastName?: string;
properties?: CreateContactPropertiesOptions;
segments?: never;
topics?: never;
}

export interface CreateContactOptions {
Expand All @@ -33,10 +33,6 @@ export interface CreateContactOptions {
id: string;
subscription: 'opt_in' | 'opt_out';
}[];
/**
* @deprecated Use `segments` instead to add one or more segments to the new contact
*/
audienceId?: never;
}

export interface CreateContactRequestOptions extends PostOptions {}
Expand Down
Loading