Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More consistent typing for Attachments #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
24 changes: 13 additions & 11 deletions src/models/IncomingMail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;