unismsgateway 1.1.1 → 1.2.0

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/dist/lib/lib.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { smsPlatform, IgatewaySettings } from './platform';
1
+ import { smsPlatform, IgatewaySettings, IQuickSendPersonalized } from './platform';
2
2
  export declare function init(settings: IgatewaySettings): smsPlatform;
3
3
  export declare function getSmsPlatform(): smsPlatform;
4
4
  export declare function quickSend(param: {
@@ -7,3 +7,4 @@ export declare function quickSend(param: {
7
7
  Content: string;
8
8
  Type?: number;
9
9
  }, callback?: Function): any;
10
+ export declare function sendPersonalized(body: IQuickSendPersonalized): any;
package/dist/lib/lib.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.quickSend = exports.getSmsPlatform = exports.init = void 0;
3
+ exports.sendPersonalized = exports.quickSend = exports.getSmsPlatform = exports.init = void 0;
4
4
  const platform_1 = require("./platform");
5
5
  let smsplatform;
6
6
  function init(settings) {
@@ -17,3 +17,7 @@ function quickSend(param, callback) {
17
17
  return smsplatform.quickSend(param, callback);
18
18
  }
19
19
  exports.quickSend = quickSend;
20
+ function sendPersonalized(body) {
21
+ return smsplatform.sendPersonalized(body);
22
+ }
23
+ exports.sendPersonalized = sendPersonalized;
@@ -9,6 +9,7 @@ export declare class smsPlatform {
9
9
  Content: string;
10
10
  Type?: number;
11
11
  }, callback?: Function): any;
12
+ sendPersonalized(body: IQuickSendPersonalized): any;
12
13
  }
13
14
  export interface IgatewaySettings {
14
15
  platformId: string;
@@ -34,3 +35,17 @@ export declare enum AuthTypes {
34
35
  factor = "factor",
35
36
  key = "key"
36
37
  }
38
+ export interface IQuickSendPersonalized {
39
+ From: string;
40
+ Content: string;
41
+ Type: MessageTypes;
42
+ To: IPersonalizedDestination | IPersonalizedDestination[];
43
+ }
44
+ export interface IPersonalizedDestination {
45
+ to: number;
46
+ values: (string | number)[];
47
+ }
48
+ export declare enum MessageTypes {
49
+ Text = 0,
50
+ flash = 1
51
+ }
@@ -19,7 +19,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
19
19
  return result;
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.AuthTypes = exports.smsPlatform = void 0;
22
+ exports.MessageTypes = exports.AuthTypes = exports.smsPlatform = void 0;
23
23
  // const routesms = require('routesms')
24
24
  const hubtel_sms_extended_1 = require("hubtel-sms-extended");
25
25
  const routemobilesms_1 = require("routemobilesms");
@@ -73,6 +73,12 @@ class smsPlatform {
73
73
  throw new Error("Platform ID not recognised");
74
74
  }
75
75
  }
76
+ sendPersonalized(body) {
77
+ if (this._settings.platformId !== 'nest') {
78
+ throw new Error("Specified platform does not support personalisation");
79
+ }
80
+ return this._sms.sendPersonalized(body);
81
+ }
76
82
  }
77
83
  exports.smsPlatform = smsPlatform;
78
84
  var AuthTypes;
@@ -80,3 +86,8 @@ var AuthTypes;
80
86
  AuthTypes["factor"] = "factor";
81
87
  AuthTypes["key"] = "key";
82
88
  })(AuthTypes = exports.AuthTypes || (exports.AuthTypes = {}));
89
+ var MessageTypes;
90
+ (function (MessageTypes) {
91
+ MessageTypes[MessageTypes["Text"] = 0] = "Text";
92
+ MessageTypes[MessageTypes["flash"] = 1] = "flash";
93
+ })(MessageTypes = exports.MessageTypes || (exports.MessageTypes = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unismsgateway",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "A unified sms gateway library that brings access to multiple sms gateways under a single API",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -8,7 +8,7 @@
8
8
  "test": "echo \"Error: no test specified\" && exit 1",
9
9
  "build": "tsc",
10
10
  "prepublish": "npm run build",
11
- "publish":"git push --tags && npm publish"
11
+ "publish": "git push --tags && npm publish"
12
12
  },
13
13
  "files": [
14
14
  "dist/**/*"
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "hubtel-sms-extended": "^1.0.2",
25
- "nestsms": "^1.1.2",
25
+ "nestsms": "^1.2.1",
26
26
  "routemobilesms": "^1.0.4"
27
27
  }
28
28
  }