From 2631abfcee1df7fcb391f97d0e533300fc6b729c Mon Sep 17 00:00:00 2001 From: Saksham Goyal Date: Wed, 3 Jan 2024 15:22:59 -0600 Subject: [PATCH 1/2] Update attachment types --- src/models/IncomingMail.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/models/IncomingMail.ts b/src/models/IncomingMail.ts index 8e01aa7..72f2eb3 100644 --- a/src/models/IncomingMail.ts +++ b/src/models/IncomingMail.ts @@ -51,20 +51,20 @@ 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; + size: BigInt; + disposition: "attachment" | "inline"; +} - /** - * Base64 encoded attachment content newline characters may be present and should be ignored. - */ - content?: string; +interface URLAttachment extends baseAttachment { + /** URL where the file is stored */ + url: string; +} - /** - * URL where the file is stored - */ - url?: string; +interface EmbeddedAttachment extends baseAttachment { + /** Base64 encoded attachment content newline characters may be present and should be ignored. */ + content: string; } +export type IncomingAttachment = URLAttachment | EmbeddedAttachment; From 5a3b92f16687e723b94881585251439dd0bc4c0f Mon Sep 17 00:00:00 2001 From: Saksham Goyal Date: Wed, 3 Jan 2024 16:39:53 -0600 Subject: [PATCH 2/2] Update IncomingMail.ts --- src/models/IncomingMail.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/models/IncomingMail.ts b/src/models/IncomingMail.ts index 72f2eb3..2c0723a 100644 --- a/src/models/IncomingMail.ts +++ b/src/models/IncomingMail.ts @@ -54,16 +54,18 @@ export interface IncomingSPFObject { interface baseAttachment { file_name: string; content_type: string; - size: BigInt; + size: number; disposition: "attachment" | "inline"; } interface URLAttachment extends baseAttachment { + _attachmentType : 'url'; /** 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; }