Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEVEXP-595: [Bugfix] Remove scheduledProvisioning elements from updat… #146

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions examples/simple-examples/src/numbers/active/update.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
getFaxServiceIdFromConfig,
getNumberCallbackUrlFromConfig,
getPhoneNumberFromConfig,
getPrintFormat,
Expand All @@ -16,6 +17,7 @@ import { Numbers } from '@sinch/sdk-core';
const phoneNumber = getPhoneNumberFromConfig();
const servicePlanId = getServicePlanIdFromConfig();
const callbackUrl = getNumberCallbackUrlFromConfig();
const faxServiceId = getFaxServiceIdFromConfig();

const requestData: Numbers.UpdateActiveNumberRequestData= {
phoneNumber,
Expand All @@ -24,6 +26,10 @@ import { Numbers } from '@sinch/sdk-core';
smsConfiguration: {
servicePlanId,
},
voiceConfiguration: {
type: 'FAX',
serviceId: faxServiceId,
},
callbackUrl,
},
};
Expand Down
1 change: 1 addition & 0 deletions packages/numbers/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Version 1.2.0
- [Tech] Update dependency `@sinch/sdk-client` to `1.2.0`.
- [Bugfix] Remove the "scheduledProvisioning" properties for SMS and Voice in the update number request.
- [Deprecation notice] `availableNumber` and `activeNumber` subdomain are deprecated and all methods are now defined on the upper numbers service.
All the methods names are the same except `availableNumber.list()` -> `searchForAvailableNumbers()`

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Money } from '../money';
import { SMSConfiguration } from '../sms-configuration';
import { VoiceConfiguration } from '../voice-configuration';
import { SMSConfigurationResponse } from '../sms-configuration';
import { VoiceConfigurationResponse } from '../voice-configuration';
import { CapabilitiesEnum, NumberTypeEnum } from '../enums';

/**
Expand Down Expand Up @@ -28,9 +28,9 @@ export interface ActiveNumber {
/** The timestamp when the subscription will expire if an expiration date has been set. */
expireAt?: Date | null;
/** @see SMSConfiguration */
smsConfiguration?: SMSConfiguration;
smsConfiguration?: SMSConfigurationResponse;
/** @see VoiceConfiguration */
voiceConfiguration?: VoiceConfiguration;
voiceConfiguration?: VoiceConfigurationResponse;
/** The active number\'s callback URL to be called for provisioning / deprovisioning updates */
callbackUrl?: string;
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export type { SMSConfiguration } from './sms-configuration';
export type { SMSConfiguration, SMSConfigurationResponse } from './sms-configuration';
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export interface SMSConfiguration {
servicePlanId: string;
/** 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. */
campaignId?: string;
}

export interface SMSConfigurationResponse extends SMSConfiguration {
/** @see ScheduledProvisioning */
scheduledProvisioning?: ScheduledProvisioning | null;
}
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
export type { VoiceConfiguration } from './voice-configuration';
export type {
VoiceConfiguration,
VoiceConfigurationRtc,
VoiceConfigurationFax,
VoiceConfigurationEst,
VoiceConfigurationResponse,
} from './voice-configuration';
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
import { ScheduledVoiceProvisioning } from '../scheduled-voice-provisioning';

/**
* The current voice configuration for this number.
*/
export type VoiceConfiguration = VoiceConfigurationRtc | VoiceConfigurationFax | VoiceConfigurationEst;

export interface VoiceConfigurationRtc {
/** The voice application type. */
type: 'RTC'
/** 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. */
appId?: string;
}

export interface VoiceConfigurationFax {
/** The voice application type. */
type: 'FAX'
/** 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.*/
serviceId?: string;
}

export interface VoiceConfigurationEst {
/** The voice application type. */
type: 'EST'
/** 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.*/
trunkId?: string;
}

/**
* 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.
*/
export interface VoiceConfiguration {
export interface VoiceConfigurationResponse {
/** 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. */
appId?: string;
/** Timestamp when the status was last updated. */
Expand Down
8 changes: 4 additions & 4 deletions packages/numbers/tests/rest/v1/numbers.steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Then('the response contains a rented phone number', () => {
assert.equal(activeNumber.paymentIntervalMonths, 1);
assert.deepEqual(activeNumber.nextChargeDate, new Date('2024-06-06T14:42:42.022227Z'));
assert.equal(activeNumber.expireAt, null);
const expectedSmsConfiguration: Numbers.SMSConfiguration = {
const expectedSmsConfiguration: Numbers.SMSConfigurationResponse = {
servicePlanId: '',
campaignId: '',
scheduledProvisioning: {
Expand All @@ -104,7 +104,7 @@ Then('the response contains a rented phone number', () => {
},
};
assert.deepEqual(activeNumber.smsConfiguration, expectedSmsConfiguration);
const expectedVoiceConfiguration: Numbers.VoiceConfiguration = {
const expectedVoiceConfiguration: Numbers.VoiceConfigurationResponse = {
type: 'RTC',
appId: '',
trunkId: '',
Expand Down Expand Up @@ -211,7 +211,7 @@ When('I send a request to update the phone number {string}', async (phoneNumber:
Then('the response contains a phone number with updated parameters', () => {
assert.equal(activeNumber.displayName, 'Updated description during E2E tests');
assert.equal(activeNumber.callbackUrl, 'https://my-callback-server.com/numbers');
const smsConfiguration: Numbers.SMSConfiguration = {
const smsConfiguration: Numbers.SMSConfigurationResponse = {
servicePlanId: 'SpaceMonkeySquadron',
campaignId: '',
scheduledProvisioning: {
Expand All @@ -223,7 +223,7 @@ Then('the response contains a phone number with updated parameters', () => {
},
};
assert.deepEqual(activeNumber.smsConfiguration, smsConfiguration);
const voiceVonfiguration: Numbers.VoiceConfiguration = {
const voiceVonfiguration: Numbers.VoiceConfigurationResponse = {
type: 'RTC',
appId: 'sunshine-rain-drop-very-beautifulday',
trunkId: '',
Expand Down
Loading