Class Handler
java.lang.Object
io.micronaut.function.executor.AbstractExecutor<C>
io.micronaut.function.executor.AbstractFunctionExecutor<I,O,com.amazonaws.services.lambda.runtime.Context>
io.micronaut.function.aws.MicronautRequestHandler<com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent,com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent>
io.micronaut.chatbots.lambda.AbstractHandler<TelegramBotConfiguration,Update,Send>
io.micronaut.chatbots.telegram.lambda.Handler
- All Implemented Interfaces:
com.amazonaws.services.lambda.runtime.RequestHandler<com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent,
,com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent> io.micronaut.context.ApplicationContextProvider
,io.micronaut.function.aws.MicronautLambdaContext
,io.micronaut.function.executor.FunctionExecutor<com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent,
,com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent> Closeable
,AutoCloseable
AWS Lambda Handler for a Telegram Bot Webhook.
- Since:
- 1.0.0
- Author:
- Sergio del Amo
-
Field Summary
Fields inherited from class io.micronaut.function.aws.MicronautRequestHandler
ENV_X_AMZN_TRACE_ID, LAMBDA_TRACE_HEADER_PROP
Fields inherited from class io.micronaut.function.executor.AbstractExecutor
applicationContext
Fields inherited from interface io.micronaut.function.aws.MicronautLambdaContext
ENVIRONMENT_LAMBDA
-
Constructor Summary
ConstructorDescriptionHandler()
Default constructor; will initialize a suitable ApplicationContext for Lambda deployment.Handler
(io.micronaut.context.ApplicationContext applicationContext) Constructor used to inject a preexistingApplicationContext
.Handler
(io.micronaut.context.ApplicationContextBuilder applicationContextBuilder) Constructor used to inject a preexistingApplicationContextBuilder
. -
Method Summary
Modifier and TypeMethodDescriptionprotected @NonNull Dispatcher<TelegramBotConfiguration,
Update, Send> protected @NonNull io.micronaut.serde.ObjectMapper
protected @NonNull com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent
okSerializer
(@NonNull Object body) protected @NonNull Optional<TelegramBotConfiguration>
parseBot
(@NonNull com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent request) parseToken
(@NonNull com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent request) protected @io.micronaut.core.annotation.NonNull boolean
validate
(@NonNull com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent request) Methods inherited from class io.micronaut.chatbots.lambda.AbstractHandler
execute, ok, ok, okHtml, okJson, parseHeader, response, serverError, unauthorized
Methods inherited from class io.micronaut.function.aws.MicronautRequestHandler
buildApplicationContext, convertInput, handleRequest, newApplicationContextBuilder
Methods inherited from class io.micronaut.function.executor.AbstractExecutor
close, getApplicationContext, resolveFunction, resolveFunctionName, startEnvironment
-
Constructor Details
-
Handler
public Handler()Default constructor; will initialize a suitable ApplicationContext for Lambda deployment. -
Handler
public Handler(io.micronaut.context.ApplicationContext applicationContext) Constructor used to inject a preexistingApplicationContext
.- Parameters:
applicationContext
- the application context
-
Handler
public Handler(io.micronaut.context.ApplicationContextBuilder applicationContextBuilder) Constructor used to inject a preexistingApplicationContextBuilder
.- Parameters:
applicationContextBuilder
- the application context builder
-
-
Method Details
-
validate
@NonNull protected @io.micronaut.core.annotation.NonNull boolean validate(@NonNull @NonNull com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent request) - Specified by:
validate
in classAbstractHandler<TelegramBotConfiguration,
Update, Send> - Parameters:
request
- API Gateway Request- Returns:
- Whether the request is valid or not
-
parseBot
@NonNull protected @NonNull Optional<TelegramBotConfiguration> parseBot(@NonNull @NonNull com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent request) - Specified by:
parseBot
in classAbstractHandler<TelegramBotConfiguration,
Update, Send> - Parameters:
request
- API Gateway Request- Returns:
- The Bot associated to the request
-
okSerializer
@NonNull protected @NonNull com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent okSerializer(@NonNull @NonNull Object body) - Specified by:
okSerializer
in classAbstractHandler<TelegramBotConfiguration,
Update, Send>
-
parseToken
@NonNull protected @NonNull Optional<String> parseToken(@NonNull @NonNull com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent request) - Parameters:
request
- The API Gateway Request- Returns:
- The Token
-
getObjectMapper
@NonNull protected @NonNull io.micronaut.serde.ObjectMapper getObjectMapper()- Specified by:
getObjectMapper
in classAbstractHandler<TelegramBotConfiguration,
Update, Send> - Returns:
- The Object Mapper
-
getDispatcher
- Specified by:
getDispatcher
in classAbstractHandler<TelegramBotConfiguration,
Update, Send> - Returns:
- The Dispatcher
-