@sinch/sdk-core 0.0.2 → 0.0.3
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 +12 -15
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/sinch-client.d.ts +2 -0
- package/dist/sinch-client.js +3 -0
- package/dist/sinch-client.js.map +1 -1
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ yarn add @sinch/sdk-core
|
|
|
21
21
|
|
|
22
22
|
## Usage
|
|
23
23
|
|
|
24
|
-
The `@sinch/sdk-core` package contains the entry point for
|
|
24
|
+
The `@sinch/sdk-core` package contains the entry point for an SDK user: the `SinchClient` class. It will use the information given in parameters to initialize the right plugins for the right APIs.
|
|
25
25
|
|
|
26
26
|
As there are different authentication schemes, the initialization method will depend on which one is used by the API.
|
|
27
27
|
|
|
@@ -31,13 +31,14 @@ As there are different authentication schemes, the initialization method will de
|
|
|
31
31
|
import { SinchClient } from '@sinch/sdk-core';
|
|
32
32
|
|
|
33
33
|
// The credentials can be found on the Account dashboard: https://dashboard.sinch.com/account/access-keys
|
|
34
|
-
const sinch = new SinchClient({
|
|
34
|
+
const sinch: Pick<SinchClient, 'conversation' | 'fax' | 'numbers' | 'sms'> = new SinchClient({
|
|
35
35
|
projectId: 'my-project-id',
|
|
36
36
|
keyId: 'my-key-id',
|
|
37
37
|
keySecret: 'my-key-secret',
|
|
38
38
|
});
|
|
39
|
+
const numbersService = sinch.numbers;
|
|
39
40
|
|
|
40
|
-
const response = await
|
|
41
|
+
const response = await numbersService.availableRegions.list({
|
|
41
42
|
types: 'LOCAL',
|
|
42
43
|
});
|
|
43
44
|
```
|
|
@@ -48,16 +49,17 @@ The initialization method above will work for the APIs that supports the authent
|
|
|
48
49
|
If you want to use the SMS API on the other regions (or US and EU too, it will work), you'll need other credentials in order to give to the Client the `servicePlanId` and the associated `apiToken`.
|
|
49
50
|
|
|
50
51
|
```typescript
|
|
51
|
-
import {
|
|
52
|
+
import { SinchClient } from '@sinch/sdk-core';
|
|
52
53
|
|
|
53
54
|
// The credentials can be found on the Service APIs dashboard: https://dashboard.sinch.com/sms/api/services
|
|
54
|
-
const sinch = new SinchClient({
|
|
55
|
+
const sinch: Pick<SinchClient, 'sms'> = new SinchClient({
|
|
55
56
|
servicePlanId: 'my-service-plan-id',
|
|
56
57
|
apiToken: 'my-key-id',
|
|
57
58
|
region: 'my-region', // Optional, can be 'us', 'eu', 'br', 'au', 'ca'. Default is 'us'
|
|
58
59
|
});
|
|
60
|
+
const smsService = sinch.sms;
|
|
59
61
|
|
|
60
|
-
const response = await
|
|
62
|
+
const response = await smsService.batches.get({
|
|
61
63
|
batch_id: '01HF28S9AABBBCCCCY92BJB569',
|
|
62
64
|
});
|
|
63
65
|
```
|
|
@@ -72,18 +74,19 @@ import { SinchClient } from '@sinch/sdk-core';
|
|
|
72
74
|
// The credentials can be found on the Verification or Voice dashboard:
|
|
73
75
|
// https://dashboard.sinch.com/verification/apps or
|
|
74
76
|
// https://dashboard.sinch.com/voice/apps
|
|
75
|
-
const sinch = new SinchClient({
|
|
77
|
+
const sinch: Pick<SinchClient, 'verification' | 'voice'> = new SinchClient({
|
|
76
78
|
applicationId: 'my-application-key',
|
|
77
79
|
applicationSecret: 'my-application-secret',
|
|
78
80
|
});
|
|
81
|
+
const verificationService = sinch.verification;
|
|
79
82
|
|
|
80
|
-
const response = await
|
|
83
|
+
const response = await verificationService.verificationStatus.getById({
|
|
81
84
|
id: '018bfc3e-1234-5678-1234-ebdb3fd6d30f',
|
|
82
85
|
});
|
|
83
86
|
```
|
|
84
87
|
|
|
85
88
|
## Examples
|
|
86
|
-
You can find an example of each request in the [../../examples/simple-examples](../../examples/simple-examples
|
|
89
|
+
You can find an example of each request in the [../../examples/simple-examples](../../examples/simple-examples) folder.
|
|
87
90
|
|
|
88
91
|
## Contact
|
|
89
92
|
Developer Experience team: [devexp@sinch.com](mailto:devexp@sinch.com)
|
|
@@ -97,12 +100,6 @@ Here is the list of the Sinch API and there level of support by the Node.js SDK:
|
|
|
97
100
|
| Messaging | SMS API | ✅ |
|
|
98
101
|
| | Conversation API | ✅ |
|
|
99
102
|
| | Fax API | 🚧 |
|
|
100
|
-
| | RCS API | ❌ |
|
|
101
|
-
| | MMS API | ❌ |
|
|
102
|
-
| | Provisioning API | ❌ |
|
|
103
103
|
| Voice and Video | Voice API | ✅ |
|
|
104
|
-
| | Elastic SIP Trunking | ❌ |
|
|
105
104
|
| Numbers & Connectivity | Numbers API | ✅ |
|
|
106
|
-
| | Brand and Campaign Registration API | ❌ |
|
|
107
|
-
| | Number Lookup API | ❌ |
|
|
108
105
|
| Verification | Verification API | ✅ |
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./sinch-client"), exports);
|
|
18
18
|
__exportStar(require("@sinch/conversation"), exports);
|
|
19
|
+
__exportStar(require("@sinch/fax"), exports);
|
|
19
20
|
__exportStar(require("@sinch/numbers"), exports);
|
|
20
21
|
__exportStar(require("@sinch/sms"), exports);
|
|
21
22
|
__exportStar(require("@sinch/verification"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,sDAAoC;AACpC,iDAA+B;AAC/B,6CAA2B;AAC3B,sDAAoC;AACpC,+CAA6B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,sDAAoC;AACpC,6CAA2B;AAC3B,iDAA+B;AAC/B,6CAA2B;AAC3B,sDAAoC;AACpC,+CAA6B"}
|
package/dist/sinch-client.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConversationService } from '@sinch/conversation';
|
|
2
|
+
import { FaxService } from '@sinch/fax';
|
|
2
3
|
import { NumbersService } from '@sinch/numbers';
|
|
3
4
|
import { SmsService } from '@sinch/sms';
|
|
4
5
|
import { VerificationService } from '@sinch/verification';
|
|
@@ -7,6 +8,7 @@ import { SinchClientParameters } from '@sinch/sdk-client';
|
|
|
7
8
|
/** Sinch Client to declare and initialize the supported APIs */
|
|
8
9
|
export declare class SinchClient {
|
|
9
10
|
readonly conversation: ConversationService;
|
|
11
|
+
readonly fax: FaxService;
|
|
10
12
|
readonly numbers: NumbersService;
|
|
11
13
|
readonly sms: SmsService;
|
|
12
14
|
readonly verification: VerificationService;
|
package/dist/sinch-client.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SinchClient = void 0;
|
|
4
4
|
const conversation_1 = require("@sinch/conversation");
|
|
5
|
+
const fax_1 = require("@sinch/fax");
|
|
5
6
|
const numbers_1 = require("@sinch/numbers");
|
|
6
7
|
const sms_1 = require("@sinch/sms");
|
|
7
8
|
const verification_1 = require("@sinch/verification");
|
|
@@ -16,6 +17,8 @@ class SinchClient {
|
|
|
16
17
|
constructor(params) {
|
|
17
18
|
// Initialize the "Conversation" API
|
|
18
19
|
this.conversation = new conversation_1.ConversationService(params);
|
|
20
|
+
// Initialize the "Fax" API
|
|
21
|
+
this.fax = new fax_1.FaxService(params);
|
|
19
22
|
// Initialize the "Numbers" API
|
|
20
23
|
this.numbers = new numbers_1.NumbersService(params);
|
|
21
24
|
// Initialize the "SMS" API.
|
package/dist/sinch-client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sinch-client.js","sourceRoot":"","sources":["../src/sinch-client.ts"],"names":[],"mappings":";;;AAAA,sDAA0D;AAC1D,4CAAgD;AAChD,oCAAwC;AACxC,sDAA0D;AAC1D,wCAA4C;AAG5C,gEAAgE;AAChE,MAAa,WAAW;
|
|
1
|
+
{"version":3,"file":"sinch-client.js","sourceRoot":"","sources":["../src/sinch-client.ts"],"names":[],"mappings":";;;AAAA,sDAA0D;AAC1D,oCAAwC;AACxC,4CAAgD;AAChD,oCAAwC;AACxC,sDAA0D;AAC1D,wCAA4C;AAG5C,gEAAgE;AAChE,MAAa,WAAW;IAStB;;;;OAIG;IACH,YAAY,MAA6B;QACvC,oCAAoC;QACpC,IAAI,CAAC,YAAY,GAAG,IAAI,kCAAmB,CAAC,MAAM,CAAC,CAAC;QAEpD,2BAA2B;QAC3B,IAAI,CAAC,GAAG,GAAG,IAAI,gBAAU,CAAC,MAAM,CAAC,CAAC;QAElC,+BAA+B;QAC/B,IAAI,CAAC,OAAO,GAAG,IAAI,wBAAc,CAAC,MAAM,CAAC,CAAC;QAE1C,4BAA4B;QAC5B,IAAI,CAAC,GAAG,GAAG,IAAI,gBAAU,CAAC,MAAM,CAAC,CAAC;QAElC,oCAAoC;QACpC,IAAI,CAAC,YAAY,GAAG,IAAI,kCAAmB,CAAC,MAAM,CAAC,CAAC;QAEpD,6BAA6B;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,oBAAY,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;CACF;AAjCD,kCAiCC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sinch/sdk-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Node.js client for the Sinch API platform",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"repository": {
|
|
@@ -29,11 +29,12 @@
|
|
|
29
29
|
"compile": "tsc --build --verbose"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@sinch/conversation": "^0.0.
|
|
33
|
-
"@sinch/
|
|
34
|
-
"@sinch/
|
|
35
|
-
"@sinch/
|
|
36
|
-
"@sinch/
|
|
32
|
+
"@sinch/conversation": "^0.0.3",
|
|
33
|
+
"@sinch/fax": "^0.0.3",
|
|
34
|
+
"@sinch/numbers": "^0.0.3",
|
|
35
|
+
"@sinch/sms": "^0.0.3",
|
|
36
|
+
"@sinch/verification": "^0.0.3",
|
|
37
|
+
"@sinch/voice": "^0.0.3"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {},
|
|
39
40
|
"publishConfig": {
|