-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathtypes.d.ts
78 lines (66 loc) · 2.23 KB
/
types.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
import * as twilio from 'twilio';
import { ServiceContext } from 'twilio/lib/rest/sync/v1/service';
import { SyncListListInstance } from 'twilio/lib/rest/sync/v1/service/syncList';
import { SyncMapListInstance } from 'twilio/lib/rest/sync/v1/service/syncMap';
import { TwilioClientOptions } from 'twilio/lib/rest/Twilio';
export type EnvironmentVariables = {
[key: string]: string | undefined;
};
export type ResourceMap = {
[name: string]: {
path: string;
};
};
export type AssetResourceMap = {
[name: string]: {
path: string;
open(): string;
};
};
export interface TwilioResponse {
setStatusCode(code: number): void;
setBody(body: string | object): void;
appendHeader(key: string, value: string): void;
setHeaders(headers: { [key: string]: string }): void;
}
export type RuntimeSyncClientOptions = TwilioClientOptions & {
serviceName?: string;
};
export type RuntimeSyncServiceContext = ServiceContext & {
maps: SyncMapListInstance;
lists: SyncListListInstance;
};
export type RuntimeInstance = {
getAssets(): AssetResourceMap;
getFunctions(): ResourceMap;
getSync(options?: RuntimeSyncClientOptions): RuntimeSyncServiceContext;
};
export type Context<T = {}> = {
getTwilioClient(options?: TwilioClientOptions): twilio.Twilio;
DOMAIN_NAME: string;
PATH: string;
SERVICE_SID: string | undefined;
ENVIRONMENT_SID: string | undefined;
} & T;
export type ServerlessCallback = (
error: null | Error | string | object,
payload?: object | string | number | boolean
) => void;
export type ServerlessFunctionSignature<
T extends EnvironmentVariables = {},
U extends {} = {}
> = (
context: Context<T>,
event: U,
callback: ServerlessCallback
) => void | Promise<void>;
export type ResponseConstructor = new (...args: any[]) => TwilioResponse;
export type GlobalTwilio = Omit<typeof twilio, 'default'> & {
Response: ResponseConstructor;
};
export { ServiceContext } from 'twilio/lib/rest/sync/v1/service';
export { SyncListListInstance } from 'twilio/lib/rest/sync/v1/service/syncList';
export { SyncMapListInstance } from 'twilio/lib/rest/sync/v1/service/syncMap';
export { TwilioClientOptions } from 'twilio/lib/rest/Twilio';
export type TwilioClient = twilio.Twilio;
export type TwilioPackage = typeof twilio;