Task Description: Implement an Alexa Skill Handler
You need to create the functionality for an Alexa skill handler that can process Lambda function calls following specific requirements outlined by the provided test code.
Requirements:
Skill Structure: Define a structure Skill that includes at least the following fields:
ApplicationID (string)
OnLaunch (function that takes a LaunchRequest and a ResponseEnvelope)
SkipValidation (bool)
Verbose (bool)
Lambda Skill Handler: Implement a method GetLambdaSkillHandler() for the Skill struct that returns a handler function compatible with AWS Lambda. This handler should:
Validate the incoming request's ApplicationID against the Skill.ApplicationID.
Validate the request.type to be a supported request type (e.g., LaunchRequest).
Set up a ResponseEnvelope that is returned after processing the request.
Response Structure: Define a structure ResponseEnvelope with a field Response and implement a method SetSimpleCard(title, content string) within Response that initializes a Card response. This Card should have at least:
Type (string, e.g., "Simple")
Title (string)
Content (string)
Error Handling: Ensure that the handler returns appropriate errors:
If the ApplicationID from the event does not match the Skill.ApplicationID, return an error stating "Request too old to continue (>150s)".
If the request.type is invalid, return an error stating "Invalid request type: [type]".
Test Files: The implementation must be able to read the sample input provided in ../resources/lambda_launch_request.json and produce results as expected in the tests.
Location: Place the implementation in the /app/ directory.
Make sure to follow the structure and requirements precisely to ensure all provided tests pass successfully.
Important: declare your solution in package alexa (the test file uses package alexa, so the implementation must use the matching package name).