@@ -22,10 +22,12 @@ export type AssetResourceMap = {
22
22
} ;
23
23
24
24
export interface TwilioResponse {
25
- setStatusCode ( code : number ) : void ;
26
- setBody ( body : string | object ) : void ;
27
- appendHeader ( key : string , value : string ) : void ;
28
- setHeaders ( headers : { [ key : string ] : string } ) : void ;
25
+ setStatusCode ( code : number ) : TwilioResponse ;
26
+ setBody ( body : string | object ) : TwilioResponse ;
27
+ appendHeader ( key : string , value : string ) : TwilioResponse ;
28
+ setHeaders ( headers : { [ key : string ] : string } ) : TwilioResponse ;
29
+ setCookie ( key : string , value : string , attributes ?: string [ ] ) : TwilioResponse ;
30
+ removeCookie ( key : string ) : TwilioResponse ;
29
31
}
30
32
31
33
export type RuntimeSyncClientOptions = TwilioClientOptions & {
@@ -53,9 +55,20 @@ export type ServerlessCallback = (
53
55
payload ?: object | string | number | boolean
54
56
) => void ;
55
57
58
+ export type ServerlessEventObject <
59
+ RequestBodyAndQuery = { } ,
60
+ Headers = { } ,
61
+ Cookies = { }
62
+ > = {
63
+ request : {
64
+ cookies : Cookies ;
65
+ headers : Headers ;
66
+ } ;
67
+ } & RequestBodyAndQuery ;
68
+
56
69
export type ServerlessFunctionSignature <
57
70
T extends EnvironmentVariables = { } ,
58
- U extends { } = { }
71
+ U extends ServerlessEventObject = { request : { cookies : { } ; headers : { } } }
59
72
> = (
60
73
context : Context < T > ,
61
74
event : U ,
0 commit comments