UNPKG

@orello/mailer

Version:

SDK for Orello Email Service — A developer-friendly toolkit to integrate email delivery, events, and interactions.

61 lines (60 loc) 1.61 kB
/** * Public SDK types */ export interface OrelloConfig { apiKey: string; timeoutMs?: number; } export interface Attachment { filename: string; content: Buffer | string | Blob; contentType?: string; } export type OrelloEvent = "QUEUED" | "SENT" | "DELIVERED" | "ERROR"; export interface OrelloMailerOption { to: string | string[]; cc?: string | string[]; bcc?: string | string[]; subject?: string; text?: string; html?: string; headers?: Record<string, string>; metadata?: Record<string, string>; attachments?: Attachment[]; sendAt?: string | Date | number; } export interface OrelloTemplateMailerOption { to: string | string[]; cc?: string | string[]; bcc?: string | string[]; data?: Record<string, any>; headers?: Record<string, string>; attachments?: Attachment[]; sendAt?: string | Date | number; } export declare class OrelloResponse { status?: number; message: string; constructor(message: string, status?: number); } /** * Custom error so callers can detect SDK vs network errors */ export declare class OrelloError extends Error { status?: number; details?: any; constructor(message: string, status?: number, details?: any); } export interface OrelloSubscriptionOptions { subscription: string; firstName?: string; lastName?: string; email: string; message?: string; } export interface OrelloMail { send: () => Promise<any>; scheduleSend: (time: Date) => Promise<void>; queue: () => Promise<void>; on: (event: OrelloEvent, callback: () => void) => void; }