-
Notifications
You must be signed in to change notification settings - Fork 1
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-269 (Part 1/2): Refactor Voice models #24
Changes from 2 commits
56ff9e3
df548c4
0eb2d74
a4f8d00
e37bea0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,9 @@ | ||
/** | ||
* Model: AssignNumbers | ||
* | ||
* THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. | ||
* | ||
*/ | ||
|
||
|
||
export interface AssignNumbers { | ||
|
||
/** The phone number or list of numbers in E.164 format. */ | ||
numbers?: string[]; | ||
/** indicates the application where the number(s) will be assigned. If empty, the application key that is used to sign the request will be used. */ | ||
applicationkey?: string; | ||
/** indicates the DID capability that needs to be assigned to the chosen application. Valid values are 'voice' and 'sms'. Please note that the DID needs to support the selected capability. */ | ||
capability?: CapabilityEnum; | ||
capability?: 'voice' | 'sms'; | ||
} | ||
|
||
export type CapabilityEnum = 'voice' | 'sms'; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { ReasonEnum, ResultEnum } from '../enums'; | ||
import { VoicePrice } from '../voice-price'; | ||
import { Participant } from '../participant'; | ||
|
||
export interface CallObject { | ||
|
||
/** Contains the caller information. */ | ||
from?: Participant; | ||
/** Contains the callee information. */ | ||
to?: Participant; | ||
/** Must be `pstn` for PSTN. */ | ||
domain?: 'pstn'; | ||
/** The unique identifier of the call. */ | ||
callId?: string; | ||
/** The duration of the call in seconds. */ | ||
duration?: number; | ||
/** The status of the call. Either `ONGOING` or `FINAL` */ | ||
status?: 'ONGOING' | 'FINAL'; | ||
/** Contains the result of a call. */ | ||
result?: ResultEnum; | ||
/** Contains the reason why a call ended. */ | ||
reason?: ReasonEnum; | ||
/** The date and time of the call. */ | ||
timestamp?: Date; | ||
/** An object that can be used to pass custom information related to the call. */ | ||
custom?: string; | ||
/** The rate per minute that was charged for the call. */ | ||
userRate?: VoicePrice; | ||
/** The total amount charged for the call. */ | ||
debit?: VoicePrice; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type { CallObject } from './call-object'; |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* The returned call ID. | ||
*/ | ||
export interface CalloutResponse { | ||
|
||
/** The returned call identifier. */ | ||
callId?: string; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type { CalloutResponse } from './callout-response'; |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type { ConferenceDtmfOptions } from './conference-dtmf-options'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,10 @@ | ||
/** | ||
* Model: Destination | ||
* | ||
* THIS FILE HAS BEEN AUTOMATICALLY GENERATED. DO NOT EDIT. | ||
* | ||
*/ | ||
|
||
|
||
/** | ||
* The type of device and number or endpoint to call. | ||
*/ | ||
export interface Destination { | ||
|
||
/** Can be of type `number` for PSTN endpoints or of type `username` for data endpoints. */ | ||
type: TypeEnum; | ||
type: 'number' | 'username'; | ||
/** If the type is `number` the value of the endpoint is a phone number. If the type is `username` the value is the username for a data endpoint. */ | ||
endpoint: string; | ||
} | ||
|
||
export type TypeEnum = 'number' | 'username'; | ||
|
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It took me some time to identify what mean "CallObject" and it usage.
Finally have to ensure I was right by looking at the OAS file details to identify it is the
getCallResponseObj
schema.So finally, may be it could mean the name should convey more information for auto-documentation purpose and readability for maintainers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming is a complicated task :)
The main object here is a 'Call' which is also the name of the service 'Calls' and also the verb 'call'. This is why I've added the suffix 'Object' to be clear about which kind of call it was and to avoid a naming conflict.
Then, the operationId is
Calling_GetCallResult
but here "Result" doesn't mean "Response" but rather "Status" which confused me too. The response object defined in the specification isgetCallResponseObj
which is "the object that represents the response of a getCall (status) query". So I thought to name it "CallResponse" but then it would be confusing with the actions of the "Call" service.Long story short: what do you think about
CallInformation
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes; and it is not so far from documentation related to operation:
Get information about a call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. In the end it's
GetCallInformation
as it is the result of aGET
call, such as "get callbacks" for instance