Skip to content

Instantly share code, notes, and snippets.

@kinisoftware
Created October 12, 2019 11:36
Show Gist options
  • Select an option

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

Select an option

Save kinisoftware/5906c38c8a6ff4c110b0f756a5392dcd to your computer and use it in GitHub Desktop.
usingProgressiveResponse.kt
class NewReleasesIntentHandler(private val moviesGetter: MoviesGetter) : RequestHandler {
override fun canHandle(input: HandlerInput): Boolean {
return input.matches(Predicates.intentName("NewReleasesIntent"))
}
override fun handle(input: HandlerInput): Optional<Response> {
...
// Get slots values and so on
...
DirectiveServiceHandler(input).onRequestingUpcomings()
val movies = moviesGetter.getUpcomings(intentRequest.locale, dateValue)
...
// Create final response with results from the API
...
}
}
class YesIntentHandler(private val moviesGetter: MoviesGetter) : RequestHandler {
override fun canHandle(input: HandlerInput): Boolean {
return input.matches(Predicates.intentName("AMAZON.YesIntent"))
}
override fun handle(input: HandlerInput): Optional<Response> {
DirectiveServiceHandler(input).onRequestingNowPlayingMovies()
val movies = moviesGetter.getNowPlayingMovies(intentRequest.locale)
...
// Create final response with results from the API
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment