unismsgateway 1.3.1 → 1.3.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/README.md +187 -111
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,23 +34,27 @@ import { init, getSmsPlatform, reset, smsPlatform } from 'unismsgateway';
|
|
|
34
34
|
|
|
35
35
|
### `IgatewaySettings`
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
|
40
|
-
| `
|
|
37
|
+
|
|
38
|
+
| Field | Type | Description |
|
|
39
|
+
| ------------ | --------------- | -------------------------------------- |
|
|
40
|
+
| `platformId` | `'route' | 'hubtel' |
|
|
41
|
+
| `param` | `IgatewayParam` | Provider-specific options (see below). |
|
|
42
|
+
|
|
41
43
|
|
|
42
44
|
### `IgatewayParam` (all fields optional except what your `platformId` requires)
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
|
47
|
-
| `
|
|
48
|
-
| `
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
46
|
+
|
|
47
|
+
| Field | Type | Used by | Description |
|
|
48
|
+
| -------------- | -------- | --------------- | ---------------------------------------------------------------------- |
|
|
49
|
+
| `username` | `string` | `route` | Route Mobile account username. **Required** for `route`. |
|
|
50
|
+
| `password` | `string` | `route` | Route Mobile account password. **Required** for `route`. |
|
|
51
|
+
| `host` | `string` | `route`, `nest` | API host. See per-gateway defaults below. |
|
|
52
|
+
| `port` | `number` | `route` | TCP port for Route Mobile. Default: `8080`. |
|
|
53
|
+
| `protocol` | `'http' | 'https'` | `route`, `nest` |
|
|
54
|
+
| `clientId` | `string` | `hubtel` | Hubtel client ID. **Required** for `hubtel`. |
|
|
55
|
+
| `clientSecret` | `string` | `hubtel` | Hubtel client secret. **Required** for `hubtel`. |
|
|
56
|
+
| `apiKey` | `string` | `nest` | SMSOnlineGH API key (`Authorization: key …`). **Required** for `nest`. |
|
|
57
|
+
|
|
54
58
|
|
|
55
59
|
Validation runs in `smsPlatform` when the instance is constructed: missing required fields for the chosen `platformId` throw `Error` with a clear message.
|
|
56
60
|
|
|
@@ -58,47 +62,72 @@ Validation runs in `smsPlatform` when the instance is constructed: missing requi
|
|
|
58
62
|
|
|
59
63
|
## Environment variables
|
|
60
64
|
|
|
61
|
-
|
|
65
|
+
There are **two separate contexts**. Use the section that matches what you are doing.
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
| Context | Who reads env? | Purpose |
|
|
69
|
+
| --------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------ |
|
|
70
|
+
| **Library usage** (`init()` in your app) | **Your code** — this package does **not** read `process.env`. | You choose variable names and map them into `platformId` and `param` yourself. |
|
|
71
|
+
| **Live integration test** (`npm test` / `scripts/test-live.ts`) | **The test script** via `dotenv` and `process.env`. | Fixed names in `.env` (see `.env.example`). |
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
### Library usage: required and optional param fields
|
|
77
|
+
|
|
78
|
+
Nothing is read from the environment unless **you** wire it. Required fields are determined only by `platformId`:
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
| `platformId` | Required in `param` | Optional in `param` (defaults in this library) |
|
|
82
|
+
| ------------ | -------------------------- | --------------------------------------------------------------------------------------------- |
|
|
83
|
+
| `nest` | `apiKey` | `host` (default `api.smsonlinegh.com`), `protocol` (default `https`) |
|
|
84
|
+
| `hubtel` | `clientId`, `clientSecret` | — |
|
|
85
|
+
| `route` | `username`, `password` | `host` (default `rslr.connectbind.com`), `protocol` (default `http`), `port` (default `8080`) |
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
**Suggested env names for your app** (optional; you can rename them). Credential keys (`NEST_`*, `HUBTEL_`*, `ROUTE_*`) match [live test](#live-integration-test-environment-variables) and `.env.example`. Platform selection differs: the test script requires `GATEWAY_PLATFORM` (or `TEST_ALL`); in your app you choose any name (the example below uses `SMS_PLATFORM_ID`):
|
|
62
89
|
|
|
63
|
-
In your own application it is common to map environment variables into `param`. Suggested names (you define these in `.env` or your host’s secret store):
|
|
64
90
|
|
|
65
|
-
|
|
|
66
|
-
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
| `
|
|
77
|
-
| `SMSONLINEGH_PROTOCOL` or `NEST_PROTOCOL` | `protocol` | `nest` (optional) |
|
|
91
|
+
| Env name (suggestion) | Maps to `param` | Required when `platformId` is |
|
|
92
|
+
| ---------------------- | -------------------------- | ----------------------------- |
|
|
93
|
+
| `NEST_API_KEY` | `apiKey` | `nest` |
|
|
94
|
+
| `NEST_HOST` | `host` | optional for `nest` |
|
|
95
|
+
| `NEST_PROTOCOL` | `protocol` | optional for `nest` |
|
|
96
|
+
| `HUBTEL_CLIENT_ID` | `clientId` | `hubtel` |
|
|
97
|
+
| `HUBTEL_CLIENT_SECRET` | `clientSecret` | `hubtel` |
|
|
98
|
+
| `ROUTE_USERNAME` | `username` | `route` |
|
|
99
|
+
| `ROUTE_PASSWORD` | `password` | `route` |
|
|
100
|
+
| `ROUTE_HOST` | `host` | optional for `route` |
|
|
101
|
+
| `ROUTE_PORT` | `port` (use `Number(...)`) | optional for `route` |
|
|
102
|
+
| `ROUTE_PROTOCOL` | `protocol` | optional for `route` |
|
|
78
103
|
|
|
79
|
-
|
|
104
|
+
|
|
105
|
+
You may also use names like `SMSONLINEGH_API_KEY` / `SMSONLINEGH_HOST` in your app only — there is **no** built-in support for alternate names in the test script; that script expects `NEST_`* and `ROUTE_`* as in `.env.example`.
|
|
106
|
+
|
|
107
|
+
Example wiring: branch on `platformId` and build `param` so you do not mix unrelated fields.
|
|
80
108
|
|
|
81
109
|
```javascript
|
|
82
110
|
const unisms = require('unismsgateway');
|
|
83
111
|
|
|
112
|
+
// Pick any env name for the active gateway; the live test uses GATEWAY_PLATFORM instead.
|
|
84
113
|
const platformId = process.env.SMS_PLATFORM_ID;
|
|
85
114
|
|
|
86
115
|
const paramByPlatform = {
|
|
87
116
|
route: {
|
|
88
|
-
username: process.env.
|
|
89
|
-
password: process.env.
|
|
90
|
-
host: process.env.
|
|
91
|
-
port: process.env.
|
|
92
|
-
protocol: process.env.
|
|
117
|
+
username: process.env.ROUTE_USERNAME,
|
|
118
|
+
password: process.env.ROUTE_PASSWORD,
|
|
119
|
+
host: process.env.ROUTE_HOST,
|
|
120
|
+
port: process.env.ROUTE_PORT ? Number(process.env.ROUTE_PORT) : undefined,
|
|
121
|
+
protocol: process.env.ROUTE_PROTOCOL
|
|
93
122
|
},
|
|
94
123
|
hubtel: {
|
|
95
124
|
clientId: process.env.HUBTEL_CLIENT_ID,
|
|
96
125
|
clientSecret: process.env.HUBTEL_CLIENT_SECRET
|
|
97
126
|
},
|
|
98
127
|
nest: {
|
|
99
|
-
apiKey: process.env.
|
|
100
|
-
host: process.env.
|
|
101
|
-
protocol: process.env.
|
|
128
|
+
apiKey: process.env.NEST_API_KEY,
|
|
129
|
+
host: process.env.NEST_HOST,
|
|
130
|
+
protocol: process.env.NEST_PROTOCOL
|
|
102
131
|
}
|
|
103
132
|
};
|
|
104
133
|
|
|
@@ -110,19 +139,76 @@ const gateway = unisms.init({
|
|
|
110
139
|
|
|
111
140
|
---
|
|
112
141
|
|
|
113
|
-
|
|
142
|
+
### Live integration test environment variables
|
|
143
|
+
|
|
144
|
+
The script `scripts/test-live.ts` loads `.env` (copy from `.env.example`) and expects **these exact names**. It does not use `SMS_PLATFORM_ID` or other app-specific aliases.
|
|
145
|
+
|
|
146
|
+
#### How a run is selected
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
| Variable | Required? | Description |
|
|
150
|
+
| ------------------ | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
151
|
+
| `GATEWAY_PLATFORM` | **Yes**, unless you use `TEST_ALL` | Must be exactly `nest`, `hubtel`, or `route`. |
|
|
152
|
+
| `TEST_ALL` | Optional | If set to `true`, the script runs `nest`, then `hubtel`, then `route` in order. You still need the **required** variables below for each platform you run; missing keys for a step cause that step to fail. |
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
#### Per gateway — credentials and overrides
|
|
156
|
+
|
|
157
|
+
`**nest` (SMSOnlineGH)**
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
| Variable | Required? | Purpose |
|
|
161
|
+
| --------------- | --------- | --------------------------------------------- |
|
|
162
|
+
| `NEST_API_KEY` | **Yes** | Maps to `param.apiKey`. |
|
|
163
|
+
| `NEST_HOST` | No | Overrides default host `api.smsonlinegh.com`. |
|
|
164
|
+
| `NEST_PROTOCOL` | No | Overrides default `https`. |
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
`**hubtel`**
|
|
168
|
+
|
|
114
169
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
- Returns the `smsPlatform` instance.
|
|
170
|
+
| Variable | Required? | Purpose |
|
|
171
|
+
| ---------------------- | --------- | ----------------------------- |
|
|
172
|
+
| `HUBTEL_CLIENT_ID` | **Yes** | Maps to `param.clientId`. |
|
|
173
|
+
| `HUBTEL_CLIENT_SECRET` | **Yes** | Maps to `param.clientSecret`. |
|
|
120
174
|
|
|
121
|
-
2. **`smsPlatform` constructor** (in `src/lib/platform.ts`):
|
|
122
|
-
- Runs `validateSettings()` (platform id + required `param` fields for that id).
|
|
123
|
-
- Calls `createGateway()` to instantiate the underlying provider (`routeSms`, `HubtelSms`, or `NestSmsGateway`).
|
|
124
175
|
|
|
125
|
-
|
|
176
|
+
`**route` (Route Mobile)**
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
| Variable | Required? | Purpose |
|
|
180
|
+
| ---------------- | --------- | --------------------------------------------------- |
|
|
181
|
+
| `ROUTE_USERNAME` | **Yes** | Maps to `param.username`. |
|
|
182
|
+
| `ROUTE_PASSWORD` | **Yes** | Maps to `param.password`. |
|
|
183
|
+
| `ROUTE_HOST` | No | Overrides default `rslr.connectbind.com`. |
|
|
184
|
+
| `ROUTE_PORT` | No | Overrides default `8080` (set as a numeric string). |
|
|
185
|
+
| `ROUTE_PROTOCOL` | No | Overrides default `http`. |
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
#### Live send (optional; all gateways)
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
| Variable | Required? | Purpose |
|
|
192
|
+
| -------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
193
|
+
| `TEST_SEND` | No (default: do not send) | Set to `true` to call `quickSend()` and send a real SMS. If unset or not `true`, only init and balance checks run. |
|
|
194
|
+
| `TEST_FROM` | **Yes** when `TEST_SEND=true` | `QuickSendParams.From`. |
|
|
195
|
+
| `TEST_TO` | **Yes** when `TEST_SEND=true` | `QuickSendParams.To`. |
|
|
196
|
+
| `TEST_CONTENT` | No | Message body; if omitted, the script uses a built-in default string. |
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## How initialization works
|
|
202
|
+
|
|
203
|
+
1. `**init(settings: IgatewaySettings): smsPlatform`** (in `src/lib/lib.ts`):
|
|
204
|
+
- Validates and constructs a new `smsPlatform` with your `settings`.
|
|
205
|
+
- Stores it as the **module singleton** (`smsPlatformInstance`).
|
|
206
|
+
- Calls `smsPlatform.init()` on that instance (returns the same facade for chaining).
|
|
207
|
+
- Returns the `smsPlatform` instance.
|
|
208
|
+
2. `**smsPlatform` constructor** (in `src/lib/platform.ts`):
|
|
209
|
+
- Runs `validateSettings()` (platform id + required `param` fields for that id).
|
|
210
|
+
- Calls `createGateway()` to instantiate the underlying provider (`routeSms`, `HubtelSms`, or `NestSmsGateway`).
|
|
211
|
+
3. `**getSmsPlatform(): smsPlatform | null`**: Returns the current singleton, or `null` if `reset()` was called and no new `init()` has run.
|
|
126
212
|
|
|
127
213
|
There is **no async bootstrap**; after `init()` returns, `quickSend` is ready.
|
|
128
214
|
|
|
@@ -130,8 +216,8 @@ There is **no async bootstrap**; after `init()` returns, `quickSend` is ready.
|
|
|
130
216
|
|
|
131
217
|
## Re-initializing and reset
|
|
132
218
|
|
|
133
|
-
- **Switch platform or credentials:** Call
|
|
134
|
-
- **Clear the singleton:**
|
|
219
|
+
- **Switch platform or credentials:** Call `**init(newSettings)`** again. Each call **replaces** the stored singleton with a new `smsPlatform`. You do not have to call `reset()` first.
|
|
220
|
+
- **Clear the singleton:** `**reset()`** sets the internal reference to `null`. `getSmsPlatform()` then returns `null` until the next `init()`. Use this when you want to guarantee nothing holds a gateway instance (e.g. tests or explicit teardown).
|
|
135
221
|
|
|
136
222
|
```javascript
|
|
137
223
|
const unisms = require('unismsgateway');
|
|
@@ -151,11 +237,15 @@ const c = unisms.init({ platformId: 'nest', param: { apiKey: 'key-2' } });
|
|
|
151
237
|
|
|
152
238
|
## Supported gateways
|
|
153
239
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
|
157
|
-
| `
|
|
158
|
-
| `
|
|
240
|
+
|
|
241
|
+
| `platformId` | Provider | Package / implementation |
|
|
242
|
+
| ------------ | ------------------ | --------------------------------------- |
|
|
243
|
+
| `route` | Route Mobile | `routemobilesms` |
|
|
244
|
+
| `hubtel` | Hubtel SMS (Ghana) | `hubtel-sms-extended` |
|
|
245
|
+
| `nest` | SMSOnlineGH | Built-in REST client (`NestSmsGateway`) |
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
**Configuration vs env:** Required and optional `param` fields are summarized in [Library usage: required and optional param fields](#library-usage-required-and-optional-param-fields). The live test runner’s `.env` names are listed in [Live integration test environment variables](#live-integration-test-environment-variables).
|
|
159
249
|
|
|
160
250
|
### `route` (Route Mobile)
|
|
161
251
|
|
|
@@ -163,11 +253,13 @@ const c = unisms.init({ platformId: 'nest', param: { apiKey: 'key-2' } });
|
|
|
163
253
|
|
|
164
254
|
**Optional `param` (defaults in this library):**
|
|
165
255
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
|
169
|
-
| `
|
|
170
|
-
| `
|
|
256
|
+
|
|
257
|
+
| Field | Default if omitted |
|
|
258
|
+
| ---------- | ---------------------- |
|
|
259
|
+
| `host` | `rslr.connectbind.com` |
|
|
260
|
+
| `protocol` | `'http'` |
|
|
261
|
+
| `port` | `8080` |
|
|
262
|
+
|
|
171
263
|
|
|
172
264
|
These are passed into `routeSms` from `routemobilesms`.
|
|
173
265
|
|
|
@@ -206,12 +298,14 @@ const gateway = unisms.init({
|
|
|
206
298
|
|
|
207
299
|
**Optional `param`:**
|
|
208
300
|
|
|
209
|
-
| Field | Default if omitted |
|
|
210
|
-
|-------|-------------------|
|
|
211
|
-
| `host` | `api.smsonlinegh.com` |
|
|
212
|
-
| `protocol` | `'https'` |
|
|
213
301
|
|
|
214
|
-
|
|
302
|
+
| Field | Default if omitted |
|
|
303
|
+
| ---------- | --------------------- |
|
|
304
|
+
| `host` | `api.smsonlinegh.com` |
|
|
305
|
+
| `protocol` | `'https'` |
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
Requests use `POST` to path `**/v5/<endpoint>`** (e.g. send: `message/sms/send`, balance: `account/balance`). Authorization header: `Authorization: key <apiKey>`.
|
|
215
309
|
|
|
216
310
|
```javascript
|
|
217
311
|
const gateway = unisms.init({
|
|
@@ -242,18 +336,20 @@ console.log(balance.balance, balance.model);
|
|
|
242
336
|
|
|
243
337
|
### `QuickSendParams`
|
|
244
338
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
|
248
|
-
| `
|
|
249
|
-
| `
|
|
250
|
-
| `
|
|
339
|
+
|
|
340
|
+
| Field | Type | Required | Description |
|
|
341
|
+
| --------- | -------- | -------- | ---------------------------------------------------------------------- |
|
|
342
|
+
| `From` | `string` | yes | Sender ID or label. |
|
|
343
|
+
| `To` | `string | number` | yes |
|
|
344
|
+
| `Content` | `string` | yes | Message body. |
|
|
345
|
+
| `Type` | `number` | no | Message type; **nest** maps this to request body `type` (default `0`). |
|
|
346
|
+
|
|
251
347
|
|
|
252
348
|
### `quickSend(params, callback?)`
|
|
253
349
|
|
|
254
350
|
Returns `Promise<SendResult>`. Optional `callback` is invoked with the same result when the promise completes.
|
|
255
351
|
|
|
256
|
-
|
|
352
|
+
`**SendResult`:**
|
|
257
353
|
|
|
258
354
|
```typescript
|
|
259
355
|
{
|
|
@@ -314,7 +410,7 @@ There is no unit test suite in this package. For **manual integration checks** a
|
|
|
314
410
|
**Setup**
|
|
315
411
|
|
|
316
412
|
1. Clone the repo and install dependencies: `npm install`
|
|
317
|
-
2. Copy `.env.example` to `.env` and
|
|
413
|
+
2. Copy `.env.example` to `.env` and set variables for your chosen platform — see [Live integration test environment variables](#live-integration-test-environment-variables) for required vs optional names per gateway.
|
|
318
414
|
3. Run:
|
|
319
415
|
|
|
320
416
|
```bash
|
|
@@ -323,59 +419,39 @@ npm test
|
|
|
323
419
|
npm run test:live
|
|
324
420
|
```
|
|
325
421
|
|
|
326
|
-
**Selecting a platform**
|
|
327
|
-
|
|
328
|
-
| Env variable | Description |
|
|
329
|
-
|--------------|-------------|
|
|
330
|
-
| `GATEWAY_PLATFORM` | One of `nest`, `hubtel`, or `route`. Required unless you use `TEST_ALL`. |
|
|
331
|
-
| `TEST_ALL` | If set to `true`, runs tests for `nest`, `hubtel`, and `route` in sequence (each needs its env vars set). |
|
|
332
|
-
|
|
333
422
|
**What runs**
|
|
334
423
|
|
|
335
424
|
1. **Init** — Builds `param` from your `.env`, calls `init()`, and checks configuration validation.
|
|
336
425
|
2. **Balance** — For `nest` and `hubtel` only, calls `getBalance()` when the adapter supports it. `route` skips this step.
|
|
337
|
-
3. **Send** — **Opt-in.** By default no SMS is sent. Set `TEST_SEND=true`
|
|
426
|
+
3. **Send** — **Opt-in.** By default no SMS is sent. Set `TEST_SEND=true` and the send-related variables listed in [Live integration test environment variables](#live-integration-test-environment-variables).
|
|
338
427
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
Variables below match `.env.example` and `scripts/test-live.ts`.
|
|
342
|
-
|
|
343
|
-
| Variable | Required when | Purpose |
|
|
344
|
-
|----------|----------------|---------|
|
|
345
|
-
| `GATEWAY_PLATFORM` | Unless `TEST_ALL=true` | `nest` \| `hubtel` \| `route` |
|
|
346
|
-
| `TEST_ALL` | Optional | `true` to test all three platforms |
|
|
347
|
-
| `NEST_API_KEY` | `nest` | SMSOnlineGH API key |
|
|
348
|
-
| `NEST_HOST`, `NEST_PROTOCOL` | `nest` | Optional overrides |
|
|
349
|
-
| `HUBTEL_CLIENT_ID`, `HUBTEL_CLIENT_SECRET` | `hubtel` | Hubtel credentials |
|
|
350
|
-
| `ROUTE_USERNAME`, `ROUTE_PASSWORD` | `route` | Route Mobile credentials |
|
|
351
|
-
| `ROUTE_HOST`, `ROUTE_PORT`, `ROUTE_PROTOCOL` | `route` | Optional overrides |
|
|
352
|
-
| `TEST_SEND` | To send SMS | Set to `true` to enable live send |
|
|
353
|
-
| `TEST_FROM`, `TEST_TO` | When `TEST_SEND=true` | Sender and recipient |
|
|
354
|
-
| `TEST_CONTENT` | When `TEST_SEND=true` | Message body (script has a default if omitted) |
|
|
355
|
-
|
|
356
|
-
The script loads `.env` via `dotenv` (dev dependency). Exit code is `0` when all checks pass, non-zero if a step fails or no platform is selected.
|
|
428
|
+
Full variable reference (selection, per-gateway credentials, live send): [Live integration test environment variables](#live-integration-test-environment-variables). The script loads `.env` via `dotenv` (dev dependency). Exit code is `0` when all checks pass, non-zero if a step fails or no platform is selected.
|
|
357
429
|
|
|
358
430
|
---
|
|
359
431
|
|
|
360
432
|
## API reference
|
|
361
433
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
|
434
|
+
|
|
435
|
+
| Export | Description |
|
|
436
|
+
| ------------------ | -------------------------------------------------------------------- |
|
|
437
|
+
| `init(settings)` | Create and register the singleton `smsPlatform`, return it. |
|
|
365
438
|
| `getSmsPlatform()` | Current `smsPlatform` or `null` after `reset()` and before `init()`. |
|
|
366
|
-
| `reset()`
|
|
367
|
-
| `smsPlatform`
|
|
439
|
+
| `reset()` | Clear the singleton. |
|
|
440
|
+
| `smsPlatform` | Class type for typing/advanced use. |
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
`**smsPlatform` instance methods**
|
|
444
|
+
|
|
368
445
|
|
|
369
|
-
|
|
446
|
+
| Method | Returns | Description |
|
|
447
|
+
| ------------------------------ | --------------------- | ---------------------------------------------- |
|
|
448
|
+
| `init()` | `ISmsGateway` | Returns `this` (facade). |
|
|
449
|
+
| `quickSend(params, callback?)` | `Promise<SendResult>` | Delegates to the active gateway. |
|
|
450
|
+
| `getGateway()` | `ISmsGateway` | Underlying adapter (for nest: `getBalance()`). |
|
|
370
451
|
|
|
371
|
-
| Method | Returns | Description |
|
|
372
|
-
|--------|---------|-------------|
|
|
373
|
-
| `init()` | `ISmsGateway` | Returns `this` (facade). |
|
|
374
|
-
| `quickSend(params, callback?)` | `Promise<SendResult>` | Delegates to the active gateway. |
|
|
375
|
-
| `getGateway()` | `ISmsGateway` | Underlying adapter (for nest: `getBalance()`). |
|
|
376
452
|
|
|
377
453
|
---
|
|
378
454
|
|
|
379
455
|
## License
|
|
380
456
|
|
|
381
|
-
[MIT](https://choosealicense.com/licenses/mit/)
|
|
457
|
+
[MIT](https://choosealicense.com/licenses/mit/)
|
package/package.json
CHANGED