sdx-mailer-sdk 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdx-mailer-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "A api rest sdx-mailer-sender sdk",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,9 +21,7 @@ export default class CourierMail {
21
21
  request.receiver = receiver
22
22
  request.reply_mail = reply_mail
23
23
  if(btn_label != null || btn_link != null){
24
- request.link = new CourierLink();
25
- request.link.btn_label = btn_label
26
- request.link.btn_link = btn_link
24
+ request.link = new CourierLink(btn_label,btn_link);
27
25
  }
28
26
  return request;
29
27
  }
@@ -32,19 +30,19 @@ export default class CourierMail {
32
30
  return new CourierExceptionRequest(error,detail,context);
33
31
  }
34
32
 
35
- public async sendCourierMail(endpoint:string,tokenRQ:any,productId:number,isBasic:boolean) {
33
+ public async sendCourierMail(basicAuth:string|null,endpoint:string,tokenRQ:any,productId:number,isBasic:boolean) {
36
34
  const url = endpoint + '/courier' + ((isBasic)? '/basic' : '');
37
35
  if(!Commons.validField(tokenRQ.trx)){
38
36
  throw WebServiceException.BAD_REQUEST("Request must be signed")
39
37
  }
40
- return await this.service.postMail(null, tokenRQ, url, 'sendContactMail',productId);
38
+ return await this.service.postMail(basicAuth, tokenRQ, url, 'sendContactMail',productId);
41
39
  }
42
40
 
43
- public async sendExceptionMail(endpoint:string,tokenRQ:any,productId:number) {
41
+ public async sendExceptionMail(basicAuth:string|null,endpoint:string,tokenRQ:any,productId:number) {
44
42
  const url = endpoint + '/courier';
45
43
  if(!Commons.validField(tokenRQ.trx)){
46
44
  throw WebServiceException.BAD_REQUEST("Request must be signed")
47
45
  }
48
- return await this.service.postMail(null, tokenRQ, url, 'sendContactMail',productId);
46
+ return await this.service.postMail(basicAuth, tokenRQ, url, 'sendContactMail',productId);
49
47
  }
50
48
  }
@@ -1,4 +1,10 @@
1
1
  export default class CourierLink {
2
+
3
+ constructor(btn_label:string|null,btn_link:string|null){
4
+ this.btn_label = btn_label
5
+ this.btn_link = btn_link
6
+ }
7
+
2
8
  public btn_label:string|null;
3
9
  public btn_link:string|null;
4
10
  }
@@ -1,10 +1,10 @@
1
1
  import CourierLink from "./CourierLink";
2
2
 
3
3
  export default class CourierRequest {
4
- public subject: string;
5
- public title: string;
6
- public message:string;
7
- public receiver:string;
8
- public reply_mail:string;
9
- public link:CourierLink|null;
4
+ public subject!: string;
5
+ public title!: string;
6
+ public message!:string;
7
+ public receiver!:string;
8
+ public reply_mail!:string;
9
+ public link!:CourierLink|null;
10
10
  }
@@ -2,7 +2,7 @@
2
2
  export default class ServiceResponse {
3
3
  public code: number
4
4
  public message: string
5
- public detail: string
5
+ public detail: string | undefined
6
6
 
7
7
  constructor(code: number, message: string) {
8
8
  this.code = code
@@ -3,7 +3,7 @@ import Commons from '../utils/Commons';
3
3
 
4
4
  export default class CourierService {
5
5
  public async postMail(basicAuth: string | null, body: any, url: string, methodName: string, productId: number) {
6
- const res = await axios.post(url, body, this.buildOptions(basicAuth, true,productId)).catch(function (err) {
6
+ const res = await axios.post(url, body, this.buildOptions(basicAuth, true,productId)).catch(function (err:any) {
7
7
  throw Commons.buildWebServiceException(err, 'POST', methodName);
8
8
  });
9
9
  return res.data;
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es6",
4
+ "module": "es6",
5
+ "moduleResolution":"node",
6
+ "outDir": "./dist",
7
+ "strict": true
8
+ },
9
+ "include": [
10
+ "src/**/*.ts"
11
+ ],
12
+ "exclude": [
13
+ "node_modules"
14
+ ]
15
+ }
16
+