You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// By passing in CustomInterface as a generic the async method signature will correctly identify newVersions as an array of CustomInterface, making TypeScript development easier (note that the generic is not required in JavaScript projects)
### Properties and methods available on wrapper signature
102
104
103
105
```ts
104
-
exportinterfaceApiSignature {
106
+
exportinterfaceApiSignature<T> {
105
107
event:APIGatewayEvent; // original event
106
-
body:any; // JSON parsed body payload if exists (otherwise null)
107
-
path: { [name:string]:string }; // path param payload as key-value pairs if exists (otherwise null)
108
-
query: { [name:string]:string }; // query param payload as key-value pairs if exists (otherwise null)
109
-
headers: { [name:string]:string }; // header payload as key-value pairs if exists (otherwise null)
108
+
body:T; // JSON parsed body payload if exists (otherwise undefined)
109
+
path: { [name:string]:string }; // path param payload as key-value pairs if exists (otherwise undefined)
110
+
query: { [name:string]:string }; // query param payload as key-value pairs if exists (otherwise undefined)
111
+
headers: { [name:string]:string }; // header payload as key-value pairs if exists (otherwise undefined)
110
112
testRequest:boolean; // indicates if this is a test request - looks for a header matching process.env.TEST_REQUEST_HEADER (dynamic from application) or 'Test-Request' (default)
111
113
auth:any; // auth context from custom authorizer if exists (otherwise null)
112
114
success(payload?:any, replacer?: (this:any, key:string, value:any) =>any):ApiResponse; // returns 200 status code with optional payload as body
// By passing in CustomInterface as a generic the async method signature will correctly identify newVersions as an array of CustomInterface, making TypeScript development easier (note that the generic is not required in JavaScript projects)
// By passing in CustomInterface as a generic the async method signature will correctly identify newVersions as an array of CustomInterface, making TypeScript development easier (note that the generic is not required in JavaScript projects)
// By passing in CustomInterface as a generic the async method signature will correctly identify newVersions as an array of CustomInterface, making TypeScript development easier (note that the generic is not required in JavaScript projects)
body: any;// JSON parsed body payload if exists (otherwise null)
32
-
path: {[name: string]: string};// path param payload as key-value pairs if exists (otherwise null)
33
-
query: {[name: string]: string};// query param payload as key-value pairs if exists (otherwise null)
34
-
headers: {[name: string]: string};// header payload as key-value pairs if exists (otherwise null)
31
+
body: T;// JSON parsed body payload if exists (otherwise undefined)
32
+
path: {[name: string]: string};// path param payload as key-value pairs if exists (otherwise undefined)
33
+
query: {[name: string]: string};// query param payload as key-value pairs if exists (otherwise undefined)
34
+
headers: {[name: string]: string};// header payload as key-value pairs if exists (otherwise undefined)
35
35
testRequest: boolean;// indicates if this is a test request - looks for a header matching process.env.TEST_REQUEST_HEADER (dynamic from application) or 'Test-Request' (default)
36
-
auth: any;// auth context from custom authorizer if exists (otherwise null)
36
+
auth: any;// auth context from custom authorizer if exists (otherwise undefined)
37
37
success(payload?: any,replacer?: (this: any,key: string,value: any)=>any): ApiResponse;// returns 200 status code with optional payload as body
38
38
invalid(errors?: string[]): ApiResponse;// returns 400 status code with optional errors as body
39
39
notFound(message?: string): ApiResponse;// returns 404 status code with optional message as body
0 commit comments