Skip to content

Commit a5e2fd0

Browse files
authored
Readme: Making Request and Response types explicit in Lambda.run callback (#111)
1 parent 0008e59 commit a5e2fd0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

readme.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ Next, create a `main.swift` and implement your Lambda.
5959
import AWSLambdaRuntime
6060

6161
// in this example we are receiving and responding with strings
62-
Lambda.run { (context, event: String, callback) in
63-
callback(.success("Hello, \(event)"))
62+
Lambda.run { (context, name: String, callback: @escaping (Result<String, Error>) -> Void) in
63+
callback(.success("Hello, \(name)"))
6464
}
6565
```
6666

@@ -81,7 +81,7 @@ Next, create a `main.swift` and implement your Lambda.
8181
}
8282

8383
// In this example we are receiving and responding with `Codable`.
84-
Lambda.run { (context, request: Request, callback) in
84+
Lambda.run { (context, request: Request, callback: @escaping (Result<Response, Error>) -> Void) in
8585
callback(.success(Response(message: "Hello, \(request.name)")))
8686
}
8787
```
@@ -94,7 +94,7 @@ Next, create a `main.swift` and implement your Lambda.
9494
import AWSLambdaEvents
9595

9696
// In this example we are receiving an SQS Message, with no response (Void).
97-
Lambda.run { (context, message: SQS.Message, callback) in
97+
Lambda.run { (context, message: SQS.Message, callback: @escaping (Result<Void, Error>) -> Void) in
9898
...
9999
callback(.success(Void()))
100100
}

0 commit comments

Comments
 (0)