@sinch/number-lookup 1.4.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 +121 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +43 -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/v2/enums.d.ts +16 -0
- package/dist/models/v2/enums.js +3 -0
- package/dist/models/v2/enums.js.map +1 -0
- package/dist/models/v2/error-response/error-response.d.ts +10 -0
- package/dist/models/v2/error-response/error-response.js +3 -0
- package/dist/models/v2/error-response/error-response.js.map +1 -0
- package/dist/models/v2/error-response/index.d.ts +1 -0
- package/dist/models/v2/error-response/index.js +3 -0
- package/dist/models/v2/error-response/index.js.map +1 -0
- package/dist/models/v2/index.d.ts +11 -0
- package/dist/models/v2/index.js +28 -0
- package/dist/models/v2/index.js.map +1 -0
- package/dist/models/v2/line-response/index.d.ts +1 -0
- package/dist/models/v2/line-response/index.js +3 -0
- package/dist/models/v2/line-response/index.js.map +1 -0
- package/dist/models/v2/line-response/line-response.d.ts +18 -0
- package/dist/models/v2/line-response/line-response.js +3 -0
- package/dist/models/v2/line-response/line-response.js.map +1 -0
- package/dist/models/v2/number-lookup-request/index.d.ts +1 -0
- package/dist/models/v2/number-lookup-request/index.js +3 -0
- package/dist/models/v2/number-lookup-request/index.js.map +1 -0
- package/dist/models/v2/number-lookup-request/number-lookup-request.d.ts +10 -0
- package/dist/models/v2/number-lookup-request/number-lookup-request.js +3 -0
- package/dist/models/v2/number-lookup-request/number-lookup-request.js.map +1 -0
- package/dist/models/v2/number-lookup-response/index.d.ts +1 -0
- package/dist/models/v2/number-lookup-response/index.js +3 -0
- package/dist/models/v2/number-lookup-response/index.js.map +1 -0
- package/dist/models/v2/number-lookup-response/number-lookup-response.d.ts +20 -0
- package/dist/models/v2/number-lookup-response/number-lookup-response.js +3 -0
- package/dist/models/v2/number-lookup-response/number-lookup-response.js.map +1 -0
- package/dist/models/v2/problem-details/index.d.ts +1 -0
- package/dist/models/v2/problem-details/index.js +3 -0
- package/dist/models/v2/problem-details/index.js.map +1 -0
- package/dist/models/v2/problem-details/problem-details.d.ts +10 -0
- package/dist/models/v2/problem-details/problem-details.js +3 -0
- package/dist/models/v2/problem-details/problem-details.js.map +1 -0
- package/dist/models/v2/requests/index.d.ts +1 -0
- package/dist/models/v2/requests/index.js +18 -0
- package/dist/models/v2/requests/index.js.map +1 -0
- package/dist/models/v2/requests/number-lookup/number-lookup-request-data.d.ts +5 -0
- package/dist/models/v2/requests/number-lookup/number-lookup-request-data.js +3 -0
- package/dist/models/v2/requests/number-lookup/number-lookup-request-data.js.map +1 -0
- package/dist/models/v2/rnd-feature-options/index.d.ts +1 -0
- package/dist/models/v2/rnd-feature-options/index.js +3 -0
- package/dist/models/v2/rnd-feature-options/index.js.map +1 -0
- package/dist/models/v2/rnd-feature-options/rnd-feature-options.d.ts +4 -0
- package/dist/models/v2/rnd-feature-options/rnd-feature-options.js +3 -0
- package/dist/models/v2/rnd-feature-options/rnd-feature-options.js.map +1 -0
- package/dist/models/v2/rnd-response/index.d.ts +1 -0
- package/dist/models/v2/rnd-response/index.js +3 -0
- package/dist/models/v2/rnd-response/index.js.map +1 -0
- package/dist/models/v2/rnd-response/rnd-response.d.ts +7 -0
- package/dist/models/v2/rnd-response/rnd-response.js +3 -0
- package/dist/models/v2/rnd-response/rnd-response.js.map +1 -0
- package/dist/models/v2/sim-swap-response/index.d.ts +1 -0
- package/dist/models/v2/sim-swap-response/index.js +3 -0
- package/dist/models/v2/sim-swap-response/index.js.map +1 -0
- package/dist/models/v2/sim-swap-response/sim-swap-response.d.ts +10 -0
- package/dist/models/v2/sim-swap-response/sim-swap-response.js +3 -0
- package/dist/models/v2/sim-swap-response/sim-swap-response.js.map +1 -0
- package/dist/models/v2/voip-detection-response/index.d.ts +1 -0
- package/dist/models/v2/voip-detection-response/index.js +3 -0
- package/dist/models/v2/voip-detection-response/index.js.map +1 -0
- package/dist/models/v2/voip-detection-response/voip-detection-response.d.ts +8 -0
- package/dist/models/v2/voip-detection-response/voip-detection-response.js +3 -0
- package/dist/models/v2/voip-detection-response/voip-detection-response.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/v2/index.d.ts +3 -0
- package/dist/rest/v2/index.js +20 -0
- package/dist/rest/v2/index.js.map +1 -0
- package/dist/rest/v2/number-lookup/index.d.ts +2 -0
- package/dist/rest/v2/number-lookup/index.js +19 -0
- package/dist/rest/v2/number-lookup/index.js.map +1 -0
- package/dist/rest/v2/number-lookup/number-lookup-api.d.ts +12 -0
- package/dist/rest/v2/number-lookup/number-lookup-api.jest.fixture.d.ts +8 -0
- package/dist/rest/v2/number-lookup/number-lookup-api.jest.fixture.js +13 -0
- package/dist/rest/v2/number-lookup/number-lookup-api.jest.fixture.js.map +1 -0
- package/dist/rest/v2/number-lookup/number-lookup-api.js +33 -0
- package/dist/rest/v2/number-lookup/number-lookup-api.js.map +1 -0
- package/dist/rest/v2/number-lookup-domain-api.d.ts +18 -0
- package/dist/rest/v2/number-lookup-domain-api.js +42 -0
- package/dist/rest/v2/number-lookup-domain-api.js.map +1 -0
- package/dist/rest/v2/number-lookup-service.d.ts +23 -0
- package/dist/rest/v2/number-lookup-service.js +63 -0
- package/dist/rest/v2/number-lookup-service.js.map +1 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Sinch Number Lookup SDK for Node.js
|
|
2
|
+
|
|
3
|
+
This package contains the Sinch Number Lookup 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
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
We recommend to use this SDK as part of the [`@sinch/sdk-core`](../../packages/sdk-core) package in order to make the most out of all the Sinch products.
|
|
8
|
+
|
|
9
|
+
However, it's still possible to use this SDK standalone is you need to access the Number Lookup API only.
|
|
10
|
+
|
|
11
|
+
### With NPM
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @sinch/number-lookup
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### With Yarn
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
yarn add @sinch/number-lookup
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### Credentials
|
|
26
|
+
|
|
27
|
+
The `Number Lookup` API uses the Sinch unified authentication with OAuth2. You will need to provide the following credentials:
|
|
28
|
+
- projectId: can be found in the [Account Dashboard](https://dashboard.sinch.com/settings/access-keys)
|
|
29
|
+
- keyId:: can be found in your Access key list in the [Account Dashboard](https://dashboard.sinch.com/settings/access-keys)
|
|
30
|
+
- keySecret: can be found **ONLY** when generating a new access key: keep it safe!
|
|
31
|
+
|
|
32
|
+
### As part of the Sinch SDK
|
|
33
|
+
|
|
34
|
+
If you are using this SDK as part of the Sinch SDK (`@sinch/sdk-core`) you can access it as the `numberLookup` property of the client that you would have instantiated.
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import {
|
|
38
|
+
NumberLookup,
|
|
39
|
+
NumberLookupService,
|
|
40
|
+
SinchClient,
|
|
41
|
+
UnifiedCredentials,
|
|
42
|
+
} from '@sinch/sdk-core';
|
|
43
|
+
|
|
44
|
+
const credentials: UnifiedCredentials = {
|
|
45
|
+
projectId: 'PROJECT_ID',
|
|
46
|
+
keyId: 'KEY_ID',
|
|
47
|
+
keySecret: 'KEY_SECRET',
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// Access the 'numberLookup' service registered on the Sinch Client
|
|
51
|
+
const sinch = new SinchClient(credentials);
|
|
52
|
+
const numberLookupService: NumberLookupService = sinch.numberLookup;
|
|
53
|
+
|
|
54
|
+
// Build the request data
|
|
55
|
+
const requestData: NumberLookup.NumberLookupRequestData = {
|
|
56
|
+
numberLookupRequestBody: {
|
|
57
|
+
number: '+17813334444',
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// Use the 'numberLookup' service registered on the Sinch client
|
|
62
|
+
const lookupResult: NumberLookup.NumberLookupResponse
|
|
63
|
+
= await numberLookupService.lookup(requestData);
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Standalone
|
|
67
|
+
|
|
68
|
+
The SDK can be used standalone if you need to use only the Number Lookup APIs.
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import {
|
|
72
|
+
UnifiedCredentials,
|
|
73
|
+
} from '@sinch/sdk-client';
|
|
74
|
+
import {
|
|
75
|
+
NumberLookup,
|
|
76
|
+
NumberLookupService,
|
|
77
|
+
} from '@sinch/number-lookup';
|
|
78
|
+
|
|
79
|
+
const credentials: UnifiedCredentials = {
|
|
80
|
+
projectId: 'PROJECT_ID',
|
|
81
|
+
keyId: 'KEY_ID',
|
|
82
|
+
keySecret: 'KEY_SECRET',
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Declare the 'numberLookup' service in a standalone way
|
|
86
|
+
const numberLookupService = new NumberLookupService(credentials);
|
|
87
|
+
|
|
88
|
+
// Build the request data
|
|
89
|
+
const requestData: NumberLookup.NumberLookupRequestData = {
|
|
90
|
+
numberLookupRequestBody: {
|
|
91
|
+
number: '+17813334444',
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// Use the standalone declaration of the 'numberLookup' service
|
|
96
|
+
const lookupResult: NumberLookup.NumberLookupResponse
|
|
97
|
+
= await numberLookupService.lookup(requestData);
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Promises
|
|
101
|
+
|
|
102
|
+
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()`.
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
// Method 1: Wait for the Promise to complete (you need to be in an 'async' method)
|
|
106
|
+
let lookupResult: NumberLookup.NumberLookupResponse;
|
|
107
|
+
try {
|
|
108
|
+
lookupResult = await numberLookupService.lookup(requestData);
|
|
109
|
+
console.log(`The phone number '${lookupResult.number}' is of type '${lookupResult.line?.type}'`);
|
|
110
|
+
} catch (error: any) {
|
|
111
|
+
console.error(`ERROR ${error.statusCode} when performing a lookup for the phone number "${requestData.numberLookupRequestBody.number}"`);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Method 2: Resolve the promise
|
|
115
|
+
numberLookupService.lookup(requestData)
|
|
116
|
+
.then(response => console.log(`Phone number: ${response.number} - Type: ${response.line?.type}`))
|
|
117
|
+
.catch(error => console.error(`ERROR ${error.statusCode} when performing a lookup for the phone number "${requestData.numberLookupRequestBody.number}"`));
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Contact
|
|
121
|
+
Developer Experience team: [devexp@sinch.com](mailto:devexp@sinch.com)
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.NumberLookup = void 0;
|
|
40
|
+
exports.NumberLookup = __importStar(require("./models"));
|
|
41
|
+
__exportStar(require("./rest"), exports);
|
|
42
|
+
__exportStar(require("@sinch/sdk-client"), exports);
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAyC;AACzC,yCAAuB;AACvB,oDAAkC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './v2';
|
|
@@ -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("./v2"), 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,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contains requested features. Fallback to LineType if not provided.
|
|
3
|
+
*/
|
|
4
|
+
export type LookupFeature = 'LineType' | 'SimSwap' | 'VoIPDetection' | 'RND' | string;
|
|
5
|
+
/**
|
|
6
|
+
* Represents the type of a phone line.
|
|
7
|
+
*/
|
|
8
|
+
export type LineType = 'Landline' | 'Mobile' | 'VoIP' | 'Special' | 'Freephone' | 'Other' | string;
|
|
9
|
+
/**
|
|
10
|
+
* Threshold for sim swap check.
|
|
11
|
+
*/
|
|
12
|
+
export type SwapPeriod = 'Undefined' | 'SP4H' | 'SP12H' | 'SP24H' | 'SP48H' | 'SP5D' | 'SP7D' | 'SP14D' | 'SP30D' | 'SPMAX' | string;
|
|
13
|
+
/**
|
|
14
|
+
* Probability of number being VoIP based on the AI analysis.
|
|
15
|
+
*/
|
|
16
|
+
export type VoIPProbability = 'Unknown' | 'Low' | 'Likely' | 'High' | string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../src/models/v2/enums.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ErrorResponse {
|
|
2
|
+
/** The error status code. */
|
|
3
|
+
status?: number;
|
|
4
|
+
/** A short, human-readable summary of the error type. */
|
|
5
|
+
title?: string;
|
|
6
|
+
/** A human-readable explanation specific to this occurrence of the error. */
|
|
7
|
+
detail?: string;
|
|
8
|
+
/** A URI reference that identifies the error type. */
|
|
9
|
+
type?: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-response.js","sourceRoot":"","sources":["../../../../src/models/v2/error-response/error-response.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ErrorResponse } from './error-response';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v2/error-response/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './error-response';
|
|
2
|
+
export * from './line-response';
|
|
3
|
+
export * from './number-lookup-request';
|
|
4
|
+
export * from './number-lookup-response';
|
|
5
|
+
export * from './problem-details';
|
|
6
|
+
export * from './rnd-feature-options';
|
|
7
|
+
export * from './rnd-response';
|
|
8
|
+
export * from './sim-swap-response';
|
|
9
|
+
export * from './voip-detection-response';
|
|
10
|
+
export * from './enums';
|
|
11
|
+
export * from './requests';
|
|
@@ -0,0 +1,28 @@
|
|
|
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("./error-response"), exports);
|
|
18
|
+
__exportStar(require("./line-response"), exports);
|
|
19
|
+
__exportStar(require("./number-lookup-request"), exports);
|
|
20
|
+
__exportStar(require("./number-lookup-response"), exports);
|
|
21
|
+
__exportStar(require("./problem-details"), exports);
|
|
22
|
+
__exportStar(require("./rnd-feature-options"), exports);
|
|
23
|
+
__exportStar(require("./rnd-response"), exports);
|
|
24
|
+
__exportStar(require("./sim-swap-response"), exports);
|
|
25
|
+
__exportStar(require("./voip-detection-response"), exports);
|
|
26
|
+
__exportStar(require("./enums"), exports);
|
|
27
|
+
__exportStar(require("./requests"), exports);
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/v2/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,kDAAgC;AAChC,0DAAwC;AACxC,2DAAyC;AACzC,oDAAkC;AAClC,wDAAsC;AACtC,iDAA+B;AAC/B,sDAAoC;AACpC,4DAA0C;AAC1C,0CAAwB;AACxB,6CAA2B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { LineResponse } from './line-response';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v2/line-response/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ErrorResponse } from '../error-response';
|
|
2
|
+
import { LineType } from '../enums';
|
|
3
|
+
export interface LineResponse {
|
|
4
|
+
/** Name of the carrier. */
|
|
5
|
+
carrier?: string;
|
|
6
|
+
/** Number type e.g. wireless, mobile, fixed. */
|
|
7
|
+
type?: LineType;
|
|
8
|
+
/** A numeric code (MCC) that uniquely identifies a country within the international telecommunications network. */
|
|
9
|
+
mobileCountryCode?: string;
|
|
10
|
+
/** A distinct identifier assigned to a mobile network operator within a specific country, used in combination with MCC. */
|
|
11
|
+
mobileNetworkCode?: string;
|
|
12
|
+
/** Indicates if a phone number has been transferred from its original network to a different provider. */
|
|
13
|
+
ported?: boolean;
|
|
14
|
+
/** Specifies the date, in ISO 8601 format, when a phone number was transferred from its original network to a new provider. */
|
|
15
|
+
portingDate?: Date;
|
|
16
|
+
/** @see ErrorResponse */
|
|
17
|
+
error?: ErrorResponse;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line-response.js","sourceRoot":"","sources":["../../../../src/models/v2/line-response/line-response.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { NumberLookupRequest } from './number-lookup-request';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v2/number-lookup-request/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RndFeatureOptions } from '../rnd-feature-options';
|
|
2
|
+
import { LookupFeature } from '../enums';
|
|
3
|
+
export interface NumberLookupRequest {
|
|
4
|
+
/** MSISDN in E.164 format to query. */
|
|
5
|
+
number: string;
|
|
6
|
+
/** Contains requested features. Fallback to LineType if not provided. */
|
|
7
|
+
features?: LookupFeature[];
|
|
8
|
+
/** Required when RND feature is requested. */
|
|
9
|
+
rndFeatureOptions?: RndFeatureOptions;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-lookup-request.js","sourceRoot":"","sources":["../../../../src/models/v2/number-lookup-request/number-lookup-request.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { NumberLookupResponse } from './number-lookup-response';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v2/number-lookup-response/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LineResponse } from '../line-response';
|
|
2
|
+
import { RndResponse } from '../rnd-response';
|
|
3
|
+
import { SimSwapResponse } from '../sim-swap-response';
|
|
4
|
+
import { VoIPDetectionResponse } from '../voip-detection-response';
|
|
5
|
+
export interface NumberLookupResponse {
|
|
6
|
+
/** An object containing information about the line type of the number. */
|
|
7
|
+
line?: LineResponse;
|
|
8
|
+
/** An object containing information about the SimSwap verification performed on the number. */
|
|
9
|
+
simSwap?: SimSwapResponse;
|
|
10
|
+
/** An object containing information about the VoIP detection performed on the number. */
|
|
11
|
+
voIPDetection?: VoIPDetectionResponse;
|
|
12
|
+
/** An object containing information whether number is disconnected. */
|
|
13
|
+
rnd?: RndResponse;
|
|
14
|
+
/** ISO 3166-1 alpha-2 two-letter country identifier */
|
|
15
|
+
countryCode?: string;
|
|
16
|
+
/** The identifier for a trace. */
|
|
17
|
+
traceId?: string;
|
|
18
|
+
/** Requested MSISDN in E.164 format. */
|
|
19
|
+
number?: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-lookup-response.js","sourceRoot":"","sources":["../../../../src/models/v2/number-lookup-response/number-lookup-response.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ProblemDetails } from './problem-details';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v2/problem-details/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ProblemDetails {
|
|
2
|
+
/** A URI reference that identifies the problem type. */
|
|
3
|
+
type?: string;
|
|
4
|
+
/** A short, human-readable summary of the problem type. */
|
|
5
|
+
title?: string;
|
|
6
|
+
/** The HTTP status code. */
|
|
7
|
+
status?: number;
|
|
8
|
+
/** The identifier for a trace. */
|
|
9
|
+
traceId?: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"problem-details.js","sourceRoot":"","sources":["../../../../src/models/v2/problem-details/problem-details.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './number-lookup/number-lookup-request-data';
|
|
@@ -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("./number-lookup/number-lookup-request-data"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v2/requests/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6EAA2D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-lookup-request-data.js","sourceRoot":"","sources":["../../../../../src/models/v2/requests/number-lookup/number-lookup-request-data.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { RndFeatureOptions } from './rnd-feature-options';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v2/rnd-feature-options/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rnd-feature-options.js","sourceRoot":"","sources":["../../../../src/models/v2/rnd-feature-options/rnd-feature-options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { RndResponse } from './rnd-response';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v2/rnd-response/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rnd-response.js","sourceRoot":"","sources":["../../../../src/models/v2/rnd-response/rnd-response.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { SimSwapResponse } from './sim-swap-response';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v2/sim-swap-response/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ErrorResponse } from '../error-response';
|
|
2
|
+
import { SwapPeriod } from '../enums';
|
|
3
|
+
export interface SimSwapResponse {
|
|
4
|
+
/** Indicates whether SIM was changed. */
|
|
5
|
+
swapped?: boolean;
|
|
6
|
+
/** Threshold for sim swap check. */
|
|
7
|
+
swapPeriod?: SwapPeriod;
|
|
8
|
+
/** @see ErrorResponse */
|
|
9
|
+
error?: ErrorResponse;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-swap-response.js","sourceRoot":"","sources":["../../../../src/models/v2/sim-swap-response/sim-swap-response.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { VoIPDetectionResponse } from './voip-detection-response';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v2/voip-detection-response/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ErrorResponse } from '../error-response';
|
|
2
|
+
import { VoIPProbability } from '../enums';
|
|
3
|
+
export interface VoIPDetectionResponse {
|
|
4
|
+
/** Probability of number being VoIP based on the AI analysis. */
|
|
5
|
+
probability?: VoIPProbability;
|
|
6
|
+
/** @see ErrorResponse */
|
|
7
|
+
error?: ErrorResponse;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voip-detection-response.js","sourceRoot":"","sources":["../../../../src/models/v2/voip-detection-response/voip-detection-response.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './v2';
|
|
@@ -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("./v2"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rest/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAqB"}
|
|
@@ -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("./number-lookup"), exports);
|
|
18
|
+
__exportStar(require("./number-lookup-domain-api"), exports);
|
|
19
|
+
__exportStar(require("./number-lookup-service"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rest/v2/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,6DAA2C;AAC3C,0DAAwC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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("./number-lookup-api"), exports);
|
|
18
|
+
__exportStar(require("./number-lookup-api.jest.fixture"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rest/v2/number-lookup/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,mEAAiD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NumberLookupDomainApi } from '../number-lookup-domain-api';
|
|
2
|
+
import { LazyNumberLookupApiClient } from '../number-lookup-service';
|
|
3
|
+
import { NumberLookupRequestData, NumberLookupResponse } from '../../../models';
|
|
4
|
+
export declare class NumberLookupApi extends NumberLookupDomainApi {
|
|
5
|
+
constructor(lazyApiClient: LazyNumberLookupApiClient);
|
|
6
|
+
/**
|
|
7
|
+
* Performs a number lookup.
|
|
8
|
+
*
|
|
9
|
+
* @param { NumberLookupRequestData } data - The data to provide to the API call.
|
|
10
|
+
*/
|
|
11
|
+
lookup(data: NumberLookupRequestData): Promise<NumberLookupResponse>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NumberLookupApi } from './number-lookup-api';
|
|
2
|
+
import { NumberLookupRequestData, NumberLookupResponse } from '../../../models';
|
|
3
|
+
export declare class NumberLookupApiFixture implements Partial<Readonly<NumberLookupApi>> {
|
|
4
|
+
/**
|
|
5
|
+
* Fixture associated to function numberLookup
|
|
6
|
+
*/
|
|
7
|
+
lookup: jest.Mock<Promise<NumberLookupResponse>, [NumberLookupRequestData]>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NumberLookupApiFixture = void 0;
|
|
4
|
+
class NumberLookupApiFixture {
|
|
5
|
+
constructor() {
|
|
6
|
+
/**
|
|
7
|
+
* Fixture associated to function numberLookup
|
|
8
|
+
*/
|
|
9
|
+
this.lookup = jest.fn();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.NumberLookupApiFixture = NumberLookupApiFixture;
|
|
13
|
+
//# sourceMappingURL=number-lookup-api.jest.fixture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-lookup-api.jest.fixture.js","sourceRoot":"","sources":["../../../../src/rest/v2/number-lookup/number-lookup-api.jest.fixture.ts"],"names":[],"mappings":";;;AAGA,MAAa,sBAAsB;IAAnC;QACE;;WAEG;QACI,WAAM,GAAwE,IAAI,CAAC,EAAE,EAAE,CAAC;IACjG,CAAC;CAAA;AALD,wDAKC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NumberLookupApi = void 0;
|
|
4
|
+
const number_lookup_domain_api_1 = require("../number-lookup-domain-api");
|
|
5
|
+
class NumberLookupApi extends number_lookup_domain_api_1.NumberLookupDomainApi {
|
|
6
|
+
constructor(lazyApiClient) {
|
|
7
|
+
super(lazyApiClient, 'NumberLookupApi');
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Performs a number lookup.
|
|
11
|
+
*
|
|
12
|
+
* @param { NumberLookupRequestData } data - The data to provide to the API call.
|
|
13
|
+
*/
|
|
14
|
+
async lookup(data) {
|
|
15
|
+
const getParams = this.client.extractQueryParams(data, []);
|
|
16
|
+
const headers = {
|
|
17
|
+
'Content-Type': 'application/json',
|
|
18
|
+
Accept: 'application/json',
|
|
19
|
+
};
|
|
20
|
+
const body = data['numberLookupRequestBody'] ? JSON.stringify(data['numberLookupRequestBody']) : '{}';
|
|
21
|
+
const basePathUrl = `${this.client.apiClientOptions.hostname}/v2/projects/${this.client.apiClientOptions.projectId}/lookups`;
|
|
22
|
+
const requestOptions = await this.client.prepareOptions(basePathUrl, 'POST', getParams, headers, body || undefined);
|
|
23
|
+
const url = this.client.prepareUrl(requestOptions.hostname, requestOptions.queryParams);
|
|
24
|
+
return this.client.processCall({
|
|
25
|
+
url,
|
|
26
|
+
requestOptions,
|
|
27
|
+
apiName: this.apiName,
|
|
28
|
+
operationId: 'numberLookup',
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.NumberLookupApi = NumberLookupApi;
|
|
33
|
+
//# sourceMappingURL=number-lookup-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-lookup-api.js","sourceRoot":"","sources":["../../../../src/rest/v2/number-lookup/number-lookup-api.ts"],"names":[],"mappings":";;;AACA,0EAAoE;AAIpE,MAAa,eAAgB,SAAQ,gDAAqB;IAExD,YAAY,aAAwC;QAClD,KAAK,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC;IAC1C,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,CAAC,IAA6B;QAC/C,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAA0B,IAAI,EAAE,EAAa,CAAC,CAAC;QAC/F,MAAM,OAAO,GAA0C;YACrD,cAAc,EAAE,kBAAkB;YAClC,MAAM,EAAE,kBAAkB;SAC3B,CAAC;QAEF,MAAM,IAAI,GAAgB,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACnH,MAAM,WAAW,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,gBAAgB,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,UAAU,CAAC;QAE7H,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,IAAI,SAAS,CAAC,CAAC;QACpH,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,QAAQ,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;QAExF,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAuB;YACnD,GAAG;YACH,cAAc;YACd,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,WAAW,EAAE,cAAc;SAC5B,CAAC,CAAC;IACL,CAAC;CACF;AA/BD,0CA+BC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Api, ApiClient, UnifiedCredentials } from '@sinch/sdk-client';
|
|
2
|
+
import { LazyNumberLookupApiClient } from './number-lookup-service';
|
|
3
|
+
export declare class NumberLookupDomainApi implements Api {
|
|
4
|
+
readonly lazyClient: LazyNumberLookupApiClient;
|
|
5
|
+
readonly apiName: string;
|
|
6
|
+
constructor(lazyClient: LazyNumberLookupApiClient, apiName: string);
|
|
7
|
+
get client(): ApiClient;
|
|
8
|
+
/**
|
|
9
|
+
* Update the default hostname for the API
|
|
10
|
+
* @param {string} hostname - The new hostname to use for the APIs.
|
|
11
|
+
*/
|
|
12
|
+
setHostname(hostname: string): void;
|
|
13
|
+
/**
|
|
14
|
+
* Updates the credentials used to authenticate API requests
|
|
15
|
+
* @param {UnifiedCredentials} credentials
|
|
16
|
+
*/
|
|
17
|
+
setCredentials(credentials: Partial<UnifiedCredentials>): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NumberLookupDomainApi = void 0;
|
|
4
|
+
class NumberLookupDomainApi {
|
|
5
|
+
constructor(lazyClient, apiName) {
|
|
6
|
+
this.lazyClient = lazyClient;
|
|
7
|
+
this.apiName = apiName;
|
|
8
|
+
}
|
|
9
|
+
get client() {
|
|
10
|
+
return this.lazyClient.getApiClient();
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Update the default hostname for the API
|
|
14
|
+
* @param {string} hostname - The new hostname to use for the APIs.
|
|
15
|
+
*/
|
|
16
|
+
setHostname(hostname) {
|
|
17
|
+
this.lazyClient.sharedConfig.numberLookupHostname = hostname;
|
|
18
|
+
this.lazyClient.getApiClient().apiClientOptions.hostname = hostname;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Updates the credentials used to authenticate API requests
|
|
22
|
+
* @param {UnifiedCredentials} credentials
|
|
23
|
+
*/
|
|
24
|
+
setCredentials(credentials) {
|
|
25
|
+
const parametersBackup = { ...this.lazyClient.sharedConfig };
|
|
26
|
+
this.lazyClient.sharedConfig = {
|
|
27
|
+
...parametersBackup,
|
|
28
|
+
...credentials,
|
|
29
|
+
};
|
|
30
|
+
this.lazyClient.resetApiClient();
|
|
31
|
+
try {
|
|
32
|
+
this.lazyClient.getApiClient();
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
console.error('Impossible to assign the new credentials to the Number Lookup API');
|
|
36
|
+
this.lazyClient.sharedConfig = parametersBackup;
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.NumberLookupDomainApi = NumberLookupDomainApi;
|
|
42
|
+
//# sourceMappingURL=number-lookup-domain-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-lookup-domain-api.js","sourceRoot":"","sources":["../../../src/rest/v2/number-lookup-domain-api.ts"],"names":[],"mappings":";;;AAOA,MAAa,qBAAqB;IAEhC,YACkB,UAAqC,EACrC,OAAe;QADf,eAAU,GAAV,UAAU,CAA2B;QACrC,YAAO,GAAP,OAAO,CAAQ;IAC9B,CAAC;IAEJ,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;IACxC,CAAC;IAED;;;OAGG;IACI,WAAW,CAAC,QAAgB;QACjC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,oBAAoB,GAAG,QAAQ,CAAC;QAC7D,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,gBAAgB,CAAC,QAAQ,GAAG,QAAQ,CAAC;IACtE,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,WAAwC;QAC5D,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;QAC7D,IAAI,CAAC,UAAU,CAAC,YAAY,GAAG;YAC7B,GAAG,gBAAgB;YACnB,GAAG,WAAW;SACf,CAAC;QACF,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;QACjC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,mEAAmE,CAAC,CAAC;YACnF,IAAI,CAAC,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC;YAChD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CAEF;AAxCD,sDAwCC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ApiFetchClient, SinchClientParameters, UnifiedCredentials } from '@sinch/sdk-client';
|
|
2
|
+
import { NumberLookupRequestData, NumberLookupResponse } from '../../models';
|
|
3
|
+
export declare class LazyNumberLookupApiClient {
|
|
4
|
+
sharedConfig: SinchClientParameters;
|
|
5
|
+
private apiFetchClient?;
|
|
6
|
+
constructor(sharedConfig: SinchClientParameters);
|
|
7
|
+
getApiClient(): ApiFetchClient;
|
|
8
|
+
resetApiClient(): void;
|
|
9
|
+
}
|
|
10
|
+
export declare class NumberLookupService {
|
|
11
|
+
private readonly _numberLookup;
|
|
12
|
+
private readonly lazyClient;
|
|
13
|
+
constructor(params: SinchClientParameters);
|
|
14
|
+
setApiClientConfig(newParams: SinchClientParameters): void;
|
|
15
|
+
/**
|
|
16
|
+
* Update the default hostname for each API
|
|
17
|
+
*
|
|
18
|
+
* @param {string} hostname - The new hostname to use for all the APIs.
|
|
19
|
+
*/
|
|
20
|
+
setHostname(hostname: string): void;
|
|
21
|
+
setCredentials(credentials: Partial<UnifiedCredentials>): void;
|
|
22
|
+
lookup(data: NumberLookupRequestData): Promise<NumberLookupResponse>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NumberLookupService = exports.LazyNumberLookupApiClient = void 0;
|
|
4
|
+
const sdk_client_1 = require("@sinch/sdk-client");
|
|
5
|
+
const number_lookup_1 = require("./number-lookup");
|
|
6
|
+
class LazyNumberLookupApiClient {
|
|
7
|
+
constructor(sharedConfig) {
|
|
8
|
+
this.sharedConfig = sharedConfig;
|
|
9
|
+
}
|
|
10
|
+
getApiClient() {
|
|
11
|
+
if (!this.apiFetchClient) {
|
|
12
|
+
const apiClientOptions = (0, sdk_client_1.buildOAuth2ApiClientOptions)(this.sharedConfig, 'Number Lookup');
|
|
13
|
+
this.apiFetchClient = new sdk_client_1.ApiFetchClient(apiClientOptions);
|
|
14
|
+
this.apiFetchClient.apiClientOptions.hostname = this.sharedConfig.numberLookupHostname ?? sdk_client_1.NUMBER_LOOKUP_HOSTNAME;
|
|
15
|
+
}
|
|
16
|
+
return this.apiFetchClient;
|
|
17
|
+
}
|
|
18
|
+
resetApiClient() {
|
|
19
|
+
this.apiFetchClient = undefined;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.LazyNumberLookupApiClient = LazyNumberLookupApiClient;
|
|
23
|
+
class NumberLookupService {
|
|
24
|
+
constructor(params) {
|
|
25
|
+
const sharedClient = new LazyNumberLookupApiClient(params);
|
|
26
|
+
this.lazyClient = sharedClient;
|
|
27
|
+
this._numberLookup = new number_lookup_1.NumberLookupApi(sharedClient);
|
|
28
|
+
}
|
|
29
|
+
setApiClientConfig(newParams) {
|
|
30
|
+
this.lazyClient.sharedConfig = newParams;
|
|
31
|
+
this.lazyClient.resetApiClient();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Update the default hostname for each API
|
|
35
|
+
*
|
|
36
|
+
* @param {string} hostname - The new hostname to use for all the APIs.
|
|
37
|
+
*/
|
|
38
|
+
setHostname(hostname) {
|
|
39
|
+
this.lazyClient.sharedConfig.numberLookupHostname = hostname;
|
|
40
|
+
this.lazyClient.getApiClient().apiClientOptions.hostname = hostname;
|
|
41
|
+
}
|
|
42
|
+
setCredentials(credentials) {
|
|
43
|
+
const parametersBackup = { ...this.lazyClient.sharedConfig };
|
|
44
|
+
this.lazyClient.sharedConfig = {
|
|
45
|
+
...parametersBackup,
|
|
46
|
+
...credentials,
|
|
47
|
+
};
|
|
48
|
+
this.lazyClient.resetApiClient();
|
|
49
|
+
try {
|
|
50
|
+
this.lazyClient.getApiClient();
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
console.error('Impossible to assign the new credentials to the Number Lookup API');
|
|
54
|
+
this.lazyClient.sharedConfig = parametersBackup;
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async lookup(data) {
|
|
59
|
+
return this._numberLookup.lookup(data);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.NumberLookupService = NumberLookupService;
|
|
63
|
+
//# sourceMappingURL=number-lookup-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-lookup-service.js","sourceRoot":"","sources":["../../../src/rest/v2/number-lookup-service.ts"],"names":[],"mappings":";;;AAAA,kDAM2B;AAC3B,mDAAkD;AAGlD,MAAa,yBAAyB;IAEpC,YAAmB,YAAmC;QAAnC,iBAAY,GAAZ,YAAY,CAAuB;IAAG,CAAC;IAEnD,YAAY;QACjB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACzB,MAAM,gBAAgB,GAAG,IAAA,wCAA2B,EAAC,IAAI,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;YACzF,IAAI,CAAC,cAAc,GAAG,IAAI,2BAAc,CAAC,gBAAgB,CAAC,CAAC;YAC3D,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,oBAAoB,IAAI,mCAAsB,CAAC;QACnH,CAAC;QACD,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAEM,cAAc;QACnB,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;IAClC,CAAC;CACF;AAhBD,8DAgBC;AAED,MAAa,mBAAmB;IAK9B,YAAY,MAA6B;QACvC,MAAM,YAAY,GAAG,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC;QAC3D,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC;QAE/B,IAAI,CAAC,aAAa,GAAG,IAAI,+BAAe,CAAC,YAAY,CAAC,CAAC;IACzD,CAAC;IAEM,kBAAkB,CAAC,SAAgC;QACxD,IAAI,CAAC,UAAU,CAAC,YAAY,GAAG,SAAS,CAAC;QACzC,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACI,WAAW,CAAC,QAAgB;QACjC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,oBAAoB,GAAG,QAAQ,CAAC;QAC7D,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,gBAAgB,CAAC,QAAQ,GAAG,QAAQ,CAAC;IACtE,CAAC;IAEM,cAAc,CAAC,WAAwC;QAC5D,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;QAC7D,IAAI,CAAC,UAAU,CAAC,YAAY,GAAG;YAC7B,GAAG,gBAAgB;YACnB,GAAG,WAAW;SACf,CAAC;QACF,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;QACjC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,mEAAmE,CAAC,CAAC;YACnF,IAAI,CAAC,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC;YAChD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,IAA6B;QAC/C,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF;AA9CD,kDA8CC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sinch/number-lookup",
|
|
3
|
+
"version": "1.4.0",
|
|
4
|
+
"description": "Sinch Number Lookup SDK for Node.js",
|
|
5
|
+
"homepage": "",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": ""
|
|
9
|
+
},
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"author": "Sinch",
|
|
12
|
+
"main": "dist/index.js",
|
|
13
|
+
"types": "dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"require": "./dist/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"directories": {
|
|
21
|
+
"src": "dist",
|
|
22
|
+
"test": "tests"
|
|
23
|
+
},
|
|
24
|
+
"files": ["/dist"],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "yarn run clean && yarn run compile",
|
|
27
|
+
"clean": "rimraf dist tsconfig.tsbuildinfo",
|
|
28
|
+
"compile": "tsc -p tsconfig.build.json && tsc -p tsconfig.tests.json && rimraf dist/tests && rimraf tsconfig.build.tsbuildinfo",
|
|
29
|
+
"test:e2e": "cucumber-js"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@sinch/sdk-client": "^1.4.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"directory": "dist",
|
|
37
|
+
"access": "public"
|
|
38
|
+
}
|
|
39
|
+
}
|