-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.d.ts
131 lines (116 loc) · 3.34 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/// <reference types="express" />
/// <reference types="twilio" />
import { Express, Handler } from "express";
import { TwimlResponse } from "twilio";
export default function (states: UsableState[], config: config): Express;
export type config = {
twilio: {
authToken: string;
validate?: boolean;
};
staticFiles?: (
{ path: string; middleware?: Handler; fingerprintUrl: undefined; } |
{ path: undefined; middleware: Handler; fingerprintUrl: fingerprintUrl; }
) & {
mountPath?: string;
holdMusic?: {
fileRelativeUri: string;
endpoint?: string;
twimlFor?: (urlFor: urlFor) => TwimlResponse | string;
};
};
urlFor: {
host: (req: Express.Request) => string;
scheme?: (req: Express.Request) => string;
}
};
export type fingerprintUrl = (path: string) => string;
export type urlFor = (path: string, options?: UrlForOptions) => string;
export type UrlForOptions = {
query?: any;
fingerprint?: boolean;
absolute?: boolean;
};
export type UsableState = BranchingState | EndState | NormalState | AsynchronousState;
export type State = UsableState | RenderableState | RoutableState;
export interface AbstractState {
name?: string;
}
export interface RoutableState extends AbstractState {
uri: string;
}
export interface BranchingState extends AbstractState {
transitionOut(inputData?: CallDataTwiml): Promise<UsableState> | UsableState;
}
export interface RenderableState extends AbstractState {
twimlFor(urlFor: urlFor, inputData?: CallDataTwiml): TwimlResponse | string;
}
export interface EndState extends RenderableState {
isEndState: true;
}
export interface AsynchronousState extends RenderableState {
backgroundTrigger(urlFor: urlFor, inputData?: CallDataTwiml): void;
}
export interface NormalState extends BranchingState, RenderableState {
processTransitionUri: string;
}
type CallDirection = "inbound" | "outbound-api" | "outbound-dial" | "trunking-terminating" | "trunking-originating";
type CallStatus = "queued" | "ringing" | "in-progress" | "busy" | "failed" | "canceled" | "no-answer" | "completed";
export interface CallDataTwiml {
CallSid: string;
Direction: CallDirection;
CallStatus: CallStatus;
AccountSid: string;
ForwardedFrom?: string;
CallerName?: string;
To: string;
ToCountry?: string;
ToState?: string;
ToCity?: string;
ToZip?: string;
From: string;
FromCountry?: string;
FromState?: string;
FromCity?: string;
FromZip?: string;
Called: string;
CalledCountry: string;
CalledState: string;
CalledCity: string;
CalledZip: string;
Caller: string;
CallerCountry: string;
CallerState: string;
CallerCity: string;
CallerZip: string;
ApiVersion: '2010-04-01';
}
export interface GatherDataTwiml extends CallDataTwiml {
msg: "Gather End";
Digits: string;
}
export interface CallDataAPI {
dateCreated: string | null;
dateUpdated: string | null;
startTime: string | null;
endTime: string | null;
duration: string | null;
parentCallSid: string | null;
toFormatted: string;
fromFormatted: string;
price: string | null;
priceUnit: string;
phoneNumberSid: string;
answeredBy: string | null;
forwardedFrom: string | null;
groupSid: string | null;
callerName: string | null;
uri: string;
sid: string;
direction: CallDirection;
status: CallStatus;
accountSid: string;
to: string;
from: string;
apiVersion: string;
}