diff --git a/src/models/IncomingMail.ts b/src/models/IncomingMail.ts index 8e01aa7..2c0723a 100644 --- a/src/models/IncomingMail.ts +++ b/src/models/IncomingMail.ts @@ -51,20 +51,22 @@ export interface IncomingSPFObject { * within the content parameters of an embedded attachment. When using an attachment * store the URL to the file location will be passed. */ -export interface IncomingAttachment { +interface baseAttachment { file_name: string; content_type: string; size: number; - disposition?: string; - content_id?: string; + disposition: "attachment" | "inline"; +} - /** - * Base64 encoded attachment content newline characters may be present and should be ignored. - */ - content?: string; +interface URLAttachment extends baseAttachment { + _attachmentType : 'url'; + /** URL where the file is stored */ + url: string; +} - /** - * URL where the file is stored - */ - url?: string; +interface EmbeddedAttachment extends baseAttachment { + _attachmentType : 'embedded'; + /** Base64 encoded attachment content newline characters may be present and should be ignored. */ + content: string; } +export type IncomingAttachment = URLAttachment | EmbeddedAttachment;