Skip to content

Commit

Permalink
Make 'type' discriminator mandatoty
Browse files Browse the repository at this point in the history
  • Loading branch information
asein-sinch committed May 10, 2024
1 parent a9143f6 commit 355917f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface ScheduledVoiceProvisioning {
/** Timestamp when the status was last updated. */
lastUpdatedTime?: Date;
/** The type of voice configuration. Default is `RTC`. */
type: 'RTC' | 'EST' | 'FAX' | string;
type: 'RTC' | 'EST' | 'FAX';
/** 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 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.*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface VoiceConfiguration {
/** @see ScheduledVoiceProvisioning */
scheduledVoiceProvisioning?: ScheduledVoiceProvisioning | null;
/** The type of voice configuration. Default is `RTC`. */
type: 'RTC' | 'EST' | 'FAX' | string;
type: 'RTC' | 'EST' | 'FAX';
/** 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 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.*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ describe('AvailableNumberApi', () => {
searchPattern: 'START',
},
capabilities: ['SMS', 'VOICE'],
smsConfiguration: {
servicePlanId: 'servicePlanIdFromSinchDashboard',
},
voiceConfiguration: {
appId: 'appIdFromSinchDashboard',
},
},
};
const expectedResponse: Numbers.ActiveNumber = {
Expand All @@ -136,7 +142,7 @@ describe('AvailableNumberApi', () => {
smsConfiguration: {
servicePlanId: '',
scheduledProvisioning: {
servicePlanId: 'a4c187cffc754d2da37f594d46f35246',
servicePlanId: 'servicePlanIdFromSinchDashboard',
status: 'WAITING',
lastUpdatedTime: new Date('2023-11-21T17:47:52.950101Z'),
campaignId: '',
Expand All @@ -146,8 +152,18 @@ describe('AvailableNumberApi', () => {
},
voiceConfiguration: {
appId: '',
scheduledVoiceProvisioning: null,
scheduledVoiceProvisioning: {
appId: 'appIdFromSinchDashboard',
status: 'WAITING',
lastUpdatedTime: new Date('2023-11-21T17:47:52.950101Z'),
type: 'RTC',
trunkId: '',
serviceId: '',
},
lastUpdatedTime: null,
type: 'RTC',
trunkId: '',
serviceId: '',
},
callbackUrl: '',
};
Expand All @@ -172,6 +188,9 @@ describe('AvailableNumberApi', () => {
smsConfiguration: {
servicePlanId: 'servicePlanIdFromSinchDashboard',
},
voiceConfiguration: {
appId: 'appIdFromSinchDashboard',
},
},
};
const expectedResponse: Numbers.ActiveNumber = {
Expand All @@ -194,7 +213,7 @@ describe('AvailableNumberApi', () => {
smsConfiguration: {
servicePlanId: '',
scheduledProvisioning: {
servicePlanId: 'a4c187cffc754d2da37f594d46f35246',
servicePlanId: 'servicePlanIdFromSinchDashboard',
status: 'WAITING',
lastUpdatedTime: new Date('2023-11-21T17:47:52.950101Z'),
campaignId: '',
Expand All @@ -204,8 +223,18 @@ describe('AvailableNumberApi', () => {
},
voiceConfiguration: {
appId: '',
scheduledVoiceProvisioning: null,
scheduledVoiceProvisioning: {
appId: 'appIdFromSinchDashboard',
status: 'WAITING',
lastUpdatedTime: new Date('2023-11-21T17:47:52.950101Z'),
type: 'RTC',
trunkId: '',
serviceId: '',
},
lastUpdatedTime: null,
type: 'RTC',
trunkId: '',
serviceId: '',
},
callbackUrl: '',
};
Expand Down

0 comments on commit 355917f

Please sign in to comment.