Skip to content

Instantly share code, notes, and snippets.

@kinisoftware
Created February 22, 2020 10:48
Show Gist options
  • Select an option

  • Save kinisoftware/d2e9c372892496d33af1a8b17c79a1fa to your computer and use it in GitHub Desktop.

Select an option

Save kinisoftware/d2e9c372892496d33af1a8b17c79a1fa to your computer and use it in GitHub Desktop.
class LogRequestInterceptor : RequestInterceptor {
override fun process(input: HandlerInput) {
input.attributesManager.requestAttributes[SOME_REQUEST_ATTRIBUTE] = "someAttributeValue"
println("Request: ${JacksonSerializer().serialize(input.request)}")
}
}
class AnyIntentHandler : RequestHandler {
override fun canHandle(input: HandlerInput) =
input.matches(Predicates.intentName("AnyIntent"))
override fun handle(input: HandlerInput): Optional<Response> {
val someRequestAttribute = input.attributesManager.requestAttributes[SOME_REQUEST_ATTRIBUTE]
return input.responseBuilder.withSpeech("¡Hola!").build()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment