1
0
mirror of https://github.com/matt-fidd/stratos.git synced 2026-01-01 22:19:26 +00:00

Make EmailBuilder fields private

This commit is contained in:
2022-02-14 20:53:46 +00:00
parent 1c680b076a
commit c85166a7a0

View File

@@ -26,48 +26,48 @@ class EmailBuilder {
* The subject of the email * The subject of the email
* @type {string} * @type {string}
*/ */
subject; #subject;
/** /**
* The plaintext body of the email * The plaintext body of the email
* @type {string} * @type {string}
*/ */
body; #body;
/** /**
* The html body of the email * The html body of the email
* @type {string} * @type {string}
*/ */
HTMLBody; #HTMLBody;
/** /**
* The from address for the email * The from address for the email
* @type {string} * @type {string}
*/ */
from = 'Stratos <contact@stratos.com>'; #from = 'Stratos <stratos@heliumdev.uk>';
/** /**
* The addresses to send to * The addresses to send to
* @type {Array<string>} * @type {Array<string>}
*/ */
to; #to;
/** /**
* The addresses to carbon copy to * The addresses to carbon copy to
* @type {Array<string>} * @type {Array<string>}
*/ */
cc; #cc;
/** /**
* The addresses to blind carbon copy to * The addresses to blind carbon copy to
* @type {Array<string>} * @type {Array<string>}
*/ */
bcc; #bcc;
constructor() { constructor() {
this.to = []; this.#to = [];
this.cc = []; this.#cc = [];
this.bcc = []; this.#bcc = [];
} }
/** /**
@@ -76,7 +76,7 @@ class EmailBuilder {
* @returns {EmailBuilder} * @returns {EmailBuilder}
*/ */
setSubject(subject) { setSubject(subject) {
this.subject = subject; this.#subject = subject;
return this; return this;
} }
@@ -86,7 +86,7 @@ class EmailBuilder {
* @returns {EmailBuilder} * @returns {EmailBuilder}
*/ */
setBody(body) { setBody(body) {
this.body = body; this.#body = body;
return this; return this;
} }
@@ -96,7 +96,7 @@ class EmailBuilder {
* @returns {EmailBuilder} * @returns {EmailBuilder}
*/ */
setHTMLBody(HTMLBody) { setHTMLBody(HTMLBody) {
this.HTMLBody = HTMLBody; this.#HTMLBody = HTMLBody;
return this; return this;
} }
@@ -106,7 +106,7 @@ class EmailBuilder {
* @returns {EmailBuilder} * @returns {EmailBuilder}
*/ */
setFrom(from) { setFrom(from) {
this.from = from; this.#from = from;
return this; return this;
} }
@@ -116,8 +116,8 @@ class EmailBuilder {
* @returns {EmailBuilder} * @returns {EmailBuilder}
*/ */
addTo(addresses) { addTo(addresses) {
const newAddresses = removeDupes(addresses, this.to); const newAddresses = removeDupes(addresses, this.#to);
this.to.push(...newAddresses); this.#to.push(...newAddresses);
return this; return this;
} }
@@ -127,7 +127,7 @@ class EmailBuilder {
* @returns {EmailBuilder} * @returns {EmailBuilder}
*/ */
removeTo(addresses) { removeTo(addresses) {
this.to = removeDupes(this.to, addresses); this.#to = removeDupes(this.#to, addresses);
return this; return this;
} }
@@ -137,8 +137,8 @@ class EmailBuilder {
* @returns {EmailBuilder} * @returns {EmailBuilder}
*/ */
addCC(addresses) { addCC(addresses) {
const newAddresses = removeDupes(addresses, this.to); const newAddresses = removeDupes(addresses, this.#to);
this.cc.push(...newAddresses); this.#cc.push(...newAddresses);
return this; return this;
} }
@@ -148,7 +148,7 @@ class EmailBuilder {
* @returns {EmailBuilder} * @returns {EmailBuilder}
*/ */
removeCC(addresses) { removeCC(addresses) {
this.cc = removeDupes(this.cc, addresses); this.#cc = removeDupes(this.#cc, addresses);
return this; return this;
} }
@@ -158,8 +158,8 @@ class EmailBuilder {
* @returns {EmailBuilder} * @returns {EmailBuilder}
*/ */
addBCC(addresses) { addBCC(addresses) {
const newAddresses = removeDupes(addresses, this.to); const newAddresses = removeDupes(addresses, this.#to);
this.bcc.push(...newAddresses); this.#bcc.push(...newAddresses);
return this; return this;
} }
@@ -169,7 +169,7 @@ class EmailBuilder {
* @returns {EmailBuilder} * @returns {EmailBuilder}
*/ */
removeBCC(addresses) { removeBCC(addresses) {
this.bcc = removeDupes(this.bcc, addresses); this.#bcc = removeDupes(this.#bcc, addresses);
return this; return this;
} }
} }