swift-server / swift-aws-lambda-runtime

Swift implementation of AWS Lambda Runtime
Apache License 2.0
1.12k stars 100 forks source link

README.MD example about SimpleLambdaHandler #285

Closed fitomad closed 1 year ago

fitomad commented 1 year ago

The README.MD file contains an example about the use of SimpleLambdaHandler receiving an Amazon SQS event

import AWSLambdaRuntime
import AWSLambdaEvents

@main
struct MyLambda: SimpleLambdaHandler {
    // In this example we are receiving a SQS Event, with no response (Void).
    func handle(_ event: SQS.Event, context: LambdaContext) async throws -> Void {
        ...
    }
}

There's no SQS.Event type available in the AWSLambdaEvents package, It seems that the expected type is SQSEvent

import AWSLambdaRuntime
import AWSLambdaEvents

@main
struct MyLambda: SimpleLambdaHandler {
    // In this example we are receiving a SQS Event, with no response (Void).
    func handle(_ event: SQSEvent, context: LambdaContext) async throws {
        ...
    }
}

Also removed the returning Void following the Apple style guide, but I understand that is presented due to educational purpose.

tomerd commented 1 year ago

thanks @fitomad would you like to submit a PR to address this?

fitomad commented 1 year ago

Created a PR with code #286 😜

tomerd commented 1 year ago

thanks @fitomad