Skip to content

Commit

Permalink
feat: Add JSdoc for create email types (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
jayanratna authored Aug 15, 2023
1 parent d8ac236 commit b99a27e
Showing 1 changed file with 74 additions and 1 deletion.
75 changes: 74 additions & 1 deletion src/emails/interfaces/create-email-options.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,77 @@ import { PostOptions } from '../../common/interfaces';
import { RequireAtLeastOne } from 'type-fest';

interface CreateEmailBaseOptions {
/**
* Filename and content of attachments (max 40mb per email)
*
* @link https://resend.com/api-reference/emails/send-email#body-parameters
*/
attachments?: Attachment[];
/**
* Blind carbon copy recipient email address. For multiple addresses, send as an array of strings.
*
* @link https://resend.com/api-reference/emails/send-email#body-parameters
*/
bcc?: string | string[];
/**
* Carbon copy recipient email address. For multiple addresses, send as an array of strings.
*
* @link https://resend.com/api-reference/emails/send-email#body-parameters
*/
cc?: string | string[];
/**
* Sender email address. To include a friendly name, use the format `"Your Name <sender@domain.com>"`
*
* @link https://resend.com/api-reference/emails/send-email#body-parameters
*/
from: string;
/**
* Custom headers to add to the email.
*
* @link https://resend.com/api-reference/emails/send-email#body-parameters
*/
headers?: Record<string, string>;
/**
* The React component used to write the message.
*
* @link https://resend.com/api-reference/emails/send-email#body-parameters
*/
react?: React.ReactElement | React.ReactNode | null;
/**
* The HTML version of the message.
*
* @link https://resend.com/api-reference/emails/send-email#body-parameters
*/
html?: string;
/**
* The plain text version of the message.
*
* @link https://resend.com/api-reference/emails/send-email#body-parameters
*/
text?: string;
/**
* Reply-to email address. For multiple addresses, send as an array of strings.
*
* @link https://resend.com/api-reference/emails/send-email#body-parameters
*/
reply_to?: string | string[];
/**
* Email subject.
*
* @link https://resend.com/api-reference/emails/send-email#body-parameters
*/
subject: string;
/**
* Email tags
*
* @link https://resend.com/api-reference/emails/send-email#body-parameters
*/
tags?: Tag[];
/**
* Recipient email address. For multiple addresses, send as an array of strings. Max 50.
*
* @link https://resend.com/api-reference/emails/send-email#body-parameters
*/
to: string | string[];
}

Expand All @@ -25,13 +85,26 @@ export type CreateEmailOptions = RequireAtLeastOne<
export interface CreateEmailRequestOptions extends PostOptions {}

export interface CreateEmailResponse {
/** The ID of the newly created email. */
id: string;
}

interface Attachment {
/** Content of an attached file. */
content?: string | Buffer;
/** Name of attached file. */
filename?: string | false | undefined;
/** Path where the attachment file is hosted */
path?: string;
}

export type Tag = { name: string; value: string };
export type Tag = {
/**
* The name of the email tag. It can only contain ASCII letters (a–z, A–Z), numbers (0–9), underscores (_), or dashes (-). It can contain no more than 256 characters.
*/
name: string;
/**
* The value of the email tag. It can only contain ASCII letters (a–z, A–Z), numbers (0–9), underscores (_), or dashes (-). It can contain no more than 256 characters.
*/
value: string;
};

0 comments on commit b99a27e

Please sign in to comment.