Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
9d6b7f3b29 | |||
8be9fc38b6 | |||
6bb3bb7d9a | |||
7fcbd39166 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartmail",
|
||||
"version": "1.0.8",
|
||||
"version": "1.0.10",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartmail",
|
||||
"version": "1.0.8",
|
||||
"version": "1.0.10",
|
||||
"private": false,
|
||||
"description": "a unified format for representing and dealing with mails",
|
||||
"main": "dist/index.js",
|
||||
|
@ -1,19 +1,20 @@
|
||||
import * as plugins from './smartmail.plugins';
|
||||
|
||||
export interface ISmartmailOptions {
|
||||
export interface ISmartmailOptions<T> {
|
||||
from: string;
|
||||
subject: string;
|
||||
body: string;
|
||||
creationObjectRef?: T;
|
||||
}
|
||||
|
||||
/**
|
||||
* a standard representation for mails
|
||||
*/
|
||||
export class Smartmail {
|
||||
public options: ISmartmailOptions;
|
||||
export class Smartmail<T> {
|
||||
public options: ISmartmailOptions<T>;
|
||||
public attachments: plugins.smartfile.Smartfile[] = [];
|
||||
|
||||
constructor(optionsArg: ISmartmailOptions) {
|
||||
constructor(optionsArg: ISmartmailOptions<T>) {
|
||||
this.options = optionsArg;
|
||||
}
|
||||
|
||||
@ -21,6 +22,10 @@ export class Smartmail {
|
||||
this.attachments.push(smartfileArg);
|
||||
}
|
||||
|
||||
public getCretionObject(): T {
|
||||
return this.options.creationObjectRef;
|
||||
}
|
||||
|
||||
public getSubject(dataArg: any = {}) {
|
||||
const smartmustache = new plugins.smartmustache.SmartMustache(this.options.subject);
|
||||
return smartmustache.applyData(dataArg);
|
||||
|
Reference in New Issue
Block a user