mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-04-19 14:52:34 +00:00
84 lines
1.5 KiB
TypeScript
84 lines
1.5 KiB
TypeScript
export class Mail
|
|
{
|
|
id: string;
|
|
from: {
|
|
name: string,
|
|
avatar: string,
|
|
email: string
|
|
};
|
|
to: {
|
|
name: string,
|
|
email: string
|
|
}[];
|
|
subject: string;
|
|
message: string;
|
|
time: string;
|
|
read: boolean;
|
|
starred: boolean;
|
|
important: boolean;
|
|
hasAttachments: boolean;
|
|
attachments: {
|
|
type: string,
|
|
fileName: string,
|
|
preview: string,
|
|
url: string,
|
|
size: string
|
|
}[];
|
|
labels: string[];
|
|
folder: string;
|
|
|
|
/**
|
|
* Constructor
|
|
*
|
|
* @param mail
|
|
*/
|
|
constructor(mail)
|
|
{
|
|
this.id = mail.id;
|
|
this.from = mail.from;
|
|
this.to = mail.to;
|
|
this.subject = mail.subject;
|
|
this.message = mail.message;
|
|
this.time = mail.time;
|
|
this.read = mail.read;
|
|
this.starred = mail.starred;
|
|
this.important = mail.important;
|
|
this.hasAttachments = mail.hasAttachments;
|
|
this.attachments = mail.attachments;
|
|
this.labels = mail.labels;
|
|
this.folder = mail.folder;
|
|
}
|
|
|
|
/**
|
|
* Toggle star
|
|
*/
|
|
toggleStar(): void
|
|
{
|
|
this.starred = !this.starred;
|
|
}
|
|
|
|
/**
|
|
* Toggle important
|
|
*/
|
|
toggleImportant(): void
|
|
{
|
|
this.important = !this.important;
|
|
}
|
|
|
|
/**
|
|
* Mark as read
|
|
*/
|
|
markRead(): void
|
|
{
|
|
this.read = true;
|
|
}
|
|
|
|
/**
|
|
* Mark as unread
|
|
*/
|
|
markUnread(): void
|
|
{
|
|
this.read = false;
|
|
}
|
|
}
|