Skip to content

Commit b305247

Browse files
committed
Readme: Making Request and Response types explicit in Lambda.run callback
1 parent 5e546a1 commit b305247

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

readme.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +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, payload: String, callback) in
62+
Lambda.run {
63+
(context, payload: String, callback: @escaping (Result<String, Error>) -> (Void)) in
6364
callback(.success("Hello, \(payload)"))
6465
}
6566
```
@@ -81,7 +82,8 @@ Next, create a `main.swift` and implement your Lambda.
8182
}
8283

8384
// In this example we are receiving and responding with `Codable`.
84-
Lambda.run { (context, request: Request, callback) in
85+
Lambda.run {
86+
(context, request: Request, callback: @escaping (Result<Response, Error>) -> (Void)) in
8587
callback(.success(Response(message: "Hello, \(request.name)")))
8688
}
8789
```
@@ -94,7 +96,8 @@ Next, create a `main.swift` and implement your Lambda.
9496
import AWSLambdaEvents
9597

9698
// In this example we are receiving an SQS Message, with no response (Void).
97-
Lambda.run { (context, message: SQS.Message, callback) in
99+
Lambda.run {
100+
(context, message: SQS.Message, callback: @escaping (Result<Void, Error>) -> (Void)) in
98101
...
99102
callback(.success(Void()))
100103
}

0 commit comments

Comments
 (0)