@sinch/numbers 1.1.0 → 1.2.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.
@@ -1,6 +1,6 @@
1
1
  import { Money } from '../money';
2
- import { SMSConfiguration } from '../sms-configuration';
3
- import { VoiceConfiguration } from '../voice-configuration';
2
+ import { SMSConfigurationResponse } from '../sms-configuration';
3
+ import { VoiceConfigurationResponse } from '../voice-configuration';
4
4
  import { CapabilitiesEnum, NumberTypeEnum } from '../enums';
5
5
  /**
6
6
  * The phone number that has been rented by a customer and assigned to a project.
@@ -27,9 +27,9 @@ export interface ActiveNumber {
27
27
  /** The timestamp when the subscription will expire if an expiration date has been set. */
28
28
  expireAt?: Date | null;
29
29
  /** @see SMSConfiguration */
30
- smsConfiguration?: SMSConfiguration;
30
+ smsConfiguration?: SMSConfigurationResponse;
31
31
  /** @see VoiceConfiguration */
32
- voiceConfiguration?: VoiceConfiguration;
32
+ voiceConfiguration?: VoiceConfigurationResponse;
33
33
  /** The active number\'s callback URL to be called for provisioning / deprovisioning updates */
34
34
  callbackUrl?: string;
35
35
  }
@@ -1 +1 @@
1
- export type { SMSConfiguration } from './sms-configuration';
1
+ export type { SMSConfiguration, SMSConfigurationResponse } from './sms-configuration';
@@ -7,6 +7,8 @@ export interface SMSConfiguration {
7
7
  servicePlanId: string;
8
8
  /** Only for US virtual numbers. This campaign ID relates to <a href=\"https://community.sinch.com/t5/10DLC/What-is-10DLC/ta-p/7845\" target=\"_blank\">10DLC numbers</a>. So, it is the current campaign ID for this number. The `campaignId` is found on your TCR platform. */
9
9
  campaignId?: string;
10
+ }
11
+ export interface SMSConfigurationResponse extends SMSConfiguration {
10
12
  /** @see ScheduledProvisioning */
11
13
  scheduledProvisioning?: ScheduledProvisioning | null;
12
14
  }
@@ -1 +1 @@
1
- export type { VoiceConfiguration } from './voice-configuration';
1
+ export type { VoiceConfiguration, VoiceConfigurationRtc, VoiceConfigurationFax, VoiceConfigurationEst, VoiceConfigurationResponse, } from './voice-configuration';
@@ -1,8 +1,30 @@
1
1
  import { ScheduledVoiceProvisioning } from '../scheduled-voice-provisioning';
2
+ /**
3
+ * The current voice configuration for this number.
4
+ */
5
+ export type VoiceConfiguration = VoiceConfigurationRtc | VoiceConfigurationFax | VoiceConfigurationEst;
6
+ export interface VoiceConfigurationRtc {
7
+ /** The voice application type. */
8
+ type: 'RTC';
9
+ /** Your app ID for the Voice API. The `appId` can be found in your <a href="https://dashboard.sinch.com/voice/apps" target="_blank">Sinch Customer Dashboard</a> under Voice, then apps. */
10
+ appId?: string;
11
+ }
12
+ export interface VoiceConfigurationFax {
13
+ /** The voice application type. */
14
+ type: 'FAX';
15
+ /** The service ID for the FAX configuration. The `serviceId` can be found in your <a href="https://dashboard.sinch.com/fax/services" target="_blank">Sinch Customer Dashboard</a> under fax, then services.*/
16
+ serviceId?: string;
17
+ }
18
+ export interface VoiceConfigurationEst {
19
+ /** The voice application type. */
20
+ type: 'EST';
21
+ /** The trunk ID for the EST voice configuration. The `trunkId` can be found in your <a href="https://dashboard.sinch.com/sip/trunks" target="_blank">Sinch Customer Dashboard</a> under sip, then trunks.*/
22
+ trunkId?: string;
23
+ }
2
24
  /**
3
25
  * The current voice configuration for this number. During scheduled provisioning, the app ID value may be empty in a response if it is still processing or if it has failed. The status of scheduled provisioning will show under a `scheduledVoiceProvisioning` object if it\'s still running. Once processed successfully, the `appId` sent will appear directly under the `voiceConfiguration` object.
4
26
  */
5
- export interface VoiceConfiguration {
27
+ export interface VoiceConfigurationResponse {
6
28
  /** Your app ID for the Voice API. The `appId` can be found in your <a href="https://dashboard.sinch.com/voice/apps" target="_blank">Sinch Customer Dashboard</a> under Voice, then apps. */
7
29
  appId?: string;
8
30
  /** Timestamp when the status was last updated. */
@@ -1,8 +1,9 @@
1
- import { SinchClientParameters } from '@sinch/sdk-client';
1
+ import { ApiListPromise, SinchClientParameters } from '@sinch/sdk-client';
2
2
  import { AvailableRegionsApi } from './available-regions';
3
3
  import { CallbacksApi } from './callbacks';
4
4
  import { AvailableNumberApi } from './available-number';
5
5
  import { ActiveNumberApi } from './active-number';
6
+ import { ActiveNumber, AvailableNumber, AvailableNumbersResponse, GetActiveNumberRequestData, GetAvailableNumberRequestData, ListActiveNumbersRequestData, ListAvailableNumbersRequestData, ReleaseNumberRequestData, RentAnyNumberRequestData, RentNumberRequestData, UpdateActiveNumberRequestData } from '../../models';
6
7
  /**
7
8
  * The Numbers Service exposes the following APIs:
8
9
  * - availableRegions
@@ -13,7 +14,9 @@ import { ActiveNumberApi } from './active-number';
13
14
  export declare class NumbersService {
14
15
  readonly availableRegions: AvailableRegionsApi;
15
16
  readonly callbacks: CallbacksApi;
17
+ /** @deprecated Use the methods exposed at the Numbers Service level instead */
16
18
  readonly availableNumber: AvailableNumberApi;
19
+ /** @deprecated Use the methods exposed at the Numbers Service level instead */
17
20
  readonly activeNumber: ActiveNumberApi;
18
21
  /**
19
22
  * Create a new NumbersService instance with its configuration. It needs the following parameters for authentication:
@@ -32,4 +35,49 @@ export declare class NumbersService {
32
35
  * @param {string} hostname - The new hostname to use for all the APIs.
33
36
  */
34
37
  setHostname(hostname: string): void;
38
+ /**
39
+ * This endpoint allows you to enter a specific phone number to check if it's available for use.
40
+ * A 200 response will return the number's capability, setup costs, monthly costs and if supporting documentation is required.
41
+ * If the phone number is not available, the API will return a 404 error.
42
+ * @param {GetAvailableNumberRequestData} data - The data to provide to the API call.
43
+ */
44
+ checkAvailability(data: GetAvailableNumberRequestData): Promise<AvailableNumber>;
45
+ /**
46
+ * Search for virtual numbers that are available for you to activate. You can filter by any property on the available number resource.
47
+ * @param {ListAvailableNumbersRequestData} data - The data to provide to the API call.
48
+ */
49
+ searchForAvailableNumbers(data: ListAvailableNumbersRequestData): Promise<AvailableNumbersResponse>;
50
+ /**
51
+ * Rent any virtual number that matches the criteria (Search for and activate an available Sinch virtual number all in one API call).
52
+ * @param {RentAnyNumberRequestData} data - The data to provide to the API call.
53
+ */
54
+ rentAny(data: RentAnyNumberRequestData): Promise<ActiveNumber>;
55
+ /**
56
+ * Rent a virtual number to use with SMS products, Voice products, or both. You'll use 'smsConfiguration' to set up your number for SMS and 'voiceConfiguration' for Voice.
57
+ * @param {RentNumberRequestData} data - The data to provide to the API call.
58
+ */
59
+ rent(data: RentNumberRequestData): Promise<ActiveNumber>;
60
+ /**
61
+ * Retrieve a virtual number's details
62
+ * @param {GetActiveNumberRequestData} data - The data to provide to the API call.
63
+ */
64
+ get(data: GetActiveNumberRequestData): Promise<ActiveNumber>;
65
+ /**
66
+ * Lists all virtual numbers for a project.
67
+ * @param {ListActiveNumbersRequestData} data - The data to provide to the API call.
68
+ * @return {ApiListPromise<ActiveNumber>}
69
+ */
70
+ list(data: ListActiveNumbersRequestData): ApiListPromise<ActiveNumber>;
71
+ /**
72
+ * Release number.
73
+ * With this endpoint, you can cancel your subscription for a specific virtual phone number.
74
+ * @param {ReleaseNumberRequestData} data - The data to provide to the API call.
75
+ */
76
+ release(data: ReleaseNumberRequestData): Promise<ActiveNumber>;
77
+ /**
78
+ * Update a virtual phone number. For example: you can configure SMS/Voice services or set a friendly name. To update the name that displays, modify the `displayName` parameter.
79
+ * You'll use `smsConfiguration` to update your SMS configuration and `voiceConfiguration` to update the voice configuration.
80
+ * @param {UpdateActiveNumberRequestData} data - The data to provide to the API call.
81
+ */
82
+ update(data: UpdateActiveNumberRequestData): Promise<ActiveNumber>;
35
83
  }
@@ -40,6 +40,67 @@ class NumbersService {
40
40
  this.availableRegions.setHostname(hostname);
41
41
  this.callbacks.setHostname(hostname);
42
42
  }
43
+ /**
44
+ * This endpoint allows you to enter a specific phone number to check if it's available for use.
45
+ * A 200 response will return the number's capability, setup costs, monthly costs and if supporting documentation is required.
46
+ * If the phone number is not available, the API will return a 404 error.
47
+ * @param {GetAvailableNumberRequestData} data - The data to provide to the API call.
48
+ */
49
+ async checkAvailability(data) {
50
+ return this.availableNumber.checkAvailability(data);
51
+ }
52
+ /**
53
+ * Search for virtual numbers that are available for you to activate. You can filter by any property on the available number resource.
54
+ * @param {ListAvailableNumbersRequestData} data - The data to provide to the API call.
55
+ */
56
+ async searchForAvailableNumbers(data) {
57
+ return this.availableNumber.list(data);
58
+ }
59
+ /**
60
+ * Rent any virtual number that matches the criteria (Search for and activate an available Sinch virtual number all in one API call).
61
+ * @param {RentAnyNumberRequestData} data - The data to provide to the API call.
62
+ */
63
+ async rentAny(data) {
64
+ return this.availableNumber.rentAny(data);
65
+ }
66
+ /**
67
+ * Rent a virtual number to use with SMS products, Voice products, or both. You'll use 'smsConfiguration' to set up your number for SMS and 'voiceConfiguration' for Voice.
68
+ * @param {RentNumberRequestData} data - The data to provide to the API call.
69
+ */
70
+ async rent(data) {
71
+ return this.availableNumber.rent(data);
72
+ }
73
+ /**
74
+ * Retrieve a virtual number's details
75
+ * @param {GetActiveNumberRequestData} data - The data to provide to the API call.
76
+ */
77
+ async get(data) {
78
+ return this.activeNumber.get(data);
79
+ }
80
+ /**
81
+ * Lists all virtual numbers for a project.
82
+ * @param {ListActiveNumbersRequestData} data - The data to provide to the API call.
83
+ * @return {ApiListPromise<ActiveNumber>}
84
+ */
85
+ list(data) {
86
+ return this.activeNumber.list(data);
87
+ }
88
+ /**
89
+ * Release number.
90
+ * With this endpoint, you can cancel your subscription for a specific virtual phone number.
91
+ * @param {ReleaseNumberRequestData} data - The data to provide to the API call.
92
+ */
93
+ async release(data) {
94
+ return this.activeNumber.release(data);
95
+ }
96
+ /**
97
+ * Update a virtual phone number. For example: you can configure SMS/Voice services or set a friendly name. To update the name that displays, modify the `displayName` parameter.
98
+ * You'll use `smsConfiguration` to update your SMS configuration and `voiceConfiguration` to update the voice configuration.
99
+ * @param {UpdateActiveNumberRequestData} data - The data to provide to the API call.
100
+ */
101
+ async update(data) {
102
+ return this.activeNumber.update(data);
103
+ }
43
104
  }
44
105
  exports.NumbersService = NumbersService;
45
106
  //# sourceMappingURL=numbers-service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"numbers-service.js","sourceRoot":"","sources":["../../../src/rest/v1/numbers-service.ts"],"names":[],"mappings":";;;AACA,2DAA0D;AAC1D,2CAA2C;AAC3C,yDAAwD;AACxD,mDAAkD;AAElD;;;;;;GAMG;AACH,MAAa,cAAc;IAMzB;;;;;;;;;OASG;IACH,YAAY,MAA6B;QACvC,IAAI,CAAC,gBAAgB,GAAG,IAAI,uCAAmB,CAAC,MAAM,CAAC,CAAC;QACxD,IAAI,CAAC,SAAS,GAAG,IAAI,wBAAY,CAAC,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,eAAe,GAAG,IAAI,qCAAkB,CAAC,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,YAAY,GAAG,IAAI,+BAAe,CAAC,MAAM,CAAC,CAAC;IAClD,CAAC;IAED;;;;OAIG;IACI,WAAW,CAAC,QAAgB;QACjC,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACxC,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC3C,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC5C,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;CACF;AAlCD,wCAkCC"}
1
+ {"version":3,"file":"numbers-service.js","sourceRoot":"","sources":["../../../src/rest/v1/numbers-service.ts"],"names":[],"mappings":";;;AACA,2DAA0D;AAC1D,2CAA2C;AAC3C,yDAAwD;AACxD,mDAAkD;AAelD;;;;;;GAMG;AACH,MAAa,cAAc;IAQzB;;;;;;;;;OASG;IACH,YAAY,MAA6B;QACvC,IAAI,CAAC,gBAAgB,GAAG,IAAI,uCAAmB,CAAC,MAAM,CAAC,CAAC;QACxD,IAAI,CAAC,SAAS,GAAG,IAAI,wBAAY,CAAC,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,eAAe,GAAG,IAAI,qCAAkB,CAAC,MAAM,CAAC,CAAC;QACtD,IA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O,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,CAAC,IAAmC;QACrD,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;CACF;AAzGD,wCAyGC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinch/numbers",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Sinch Numbers API",
5
5
  "homepage": "",
6
6
  "repository": {
@@ -25,13 +25,15 @@
25
25
  "scripts": {
26
26
  "build": "yarn run clean && yarn run compile",
27
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"
28
+ "compile": "tsc -p tsconfig.build.json && tsc -p tsconfig.tests.json && rimraf dist/tests && rimraf tsconfig.build.tsbuildinfo",
29
+ "test:e2e": "cucumber-js"
29
30
  },
30
31
  "dependencies": {
31
- "@sinch/sdk-client": "^1.1.0"
32
+ "@sinch/sdk-client": "^1.2.0"
32
33
  },
33
34
  "devDependencies": {},
34
35
  "publishConfig": {
35
- "directory": "dist"
36
+ "directory": "dist",
37
+ "access": "public"
36
38
  }
37
39
  }