-
Notifications
You must be signed in to change notification settings - Fork 181
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
Added typings for VoiceAPI#364 #379
Merged
kellyjandrews
merged 4 commits into
Vonage:master
from
peppermint-juli:add-voice-typings
Nov 2, 2020
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,7 @@ declare module '@vonage/server-sdk' { | |
AccountNotEnabledForHTTP = '11', | ||
MessageTooLong = '12', | ||
InvalidSignature = '14', | ||
InvalidSenderAddress = '15', | ||
InvalidToAddress = '15', | ||
InvalidNetworkCode = '22', | ||
InvalidCallbackURL = '23', | ||
NonWhitelistedDestination = '29', | ||
|
@@ -98,7 +98,7 @@ declare module '@vonage/server-sdk' { | |
} | ||
|
||
export type SendSms = ( | ||
sender: string, | ||
To: string, | ||
recipient: string, | ||
message: string, | ||
opts: Partial<SendSmsOptions>, | ||
|
@@ -134,7 +134,7 @@ declare module '@vonage/server-sdk' { | |
export interface RequestObject { | ||
brand: string; | ||
number: string; | ||
sender_id?: string; | ||
To_id?: string; | ||
country?: string; | ||
code_length?: number; | ||
lg?: string; | ||
|
@@ -205,11 +205,137 @@ declare module '@vonage/server-sdk' { | |
[key: string]: any; | ||
} | ||
|
||
/* voice API */ | ||
export interface To{ | ||
type: string; | ||
number: string; | ||
dtmfAnswer?: string; | ||
} | ||
|
||
export interface From{ | ||
type: string; | ||
number: string; | ||
} | ||
|
||
export interface CallsResponse { | ||
count: number; | ||
page_size: number; | ||
record_index: number; | ||
_links: CallDetailLinks; | ||
_embedded: CallDetailEmbedded; | ||
} | ||
|
||
export interface CallDetailLinks { | ||
self: CallDetailsSelf; | ||
} | ||
|
||
export interface CallDetailsSelf { | ||
href: string; | ||
} | ||
|
||
export interface CallDetailEmbedded { | ||
calls: CallDetailCall[]; | ||
} | ||
|
||
export interface CallDetailCall { | ||
_links: CallDetailLinks; | ||
uuid: string; | ||
conversation_uuid: string; | ||
to: To; | ||
from: From; | ||
status: string; | ||
direction: string; | ||
rate: string; | ||
price: string; | ||
duration: string; | ||
start_time: Date; | ||
end_time: Date; | ||
network: string; | ||
} | ||
|
||
export interface OutboundCallRequest{ | ||
answer_url?: string[]; | ||
ncco?: Ncco[]; | ||
status: string; | ||
to: To[]; | ||
from: From; | ||
event_url: string[]; | ||
machine_detection: string; | ||
} | ||
|
||
export interface Ncco { | ||
action: string; | ||
text: string; | ||
} | ||
|
||
export interface OutboundCallResponse{ | ||
uuid: string; | ||
status: string; | ||
direction: string; | ||
conversation_uuid: string; | ||
} | ||
|
||
export interface CallDetailResponse { | ||
_links: CallDetailLinks; | ||
uuid: string; | ||
conversation_uuid: string; | ||
to: To; | ||
from: From; | ||
status: string; | ||
direction: string; | ||
rate: string; | ||
price: string; | ||
duration: string; | ||
start_time: Date; | ||
end_time: Date; | ||
network: string; | ||
} | ||
|
||
export interface InProgressCallRequest { | ||
action: string; | ||
destination?: Destination; | ||
} | ||
|
||
export interface Destination { | ||
type: string; | ||
ncco?: Ncco[]; | ||
url?: string[]; | ||
} | ||
|
||
export interface StreamAudioInCallRequest { | ||
stream_url: string[]; | ||
level?: string; | ||
} | ||
|
||
export interface ModifyInProgressCallResponse { | ||
message: string; | ||
uuid: string; | ||
} | ||
|
||
export interface TextToSpeechRequest { | ||
text: string; | ||
level?: string; | ||
} | ||
|
||
export interface DTMFRequest { | ||
digits: number; | ||
} | ||
|
||
export class Voice { | ||
constructor(credentials: CredentialsObject, options: { [key: string]: any }); | ||
sendTTSMessage(recipient: To, message: TextToSpeechRequest, options: CredentialsObject, callback: (data: ModifyInProgressCallResponse) => void ): void; | ||
sendTTSPromptWithCapture(recipient: To, message: TextToSpeechRequest, maxDigits: Number, callback: (data: ModifyInProgressCallResponse) => void ): void; | ||
sendTTSPromptWithConfirm(recipient: To, message: TextToSpeechRequest, maxDigits: Number, pinCode: string, byeText: string, failedText: string, callback: (data: ModifyInProgressCallResponse) => void ): void; | ||
call(recipient: To, answerUrl: string, opts: OutboundCallRequest, callback: (data: OutboundCallResponse) => void): void; | ||
__proto__: any; | ||
[key: string]: any; | ||
} | ||
|
||
/* Vonage */ | ||
export default class Vonage { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Voice class will need to be exported in the default class as well. |
||
constructor(credentials: CredentialsObject, options?: { [key: string]: any }); | ||
public readonly verify: Verify; | ||
public readonly message: Message; | ||
public readonly voice: Voice; | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Since these are updates to the messages interface, move the above changes into a separate PR. Thanks!