@sinch/numbers 0.0.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/README.md +118 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +18 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/v1/active-number/active-number.d.ts +41 -0
- package/dist/models/v1/active-number/active-number.js +9 -0
- package/dist/models/v1/active-number/active-number.js.map +1 -0
- package/dist/models/v1/active-number/index.d.ts +1 -0
- package/dist/models/v1/active-number/index.js +3 -0
- package/dist/models/v1/active-number/index.js.map +1 -0
- package/dist/models/v1/active-number-request/active-number-request.d.ts +19 -0
- package/dist/models/v1/active-number-request/active-number-request.js +9 -0
- package/dist/models/v1/active-number-request/active-number-request.js.map +1 -0
- package/dist/models/v1/active-number-request/index.d.ts +1 -0
- package/dist/models/v1/active-number-request/index.js +3 -0
- package/dist/models/v1/active-number-request/index.js.map +1 -0
- package/dist/models/v1/active-numbers-response/active-numbers-response.d.ts +16 -0
- package/dist/models/v1/active-numbers-response/active-numbers-response.js +9 -0
- package/dist/models/v1/active-numbers-response/active-numbers-response.js.map +1 -0
- package/dist/models/v1/active-numbers-response/index.d.ts +1 -0
- package/dist/models/v1/active-numbers-response/index.js +3 -0
- package/dist/models/v1/active-numbers-response/index.js.map +1 -0
- package/dist/models/v1/available-number/available-number.d.ts +28 -0
- package/dist/models/v1/available-number/available-number.js +9 -0
- package/dist/models/v1/available-number/available-number.js.map +1 -0
- package/dist/models/v1/available-number/index.d.ts +1 -0
- package/dist/models/v1/available-number/index.js +3 -0
- package/dist/models/v1/available-number/index.js.map +1 -0
- package/dist/models/v1/available-numbers-response/available-numbers-response.d.ts +14 -0
- package/dist/models/v1/available-numbers-response/available-numbers-response.js +9 -0
- package/dist/models/v1/available-numbers-response/available-numbers-response.js.map +1 -0
- package/dist/models/v1/available-numbers-response/index.d.ts +1 -0
- package/dist/models/v1/available-numbers-response/index.js +3 -0
- package/dist/models/v1/available-numbers-response/index.js.map +1 -0
- package/dist/models/v1/available-region/available-region.d.ts +17 -0
- package/dist/models/v1/available-region/available-region.js +9 -0
- package/dist/models/v1/available-region/available-region.js.map +1 -0
- package/dist/models/v1/available-region/index.d.ts +1 -0
- package/dist/models/v1/available-region/index.js +3 -0
- package/dist/models/v1/available-region/index.js.map +1 -0
- package/dist/models/v1/bad-request/bad-request.d.ts +14 -0
- package/dist/models/v1/bad-request/bad-request.js +9 -0
- package/dist/models/v1/bad-request/bad-request.js.map +1 -0
- package/dist/models/v1/bad-request/index.d.ts +1 -0
- package/dist/models/v1/bad-request/index.js +3 -0
- package/dist/models/v1/bad-request/index.js.map +1 -0
- package/dist/models/v1/callback-configuration/callback-configuration.d.ts +13 -0
- package/dist/models/v1/callback-configuration/callback-configuration.js +9 -0
- package/dist/models/v1/callback-configuration/callback-configuration.js.map +1 -0
- package/dist/models/v1/callback-configuration/index.d.ts +1 -0
- package/dist/models/v1/callback-configuration/index.js +3 -0
- package/dist/models/v1/callback-configuration/index.js.map +1 -0
- package/dist/models/v1/callback-configuration-update/callback-configuration-update.d.ts +13 -0
- package/dist/models/v1/callback-configuration-update/callback-configuration-update.js +9 -0
- package/dist/models/v1/callback-configuration-update/callback-configuration-update.js.map +1 -0
- package/dist/models/v1/callback-configuration-update/index.d.ts +1 -0
- package/dist/models/v1/callback-configuration-update/index.js +3 -0
- package/dist/models/v1/callback-configuration-update/index.js.map +1 -0
- package/dist/models/v1/enums.d.ts +7 -0
- package/dist/models/v1/enums.js +3 -0
- package/dist/models/v1/enums.js.map +1 -0
- package/dist/models/v1/field-violation/field-violation.d.ts +10 -0
- package/dist/models/v1/field-violation/field-violation.js +9 -0
- package/dist/models/v1/field-violation/field-violation.js.map +1 -0
- package/dist/models/v1/field-violation/index.d.ts +1 -0
- package/dist/models/v1/field-violation/index.js +3 -0
- package/dist/models/v1/field-violation/index.js.map +1 -0
- package/dist/models/v1/index.d.ts +33 -0
- package/dist/models/v1/index.js +50 -0
- package/dist/models/v1/index.js.map +1 -0
- package/dist/models/v1/internal-error/index.d.ts +1 -0
- package/dist/models/v1/internal-error/index.js +3 -0
- package/dist/models/v1/internal-error/index.js.map +1 -0
- package/dist/models/v1/internal-error/internal-error.d.ts +11 -0
- package/dist/models/v1/internal-error/internal-error.js +9 -0
- package/dist/models/v1/internal-error/internal-error.js.map +1 -0
- package/dist/models/v1/internal-error-error/index.d.ts +1 -0
- package/dist/models/v1/internal-error-error/index.js +3 -0
- package/dist/models/v1/internal-error-error/index.js.map +1 -0
- package/dist/models/v1/internal-error-error/internal-error-error.d.ts +17 -0
- package/dist/models/v1/internal-error-error/internal-error-error.js +9 -0
- package/dist/models/v1/internal-error-error/internal-error-error.js.map +1 -0
- package/dist/models/v1/invalid-argument/index.d.ts +1 -0
- package/dist/models/v1/invalid-argument/index.js +3 -0
- package/dist/models/v1/invalid-argument/index.js.map +1 -0
- package/dist/models/v1/invalid-argument/invalid-argument.d.ts +11 -0
- package/dist/models/v1/invalid-argument/invalid-argument.js +9 -0
- package/dist/models/v1/invalid-argument/invalid-argument.js.map +1 -0
- package/dist/models/v1/invalid-argument-error/index.d.ts +1 -0
- package/dist/models/v1/invalid-argument-error/index.js +3 -0
- package/dist/models/v1/invalid-argument-error/index.js.map +1 -0
- package/dist/models/v1/invalid-argument-error/invalid-argument-error.d.ts +18 -0
- package/dist/models/v1/invalid-argument-error/invalid-argument-error.js +9 -0
- package/dist/models/v1/invalid-argument-error/invalid-argument-error.js.map +1 -0
- package/dist/models/v1/list-available-number-request/index.d.ts +1 -0
- package/dist/models/v1/list-available-number-request/index.js +3 -0
- package/dist/models/v1/list-available-number-request/index.js.map +1 -0
- package/dist/models/v1/list-available-number-request/list-available-number-request.d.ts +23 -0
- package/dist/models/v1/list-available-number-request/list-available-number-request.js +9 -0
- package/dist/models/v1/list-available-number-request/list-available-number-request.js.map +1 -0
- package/dist/models/v1/list-available-regions-response/index.d.ts +1 -0
- package/dist/models/v1/list-available-regions-response/index.js +3 -0
- package/dist/models/v1/list-available-regions-response/index.js.map +1 -0
- package/dist/models/v1/list-available-regions-response/list-available-regions-response.d.ts +14 -0
- package/dist/models/v1/list-available-regions-response/list-available-regions-response.js +9 -0
- package/dist/models/v1/list-available-regions-response/list-available-regions-response.js.map +1 -0
- package/dist/models/v1/money/index.d.ts +1 -0
- package/dist/models/v1/money/index.js +3 -0
- package/dist/models/v1/money/index.js.map +1 -0
- package/dist/models/v1/money/money.d.ts +15 -0
- package/dist/models/v1/money/money.js +9 -0
- package/dist/models/v1/money/money.js.map +1 -0
- package/dist/models/v1/not-found/index.d.ts +1 -0
- package/dist/models/v1/not-found/index.js +3 -0
- package/dist/models/v1/not-found/index.js.map +1 -0
- package/dist/models/v1/not-found/not-found.d.ts +11 -0
- package/dist/models/v1/not-found/not-found.js +9 -0
- package/dist/models/v1/not-found/not-found.js.map +1 -0
- package/dist/models/v1/not-found-error/index.d.ts +1 -0
- package/dist/models/v1/not-found-error/index.js +3 -0
- package/dist/models/v1/not-found-error/index.js.map +1 -0
- package/dist/models/v1/not-found-error/not-found-error.d.ts +17 -0
- package/dist/models/v1/not-found-error/not-found-error.js +9 -0
- package/dist/models/v1/not-found-error/not-found-error.js.map +1 -0
- package/dist/models/v1/number-pattern-pattern/index.d.ts +1 -0
- package/dist/models/v1/number-pattern-pattern/index.js +3 -0
- package/dist/models/v1/number-pattern-pattern/index.js.map +1 -0
- package/dist/models/v1/number-pattern-pattern/number-pattern-pattern.d.ts +14 -0
- package/dist/models/v1/number-pattern-pattern/number-pattern-pattern.js +9 -0
- package/dist/models/v1/number-pattern-pattern/number-pattern-pattern.js.map +1 -0
- package/dist/models/v1/number-pattern-search-pattern/index.d.ts +1 -0
- package/dist/models/v1/number-pattern-search-pattern/index.js +3 -0
- package/dist/models/v1/number-pattern-search-pattern/index.js.map +1 -0
- package/dist/models/v1/number-pattern-search-pattern/number-pattern-search-pattern.d.ts +18 -0
- package/dist/models/v1/number-pattern-search-pattern/number-pattern-search-pattern.js +16 -0
- package/dist/models/v1/number-pattern-search-pattern/number-pattern-search-pattern.js.map +1 -0
- package/dist/models/v1/provisioning-status/index.d.ts +1 -0
- package/dist/models/v1/provisioning-status/index.js +3 -0
- package/dist/models/v1/provisioning-status/index.js.map +1 -0
- package/dist/models/v1/provisioning-status/provisioning-status.d.ts +10 -0
- package/dist/models/v1/provisioning-status/provisioning-status.js +9 -0
- package/dist/models/v1/provisioning-status/provisioning-status.js.map +1 -0
- package/dist/models/v1/rent-any-number-request/index.d.ts +1 -0
- package/dist/models/v1/rent-any-number-request/index.js +3 -0
- package/dist/models/v1/rent-any-number-request/index.js.map +1 -0
- package/dist/models/v1/rent-any-number-request/rent-any-number-request.d.ts +27 -0
- package/dist/models/v1/rent-any-number-request/rent-any-number-request.js +9 -0
- package/dist/models/v1/rent-any-number-request/rent-any-number-request.js.map +1 -0
- package/dist/models/v1/rent-any-number-request-sms-configuration/index.d.ts +1 -0
- package/dist/models/v1/rent-any-number-request-sms-configuration/index.js +3 -0
- package/dist/models/v1/rent-any-number-request-sms-configuration/index.js.map +1 -0
- package/dist/models/v1/rent-any-number-request-sms-configuration/rent-any-number-request-sms-configuration.d.ts +12 -0
- package/dist/models/v1/rent-any-number-request-sms-configuration/rent-any-number-request-sms-configuration.js +9 -0
- package/dist/models/v1/rent-any-number-request-sms-configuration/rent-any-number-request-sms-configuration.js.map +1 -0
- package/dist/models/v1/rent-any-number-request-voice-configuration/index.d.ts +1 -0
- package/dist/models/v1/rent-any-number-request-voice-configuration/index.js +3 -0
- package/dist/models/v1/rent-any-number-request-voice-configuration/index.js.map +1 -0
- package/dist/models/v1/rent-any-number-request-voice-configuration/rent-any-number-request-voice-configuration.d.ts +10 -0
- package/dist/models/v1/rent-any-number-request-voice-configuration/rent-any-number-request-voice-configuration.js +9 -0
- package/dist/models/v1/rent-any-number-request-voice-configuration/rent-any-number-request-voice-configuration.js.map +1 -0
- package/dist/models/v1/rent-number-request/index.d.ts +1 -0
- package/dist/models/v1/rent-number-request/index.js +3 -0
- package/dist/models/v1/rent-number-request/index.js.map +1 -0
- package/dist/models/v1/rent-number-request/rent-number-request.d.ts +19 -0
- package/dist/models/v1/rent-number-request/rent-number-request.js +9 -0
- package/dist/models/v1/rent-number-request/rent-number-request.js.map +1 -0
- package/dist/models/v1/scheduled-provisioning/index.d.ts +1 -0
- package/dist/models/v1/scheduled-provisioning/index.js +3 -0
- package/dist/models/v1/scheduled-provisioning/index.js.map +1 -0
- package/dist/models/v1/scheduled-provisioning/scheduled-provisioning.d.ts +23 -0
- package/dist/models/v1/scheduled-provisioning/scheduled-provisioning.js +9 -0
- package/dist/models/v1/scheduled-provisioning/scheduled-provisioning.js.map +1 -0
- package/dist/models/v1/scheduled-voice-provisioning/index.d.ts +1 -0
- package/dist/models/v1/scheduled-voice-provisioning/index.js +3 -0
- package/dist/models/v1/scheduled-voice-provisioning/index.js.map +1 -0
- package/dist/models/v1/scheduled-voice-provisioning/scheduled-voice-provisioning.d.ts +18 -0
- package/dist/models/v1/scheduled-voice-provisioning/scheduled-voice-provisioning.js +9 -0
- package/dist/models/v1/scheduled-voice-provisioning/scheduled-voice-provisioning.js.map +1 -0
- package/dist/models/v1/search-pattern/index.d.ts +1 -0
- package/dist/models/v1/search-pattern/index.js +3 -0
- package/dist/models/v1/search-pattern/index.js.map +1 -0
- package/dist/models/v1/search-pattern/search-pattern.d.ts +13 -0
- package/dist/models/v1/search-pattern/search-pattern.js +3 -0
- package/dist/models/v1/search-pattern/search-pattern.js.map +1 -0
- package/dist/models/v1/sms-configuration/index.d.ts +1 -0
- package/dist/models/v1/sms-configuration/index.js +3 -0
- package/dist/models/v1/sms-configuration/index.js.map +1 -0
- package/dist/models/v1/sms-configuration/sms-configuration.d.ts +18 -0
- package/dist/models/v1/sms-configuration/sms-configuration.js +9 -0
- package/dist/models/v1/sms-configuration/sms-configuration.js.map +1 -0
- package/dist/models/v1/sms-error-code/index.d.ts +1 -0
- package/dist/models/v1/sms-error-code/index.js +3 -0
- package/dist/models/v1/sms-error-code/index.js.map +1 -0
- package/dist/models/v1/sms-error-code/sms-error-code.d.ts +10 -0
- package/dist/models/v1/sms-error-code/sms-error-code.js +9 -0
- package/dist/models/v1/sms-error-code/sms-error-code.js.map +1 -0
- package/dist/models/v1/voice-configuration/index.d.ts +1 -0
- package/dist/models/v1/voice-configuration/index.js +3 -0
- package/dist/models/v1/voice-configuration/index.js.map +1 -0
- package/dist/models/v1/voice-configuration/voice-configuration.d.ts +18 -0
- package/dist/models/v1/voice-configuration/voice-configuration.js +9 -0
- package/dist/models/v1/voice-configuration/voice-configuration.js.map +1 -0
- package/dist/rest/index.d.ts +1 -0
- package/dist/rest/index.js +18 -0
- package/dist/rest/index.js.map +1 -0
- package/dist/rest/v1/active-number/active-number-api.d.ts +69 -0
- package/dist/rest/v1/active-number/active-number-api.jest.fixture.d.ts +22 -0
- package/dist/rest/v1/active-number/active-number-api.jest.fixture.js +25 -0
- package/dist/rest/v1/active-number/active-number-api.jest.fixture.js.map +1 -0
- package/dist/rest/v1/active-number/active-number-api.js +126 -0
- package/dist/rest/v1/active-number/active-number-api.js.map +1 -0
- package/dist/rest/v1/active-number/index.d.ts +2 -0
- package/dist/rest/v1/active-number/index.js +19 -0
- package/dist/rest/v1/active-number/index.js.map +1 -0
- package/dist/rest/v1/available-number/available-number-api.d.ts +63 -0
- package/dist/rest/v1/available-number/available-number-api.jest.fixture.d.ts +21 -0
- package/dist/rest/v1/available-number/available-number-api.jest.fixture.js +25 -0
- package/dist/rest/v1/available-number/available-number-api.jest.fixture.js.map +1 -0
- package/dist/rest/v1/available-number/available-number-api.js +119 -0
- package/dist/rest/v1/available-number/available-number-api.js.map +1 -0
- package/dist/rest/v1/available-number/index.d.ts +2 -0
- package/dist/rest/v1/available-number/index.js +19 -0
- package/dist/rest/v1/available-number/index.js.map +1 -0
- package/dist/rest/v1/available-regions/available-regions-api.d.ts +27 -0
- package/dist/rest/v1/available-regions/available-regions-api.jest.fixture.d.ts +9 -0
- package/dist/rest/v1/available-regions/available-regions-api.jest.fixture.js +13 -0
- package/dist/rest/v1/available-regions/available-regions-api.jest.fixture.js.map +1 -0
- package/dist/rest/v1/available-regions/available-regions-api.js +41 -0
- package/dist/rest/v1/available-regions/available-regions-api.js.map +1 -0
- package/dist/rest/v1/available-regions/index.d.ts +2 -0
- package/dist/rest/v1/available-regions/index.js +19 -0
- package/dist/rest/v1/available-regions/index.js.map +1 -0
- package/dist/rest/v1/callback-configuration/callback-configuration-api.d.ts +29 -0
- package/dist/rest/v1/callback-configuration/callback-configuration-api.jest.fixture.d.ts +13 -0
- package/dist/rest/v1/callback-configuration/callback-configuration-api.jest.fixture.js +17 -0
- package/dist/rest/v1/callback-configuration/callback-configuration-api.jest.fixture.js.map +1 -0
- package/dist/rest/v1/callback-configuration/callback-configuration-api.js +64 -0
- package/dist/rest/v1/callback-configuration/callback-configuration-api.js.map +1 -0
- package/dist/rest/v1/callback-configuration/index.d.ts +2 -0
- package/dist/rest/v1/callback-configuration/index.js +19 -0
- package/dist/rest/v1/callback-configuration/index.js.map +1 -0
- package/dist/rest/v1/enums.d.ts +1 -0
- package/dist/rest/v1/enums.js +3 -0
- package/dist/rest/v1/enums.js.map +1 -0
- package/dist/rest/v1/index.d.ts +5 -0
- package/dist/rest/v1/index.js +22 -0
- package/dist/rest/v1/index.js.map +1 -0
- package/dist/rest/v1/numbers-api.d.ts +26 -0
- package/dist/rest/v1/numbers-api.js +68 -0
- package/dist/rest/v1/numbers-api.js.map +1 -0
- package/dist/rest/v1/numbers.d.ts +24 -0
- package/dist/rest/v1/numbers.js +28 -0
- package/dist/rest/v1/numbers.js.map +1 -0
- package/package.json +37 -0
package/README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Sinch Numbers SDK for Node.js
|
|
2
|
+
|
|
3
|
+
This package contains the Sinch Numbers SDK for Node.js for use with [Sinch APIs](https://developers.sinch.com/). 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
|
+
|
|
5
|
+
<span style="color:red; font-weight:bold">Warning:</span>
|
|
6
|
+
**This SDK is currently available for preview purposes only. It should not be used in production environments.**
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
We recommend to use this SDK as part of the `@sinch/sdk-core` package as it will take care about the authentication plugins to use.
|
|
11
|
+
|
|
12
|
+
However, it's still possible to use this SDK standalone is you need to access the Numbers API only.
|
|
13
|
+
|
|
14
|
+
### With NPM
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @sinch/numbers
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### With Yarn
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
yarn add @sinch/numbers
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
### Credentials
|
|
29
|
+
|
|
30
|
+
The `Numbers` API uses the Sinch unified authentication with OAuth2. You will need to provide the following credentials:
|
|
31
|
+
- projectId: can be found in the [Account Dashboard](https://dashboard.sinch.com/settings/access-keys)
|
|
32
|
+
- keyId:: can be found in your Access key list in the [Account Dashboard](https://dashboard.sinch.com/settings/access-keys)
|
|
33
|
+
- keySecret: can be found **ONLY** when generating a new access key: keep it safe!
|
|
34
|
+
|
|
35
|
+
### As part of the Sinch SDK
|
|
36
|
+
|
|
37
|
+
If you are using this SDK as part of the Sinch SDK (`@sinch/sdk-core`) you can access it as the `numbers` property of the client that you would have instantiated.
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import {
|
|
41
|
+
AvailableNumber,
|
|
42
|
+
GetAvailableNumberRequestData,
|
|
43
|
+
SinchClient,
|
|
44
|
+
SinchClientParameters,
|
|
45
|
+
} from '@sinch/sdk-core';
|
|
46
|
+
|
|
47
|
+
const credentials: SinchClientParameters = {
|
|
48
|
+
projectId: 'PROJECT_ID',
|
|
49
|
+
keyId: 'KEY_ID',
|
|
50
|
+
keySecret: 'KEY_SECRET',
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const sinch = new SinchClient(credentials);
|
|
54
|
+
|
|
55
|
+
const requestData: GetAvailableNumberRequestData = {
|
|
56
|
+
phoneNumber: '+17813334444',
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// Access the 'numbers' domain registered on the Sinch Client
|
|
60
|
+
const availabilityResult: AvailableNumber
|
|
61
|
+
= await sinch.numbers.availableNumber.checkAvailability(requestData);
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Standalone
|
|
65
|
+
|
|
66
|
+
The SDK can be used standalone if you need to use only the Numbers APIs.
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import {
|
|
70
|
+
SinchClientParameters,
|
|
71
|
+
} from '@sinch/sdk-client';
|
|
72
|
+
import {
|
|
73
|
+
AvailableNumber,
|
|
74
|
+
GetAvailableNumberRequestData,
|
|
75
|
+
Numbers,
|
|
76
|
+
SinchClientParameters,
|
|
77
|
+
} from '@sinch/numbers';
|
|
78
|
+
|
|
79
|
+
const credentials: SinchClientParameters = {
|
|
80
|
+
projectId: 'PROJECT_ID',
|
|
81
|
+
keyId: 'KEY_ID',
|
|
82
|
+
keySecret: 'KEY_SECRET',
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Declare the 'numbers' service in a standalone way
|
|
86
|
+
const numbers = new Numbers(options);
|
|
87
|
+
|
|
88
|
+
const requestData: GetAvailableNumberRequestData = {
|
|
89
|
+
phoneNumber: '+17813334444',
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// Use the standalone declaration of the 'numbers' domain
|
|
93
|
+
const availabilityResult: AvailableNumber
|
|
94
|
+
= await numbers.availableNumber.checkAvailability(requestData);
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Promises
|
|
98
|
+
|
|
99
|
+
All the methods that interact with the Sinch APIs use Promises. You can use `await` in an `async` method to wait for the response or you can resolve them yourself with `then()` / `catch()`.
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
// Method 1: Wait for the Promise to complete
|
|
103
|
+
let availabilityResult: AvailableNumber;
|
|
104
|
+
try {
|
|
105
|
+
availabilityResult = await sinch.numbers.availableNumber.checkAvailability(requestData);
|
|
106
|
+
console.log(`Phone number: ${availabilityResult.phoneNumber} - Type: ${availabilityResult.type}`);
|
|
107
|
+
} catch (error: any) {
|
|
108
|
+
console.error(`ERROR ${error.statusCode}: the phone number ${requestData.phoneNumber} is not available`);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Method 2: Resolve the promise
|
|
112
|
+
sinch.numbers.availableNumber.checkAvailability(requestData)
|
|
113
|
+
.then(response => console.log(`Phone number: ${response.phoneNumber} - Type: ${response.type}`))
|
|
114
|
+
.catch(error => console.error(`ERROR ${error.statusCode}: the phone number ${requestData.phoneNumber} is not available`));
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Contact
|
|
118
|
+
Developer Experience team: [devexp@sinch.com](mailto:devexp@sinch.com)
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./models"), exports);
|
|
18
|
+
__exportStar(require("./rest"), exports);
|
|
19
|
+
__exportStar(require("@sinch/sdk-client"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,yCAAuB;AACvB,oDAAkC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './v1';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./v1"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAqB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model: ActiveNumber
|
|
3
|
+
*
|
|
4
|
+
* THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT.
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
import { Money } from '../money';
|
|
8
|
+
import { SMSConfiguration } from '../sms-configuration';
|
|
9
|
+
import { VoiceConfiguration } from '../voice-configuration';
|
|
10
|
+
import { CapabilitiesEnum, NumberTypeEnum } from '../enums';
|
|
11
|
+
/**
|
|
12
|
+
* The phone number that has been rented by a customer and assigned to a project.
|
|
13
|
+
*/
|
|
14
|
+
export interface ActiveNumber {
|
|
15
|
+
/** The phone number in <a href=\"https://community.sinch.com/t5/Glossary/E-164/ta-p/7537\" target=\"_blank\">E.164</a> format with leading `+`. Example: `+12025550134`. */
|
|
16
|
+
phoneNumber?: string;
|
|
17
|
+
/** Project ID. Your project ID can be found on your <a href=\"https://dashboard.sinch.com/settings/project-management\" target=\"_blank\">Sinch Customer Dashboard</a>. */
|
|
18
|
+
projectId?: string;
|
|
19
|
+
/** User supplied name for the phone number. */
|
|
20
|
+
displayName?: string;
|
|
21
|
+
/** ISO 3166-1 alpha-2 country code of the phone number. Example `US`, `GB` or `SE`. */
|
|
22
|
+
regionCode?: string;
|
|
23
|
+
/** The number type. */
|
|
24
|
+
type?: NumberTypeEnum;
|
|
25
|
+
/** The capability of the number. */
|
|
26
|
+
capability?: CapabilitiesEnum[];
|
|
27
|
+
/** @see Money */
|
|
28
|
+
money?: Money;
|
|
29
|
+
/** How often the recurring price is charged in months. */
|
|
30
|
+
paymentIntervalMonths?: number;
|
|
31
|
+
/** The date of the next charge. */
|
|
32
|
+
nextChargeDate?: Date | null;
|
|
33
|
+
/** The timestamp when the subscription will expire if an expiration date has been set. */
|
|
34
|
+
expireAt?: Date | null;
|
|
35
|
+
/** @see SMSConfiguration */
|
|
36
|
+
smsConfiguration?: SMSConfiguration;
|
|
37
|
+
/** @see VoiceConfiguration */
|
|
38
|
+
voiceConfiguration?: VoiceConfiguration;
|
|
39
|
+
/** The active number\'s callback URL to be called for provisioning / deprovisioning updates */
|
|
40
|
+
callbackUrl?: string;
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"active-number.js","sourceRoot":"","sources":["../../../../src/models/v1/active-number/active-number.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ActiveNumber } from './active-number';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v1/active-number/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model: ActiveNumberRequest
|
|
3
|
+
*
|
|
4
|
+
* THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT.
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
import { SMSConfiguration } from '../sms-configuration';
|
|
8
|
+
import { VoiceConfiguration } from '../voice-configuration';
|
|
9
|
+
/**
|
|
10
|
+
* The phone number that has been rented by a customer and assigned to a project.
|
|
11
|
+
*/
|
|
12
|
+
export interface ActiveNumberRequest {
|
|
13
|
+
/** User supplied name for the phone number. */
|
|
14
|
+
displayName?: string;
|
|
15
|
+
/** @see SMSConfiguration */
|
|
16
|
+
smsConfiguration?: SMSConfiguration;
|
|
17
|
+
/** @see VoiceConfiguration */
|
|
18
|
+
voiceConfiguration?: VoiceConfiguration;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"active-number-request.js","sourceRoot":"","sources":["../../../../src/models/v1/active-number-request/active-number-request.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ActiveNumberRequest } from './active-number-request';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v1/active-number-request/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model: ActiveNumbersResponse
|
|
3
|
+
*
|
|
4
|
+
* THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT.
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
import { ActiveNumber } from '../active-number';
|
|
8
|
+
/**
|
|
9
|
+
* Response message to list your active phone numbers.
|
|
10
|
+
*/
|
|
11
|
+
export interface ActiveNumbersResponse {
|
|
12
|
+
/** List of numbers associated to the client project specified in `ListActiveNumbers`. */
|
|
13
|
+
activeNumbers?: ActiveNumber[];
|
|
14
|
+
nextPageToken?: string;
|
|
15
|
+
totalSize?: number;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"active-numbers-response.js","sourceRoot":"","sources":["../../../../src/models/v1/active-numbers-response/active-numbers-response.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ActiveNumbersResponse } from './active-numbers-response';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v1/active-numbers-response/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model: AvailableNumber
|
|
3
|
+
*
|
|
4
|
+
* THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT.
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
import { Money } from '../money';
|
|
8
|
+
/**
|
|
9
|
+
* The phone numbers that are available to be rented in the <a href=\"https://dashboard.sinch.com/numbers/buy-numbers\" target=\"_blank\">Sinch Customer Dashboard</a> or via the public numbers API.
|
|
10
|
+
*/
|
|
11
|
+
export interface AvailableNumber {
|
|
12
|
+
/** The phone number in <a href=\"https://community.sinch.com/t5/Glossary/E-164/ta-p/7537\" target=\"_blank\">E.164</a> format with leading `+`. Example `+12025550134`. */
|
|
13
|
+
phoneNumber?: string;
|
|
14
|
+
/** ISO 3166-1 alpha-2 country code of the phone number. Example: `US`, `GB` or `SE`. */
|
|
15
|
+
regionCode?: string;
|
|
16
|
+
/** The number type. */
|
|
17
|
+
type?: string;
|
|
18
|
+
/** The capability of the number. */
|
|
19
|
+
capability?: string[];
|
|
20
|
+
/** @see Money */
|
|
21
|
+
setupPrice?: Money;
|
|
22
|
+
/** @see Money */
|
|
23
|
+
monthlyPrice?: Money;
|
|
24
|
+
/** How often the recurring price is charged in months. */
|
|
25
|
+
paymentIntervalMonths?: number;
|
|
26
|
+
/** Whether or not supplementary documentation will be required to complete the number rental. */
|
|
27
|
+
supportingDocumentationRequired?: boolean;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"available-number.js","sourceRoot":"","sources":["../../../../src/models/v1/available-number/available-number.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { AvailableNumber } from './available-number';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v1/available-number/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model: AvailableNumbersResponse
|
|
3
|
+
*
|
|
4
|
+
* THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT.
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
import { AvailableNumber } from '../available-number';
|
|
8
|
+
/**
|
|
9
|
+
* Response message to list available phone numbers.
|
|
10
|
+
*/
|
|
11
|
+
export interface AvailableNumbersResponse {
|
|
12
|
+
/** List of available phone numbers. */
|
|
13
|
+
availableNumbers?: AvailableNumber[];
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"available-numbers-response.js","sourceRoot":"","sources":["../../../../src/models/v1/available-numbers-response/available-numbers-response.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { AvailableNumbersResponse } from './available-numbers-response';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v1/available-numbers-response/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model: AvailableRegion
|
|
3
|
+
*
|
|
4
|
+
* THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT.
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* A region for which numbers are provided.
|
|
9
|
+
*/
|
|
10
|
+
export interface AvailableRegion {
|
|
11
|
+
/** ISO 3166-1 alpha-2 region code. Examples: `US`, `GB` or `SE`. */
|
|
12
|
+
regionCode?: string;
|
|
13
|
+
/** Display name of the region. Examples: United States, United Kingdom or Sweden. */
|
|
14
|
+
regionName?: string;
|
|
15
|
+
/** A list of the different number types available. Examples: `MOBILE` or `LOCAL`. */
|
|
16
|
+
types?: string[];
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"available-region.js","sourceRoot":"","sources":["../../../../src/models/v1/available-region/available-region.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { AvailableRegion } from './available-region';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v1/available-region/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model: BadRequest
|
|
3
|
+
*
|
|
4
|
+
* THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT.
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
import { FieldViolation } from '../field-violation';
|
|
8
|
+
export interface BadRequest {
|
|
9
|
+
/** @see TypeEnum */
|
|
10
|
+
type?: TypeEnum;
|
|
11
|
+
/** List of FieldViolations */
|
|
12
|
+
fieldViolations?: FieldViolation[];
|
|
13
|
+
}
|
|
14
|
+
export type TypeEnum = 'BadRequest';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bad-request.js","sourceRoot":"","sources":["../../../../src/models/v1/bad-request/bad-request.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { BadRequest } from './bad-request';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v1/bad-request/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model: CallbackConfiguration
|
|
3
|
+
*
|
|
4
|
+
* THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT.
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Response message containing the callbacks configuration for a specific project
|
|
9
|
+
*/
|
|
10
|
+
export interface CallbackConfiguration {
|
|
11
|
+
projectId?: string;
|
|
12
|
+
hmacSecret?: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callback-configuration.js","sourceRoot":"","sources":["../../../../src/models/v1/callback-configuration/callback-configuration.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { CallbackConfiguration } from './callback-configuration';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v1/callback-configuration/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model: CallbackConfigurationUpdate
|
|
3
|
+
*
|
|
4
|
+
* THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT.
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* The request to update the callbacks configuration for the current project
|
|
9
|
+
*/
|
|
10
|
+
export interface CallbackConfigurationUpdate {
|
|
11
|
+
/** The HMAC secret to be updated for the specified project */
|
|
12
|
+
hmacSecret?: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callback-configuration-update.js","sourceRoot":"","sources":["../../../../src/models/v1/callback-configuration-update/callback-configuration-update.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { CallbackConfigurationUpdate } from './callback-configuration-update';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v1/callback-configuration-update/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { TypeEnum as BadRequestTypeEnum } from './bad-request/bad-request';
|
|
2
|
+
export type { CodeEnum as InternalErrorErrorCodeEnum, StatusEnum as InternalErrorErrorStatusEnum, } from './internal-error-error/internal-error-error';
|
|
3
|
+
export type { CodeEnum as InvalidArgumentErrorCodeEnum, StatusEnum as InvalidArgumentErrorStatusEnum, } from './invalid-argument-error/invalid-argument-error';
|
|
4
|
+
export type { CodeEnum as NotFoundErrorCodeEnum, StatusEnum as NotFoundErrorStatusEnum, } from './not-found-error/not-found-error';
|
|
5
|
+
export type NumberTypeEnum = 'MOBILE' | 'LOCAL' | 'TOLL_FREE';
|
|
6
|
+
export type SearchPatternEnum = 'START' | 'CONTAINS' | 'END';
|
|
7
|
+
export type CapabilitiesEnum = 'SMS' | 'VOICE';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../src/models/v1/enums.ts"],"names":[],"mappings":""}
|