@sinch/sdk-core 0.0.1 → 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 +17 -19
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/sinch-client.d.ts +12 -8
- package/dist/sinch-client.js +10 -4
- package/dist/sinch-client.js.map +1 -1
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
This package contains the Sinch Client SDK for Node.js. To use it, you will need a Sinch account. Please [sign up](https://dashboard.sinch.com/signup) or [log in](https://dashboard.sinch.com/login) if you already have one.
|
|
4
4
|
|
|
5
|
-
<span style="color:red; font-weight:bold">Warning:</span>
|
|
6
|
-
**This SDK is currently available for preview
|
|
5
|
+
> <span style="color:red; font-weight:bold">Warning:</span>
|
|
6
|
+
> **This SDK is currently available to selected developers for preview use only. It is being provided for the purpose of collecting feedback, and should not be used in production environments.**
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
@@ -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)
|
|
@@ -95,13 +98,8 @@ Here is the list of the Sinch API and there level of support by the Node.js SDK:
|
|
|
95
98
|
| API Category | API Name | Status |
|
|
96
99
|
|------------------------|-------------------------------------|:------:|
|
|
97
100
|
| Messaging | SMS API | ✅ |
|
|
98
|
-
| | Conversation API |
|
|
99
|
-
| |
|
|
100
|
-
|
|
|
101
|
-
| | Provisioning API | ❌ |
|
|
102
|
-
| Voice and Video | Voice API | ❌ |
|
|
103
|
-
| | Elastic SIP Trunking | ❌ |
|
|
101
|
+
| | Conversation API | ✅ |
|
|
102
|
+
| | Fax API | 🚧 |
|
|
103
|
+
| Voice and Video | Voice API | ✅ |
|
|
104
104
|
| Numbers & Connectivity | Numbers API | ✅ |
|
|
105
|
-
| | Brand and Campaign Registration API | ❌ |
|
|
106
|
-
| | Number Lookup API | ❌ |
|
|
107
105
|
| Verification | Verification API | ✅ |
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -15,6 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./sinch-client"), exports);
|
|
18
|
+
__exportStar(require("@sinch/conversation"), exports);
|
|
19
|
+
__exportStar(require("@sinch/fax"), exports);
|
|
18
20
|
__exportStar(require("@sinch/numbers"), exports);
|
|
19
21
|
__exportStar(require("@sinch/sms"), exports);
|
|
20
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,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,14 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ConversationService } from '@sinch/conversation';
|
|
2
|
+
import { FaxService } from '@sinch/fax';
|
|
3
|
+
import { NumbersService } from '@sinch/numbers';
|
|
4
|
+
import { SmsService } from '@sinch/sms';
|
|
5
|
+
import { VerificationService } from '@sinch/verification';
|
|
6
|
+
import { VoiceService } from '@sinch/voice';
|
|
4
7
|
import { SinchClientParameters } from '@sinch/sdk-client';
|
|
5
|
-
import { Voice } from '@sinch/voice';
|
|
6
8
|
/** Sinch Client to declare and initialize the supported APIs */
|
|
7
9
|
export declare class SinchClient {
|
|
8
|
-
readonly
|
|
9
|
-
readonly
|
|
10
|
-
readonly
|
|
11
|
-
readonly
|
|
10
|
+
readonly conversation: ConversationService;
|
|
11
|
+
readonly fax: FaxService;
|
|
12
|
+
readonly numbers: NumbersService;
|
|
13
|
+
readonly sms: SmsService;
|
|
14
|
+
readonly verification: VerificationService;
|
|
15
|
+
readonly voice: VoiceService;
|
|
12
16
|
/**
|
|
13
17
|
* Initialize your API Client instance with the provided credentials.
|
|
14
18
|
*
|
package/dist/sinch-client.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SinchClient = void 0;
|
|
4
|
+
const conversation_1 = require("@sinch/conversation");
|
|
5
|
+
const fax_1 = require("@sinch/fax");
|
|
4
6
|
const numbers_1 = require("@sinch/numbers");
|
|
5
7
|
const sms_1 = require("@sinch/sms");
|
|
6
8
|
const verification_1 = require("@sinch/verification");
|
|
@@ -13,14 +15,18 @@ class SinchClient {
|
|
|
13
15
|
* @param {SinchClientParameters} params - The object containing the Sinch credentials.
|
|
14
16
|
*/
|
|
15
17
|
constructor(params) {
|
|
18
|
+
// Initialize the "Conversation" API
|
|
19
|
+
this.conversation = new conversation_1.ConversationService(params);
|
|
20
|
+
// Initialize the "Fax" API
|
|
21
|
+
this.fax = new fax_1.FaxService(params);
|
|
16
22
|
// Initialize the "Numbers" API
|
|
17
|
-
this.numbers = new numbers_1.
|
|
23
|
+
this.numbers = new numbers_1.NumbersService(params);
|
|
18
24
|
// Initialize the "SMS" API.
|
|
19
|
-
this.sms = new sms_1.
|
|
25
|
+
this.sms = new sms_1.SmsService(params);
|
|
20
26
|
// Initialize the "Verification" API
|
|
21
|
-
this.verification = new verification_1.
|
|
27
|
+
this.verification = new verification_1.VerificationService(params);
|
|
22
28
|
// Initialize the "Voice" API
|
|
23
|
-
this.voice = new voice_1.
|
|
29
|
+
this.voice = new voice_1.VoiceService(params);
|
|
24
30
|
}
|
|
25
31
|
}
|
|
26
32
|
exports.SinchClient = SinchClient;
|
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,
|
|
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,10 +29,12 @@
|
|
|
29
29
|
"compile": "tsc --build --verbose"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@sinch/
|
|
33
|
-
"@sinch/
|
|
34
|
-
"@sinch/
|
|
35
|
-
"@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"
|
|
36
38
|
},
|
|
37
39
|
"devDependencies": {},
|
|
38
40
|
"publishConfig": {
|