tock / ai.tock.bot.connector.ga

Package ai.tock.bot.connector.ga

Google Assistant connector implementation. See GAConnector

Types

GAConnector

class GAConnector : ConnectorBase

GaNotificationClient

https://developers.google.com/actions/assistant/updates/notifications

class GaNotificationClient

GARequestConnectorMessage

data class GARequestConnectorMessage : ConnectorMessage

GAResponseConnectorMessage

data class GAResponseConnectorMessage : ConnectorMessage

Annotations

GAHandler

To specify ConnectorStoryHandler for Google Assistant connector. KClass passed as value of this annotation must have a primary constructor with a single not optional StoryHandlerDefinitionBase argument.

annotation class GAHandler

Properties

gaConnectorType

The Google Assistant ConnectorType.

val gaConnectorType: ConnectorType

Functions

basicCard

Provides a GABasicCard with all available parameters.

fun I18nTranslator.basicCard(title: CharSequence?, subtitle: CharSequence?, formattedText: CharSequence?, image: GAImage?, buttons: List<GAButton>): GABasicCard

Provides a GABasicCard with only one GAButton (only one is supported for now anyway).

fun I18nTranslator.basicCard(title: CharSequence? = null, subtitle: CharSequence? = null, formattedText: CharSequence? = null, image: GAImage? = null, button: GAButton? = null): GABasicCard

Provides a GABasicCard without formattedText.

fun I18nTranslator.basicCard(title: CharSequence, subtitle: CharSequence, image: GAImage, button: GAButton): GABasicCard

Provides a GABasicCard with title and button.

fun I18nTranslator.basicCard(title: CharSequence, button: GAButton): GABasicCard

Provides a GABasicCard with title and subtitle.

fun I18nTranslator.basicCard(title: CharSequence, subtitle: CharSequence): GABasicCard

Provides a GABasicCard with title and image.

fun I18nTranslator.basicCard(title: CharSequence, image: GAImage): GABasicCard

Provides a GABasicCard with title, subtitle and image.

fun I18nTranslator.basicCard(title: CharSequence, subtitle: CharSequence, image: GAImage): GABasicCard

Provides a GABasicCard with an image.

fun I18nTranslator.basicCard(image: GAImage): GABasicCard

carouselItem

Provides a GACarouselItem with String parameters.

fun <T : Bus<T>> T.carouselItem(targetIntent: IntentAware, title: CharSequence, description: CharSequence? = null, image: GAImage? = null, vararg parameters: Pair<String, String>): GACarouselItem

Provides a GACarouselItem with Parameters parameters.

fun <T : Bus<T>> T.carouselItem(targetIntent: IntentAware, title: CharSequence, description: CharSequence? = null, image: GAImage? = null, parameters: Parameters): GACarouselItem

Provides a GACarouselItem with StoryStep and Parameters parameters.

fun <T : Bus<T>> T.carouselItem(targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>?, title: CharSequence, description: CharSequence? = null, image: GAImage? = null, parameters: Parameters): GACarouselItem

Provides a GACarouselItem with StoryStep and String parameters.

fun <T : Bus<T>> T.carouselItem(targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>?, title: CharSequence, description: CharSequence? = null, image: GAImage? = null, vararg parameters: Pair<String, String>): GACarouselItem

endForGoogleAssistant

Sends a Google Assistant message as last bot answer, only if the ConnectorType of the current BotBus is gaConnectorType.

fun <T : Bus<T>> T.endForGoogleAssistant(messageProvider: T.() -> GAResponseConnectorMessage, delay: Long = defaultDelay(currentAnswerIndex)): T

expectedIntentForCarousel

Provides a GAExpectedIntent with a GACarouselSelect.

fun I18nTranslator.expectedIntentForCarousel(items: List<GACarouselItem>): GAExpectedIntent

expectedIntentForList

Provides a GAExpectedIntent with a GAListSelect.

fun I18nTranslator.expectedIntentForList(items: List<GAListItem>, title: CharSequence? = null): GAExpectedIntent

expectedIntentForSimpleSelect

Provides a GAExpectedIntent with a GASimpleSelect.

fun I18nTranslator.expectedIntentForSimpleSelect(items: List<GASelectItem>): GAExpectedIntent

expectedTextIntent

The common GAIntent.text.

fun expectedTextIntent(): GAExpectedIntent

findTransactionDecisionValueV3

Return a GATransactionDecisionValueV3 if available.

fun ConnectorMessage.findTransactionDecisionValueV3(): GATransactionDecisionValueV3?

findTransactionRequirementsCheckResultV3

Return a GATransactionRequirementsCheckResultV3 if available.

fun ConnectorMessage.findTransactionRequirementsCheckResultV3(): GATransactionRequirementsCheckResultV3?

flexibleSimpleResponse

Provides a GASimpleResponse with specified textToSpeech, ssml and displayText.

fun I18nTranslator.flexibleSimpleResponse(textToSpeech: CharSequence? = null, ssml: CharSequence? = null, displayText: CharSequence? = null): GASimpleResponse

gaButton

Provides a GAButton.

fun I18nTranslator.gaButton(title: CharSequence, url: String): GAButton

gaFinalMessage

Final Google Assistant message (end of conversation).

fun I18nTranslator.gaFinalMessage(richResponse: GARichResponse): GAResponseConnectorMessage
fun I18nTranslator.gaFinalMessage(text: CharSequence? = null): GAResponseConnectorMessage

gaFlexibleMessageForCarousel

Add a basic card if only one element in the items list, in order to avoid the limitation of 2 items.

fun I18nTranslator.gaFlexibleMessageForCarousel(items: List<GACarouselItem>, suggestions: List<CharSequence> = emptyList(), oneItemTitle: CharSequence? = null, oneItemSubtitle: CharSequence? = null, oneItemDescription: CharSequence? = null, oneItemSuggestions: List<CharSequence> = emptyList()): GAResponseConnectorMessage
fun I18nTranslator.gaFlexibleMessageForCarousel(items: List<GACarouselItem>, suggestions: List<CharSequence> = emptyList(), oneItemSuggestions: List<CharSequence> = emptyList(), oneItemBasicCardProvider: (GACarouselItem) -> GABasicCard = { basicCard( it.title.raw, if (it.image != null) it.description?.raw else null, if (it.image == null) it.description?.raw else null, it.image ) }): GAResponseConnectorMessage

gaFlexibleMessageForList

Add a basic card if only one element in the items list in order to avoid the limitation of 2 items.

fun I18nTranslator.gaFlexibleMessageForList(items: List<GAListItem>, title: CharSequence? = null, suggestions: List<CharSequence> = emptyList(), oneItemTitle: CharSequence? = null, oneItemSubtitle: CharSequence? = null, oneItemDescription: CharSequence? = null, oneItemSuggestions: List<CharSequence> = emptyList()): GAResponseConnectorMessage

gaImage

Provides a GAImage with all available parameters.

fun I18nTranslator.gaImage(url: String, accessibilityText: CharSequence, height: Int? = null, width: Int? = null): GAImage

gaLogout

fun gaLogout(): GAResponseConnectorMessage

gaMessage

Google Assistant Message with all available parameters.

fun I18nTranslator.gaMessage(inputPrompt: GAInputPrompt, possibleIntents: List<GAExpectedIntent> = listOf( expectedTextIntent() ), speechBiasingHints: List<String> = emptyList()): GAResponseConnectorMessage

Google Assistant Message with suggestions.

fun I18nTranslator.gaMessage(text: CharSequence, vararg suggestions: CharSequence): GAResponseConnectorMessage

Google Assistant Message with GABasicCard.

fun I18nTranslator.gaMessage(text: CharSequence, basicCard: GABasicCard): GAResponseConnectorMessage

Google Assistant Message with GARichResponse.

fun I18nTranslator.gaMessage(richResponse: GARichResponse): GAResponseConnectorMessage

Google Assistant Message with one GAExpectedIntent.

fun I18nTranslator.gaMessage(possibleIntent: GAExpectedIntent): GAResponseConnectorMessage

Google Assistant Message with multiple GAExpectedIntent.

fun I18nTranslator.gaMessage(possibleIntents: List<GAExpectedIntent>): GAResponseConnectorMessage

Google Assistant Message with text and multiple GAExpectedIntent.

fun I18nTranslator.gaMessage(text: CharSequence, possibleIntents: List<GAExpectedIntent>): GAResponseConnectorMessage

Provides a message with a GAListSelect.

fun I18nTranslator.gaMessage(gaRichResponse: GARichResponse, listItems: List<GAListItem>, title: CharSequence? = null): GAResponseConnectorMessage

gaMessageForCarousel

Provides a message with a GACarouselSelect.

fun I18nTranslator.gaMessageForCarousel(items: List<GACarouselItem>, suggestions: List<CharSequence> = emptyList()): GAResponseConnectorMessage

gaMessageForList

Provides a message with a GAListSelect and a list of GASuggestion.

fun I18nTranslator.gaMessageForList(items: List<GAListItem>, title: CharSequence? = null, suggestions: List<CharSequence> = emptyList()): GAResponseConnectorMessage

gaTransactionOrderDecision

Build an GATransactionDecisionValueSpecV3 message.

fun I18nTranslator.gaTransactionOrderDecision(order: GAOrder, orderOptions: GAOrderOptionsV3? = null, paymentParameters: GAPaymentParameters? = null, presentationOptions: GAPresentationOptions? = null): GAResponseConnectorMessage

gaTransactionOrderUpdate

Build an GAStructuredResponse from an GAOrderUpdateV3.

fun I18nTranslator.gaTransactionOrderUpdate(orderUpdate: GAOrderUpdateV3): GAResponseConnectorMessage

gaTransactionRequirementsCheckV3

Build a GATransactionRequirementsCheckSpecV3 response.

fun I18nTranslator.gaTransactionRequirementsCheckV3(): GAResponseConnectorMessage

inputPrompt

Provides a GAInputPrompt with all available parameters.

fun I18nTranslator.inputPrompt(richResponse: GARichResponse, noInputPrompts: List<GASimpleResponse> = emptyList()): GAInputPrompt

Provides a GAInputPrompt with a simple GARichResponse builder.

fun I18nTranslator.inputPrompt(text: CharSequence, linkOutSuggestion: GALinkOutSuggestion? = null, noInputPrompts: List<GASimpleResponse> = emptyList()): GAInputPrompt

item

Provides a GAItem with all available parameters.

fun I18nTranslator.item(simpleResponse: GASimpleResponse? = null, basicCard: GABasicCard? = null, structuredResponse: GAStructuredResponse? = null): GAItem

Provides a GAItem with a GABasicCard.

fun I18nTranslator.item(basicCard: GABasicCard): GAItem

Provides a GAItem with a GAStructuredResponse.

fun I18nTranslator.item(structuredResponse: GAStructuredResponse): GAItem

Provides a GAItem with a GASimpleResponse.

fun I18nTranslator.item(simpleResponse: GASimpleResponse): GAItem

linkOutSuggestion

Provides a GALinkOutSuggestion.

fun I18nTranslator.linkOutSuggestion(destinationName: CharSequence, url: String): GALinkOutSuggestion

listItem

Provides a GAListItem with String parameters without description.

fun <T : Bus<T>> T.listItem(title: CharSequence, targetIntent: IntentAware, vararg parameters: Pair<String, String>): GAListItem
fun <T : Bus<T>> T.listItem(title: CharSequence, targetIntent: IntentAware, parameters: Parameters): GAListItem

Provides a GAListItem with String parameters with description and optional imageUrl.

fun <T : Bus<T>> T.listItem(title: CharSequence, targetIntent: IntentAware, description: CharSequence, imageUrl: String? = null, vararg parameters: Pair<String, String>): GAListItem

Provides a GAListItem with String parameters with description and optional imageUrl.

fun <T : Bus<T>> T.listItem(title: CharSequence, targetIntent: IntentAware, description: CharSequence?, imageUrl: String? = null, parameters: Parameters): GAListItem

Provides a GAListItem with StoryStep and Parameters parameters without description.

fun <T : Bus<T>> T.listItem(title: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>?, parameters: Parameters): GAListItem
fun <T : Bus<T>> T.listItem(title: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>?, vararg parameters: Pair<String, String>): GAListItem

Provides a GAListItem with StoryStep and Parameters parameters.

fun <T : Bus<T>> T.listItem(title: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>?, description: CharSequence? = null, imageUrl: String? = null, parameters: Parameters): GAListItem
fun <T : Bus<T>> T.listItem(title: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>?, description: CharSequence? = null, imageUrl: String? = null, vararg parameters: Pair<String, String>): GAListItem

optionInfo

Provides a GAOptionInfo with all available parameters.

fun <T : Bus<T>> T.optionInfo(title: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, vararg parameters: Pair<String, String>): GAOptionInfo

optionValueSpec

Provides a GAOptionValueSpec with all available parameters.

fun I18nTranslator.optionValueSpec(simpleSelect: GASimpleSelect? = null, listSelect: GAListSelect? = null, carouselSelect: GACarouselSelect? = null): GAOptionValueSpec

permissionIntent

Google Assistant Message asking for GAPermission.

fun I18nTranslator.permissionIntent(optionalContext: CharSequence? = null, vararg permissions: GAPermission): GAExpectedIntent

richResponse

Provides a GARichResponse with all available parameters.

fun richResponse(items: List<GAItem>, linkOutSuggestion: GALinkOutSuggestion? = null, suggestions: List<GASuggestion>): GARichResponse

Provides a GARichResponse with suggestions as String.

fun I18nTranslator.richResponse(items: List<GAItem>, linkOutSuggestion: GALinkOutSuggestion? = null, vararg suggestions: CharSequence): GARichResponse

Provides a GARichResponse without linkOutSuggestion.

fun I18nTranslator.richResponse(items: List<GAItem>, vararg suggestions: CharSequence): GARichResponse
fun I18nTranslator.richResponse(items: List<GAItem>, suggestions: List<CharSequence>): GARichResponse

Provides a GARichResponse with only one GAItem.

fun I18nTranslator.richResponse(item: GAItem, linkOutSuggestion: GALinkOutSuggestion? = null, suggestions: List<CharSequence>): GARichResponse
fun I18nTranslator.richResponse(item: GAItem, linkOutSuggestion: GALinkOutSuggestion? = null, vararg suggestions: CharSequence): GARichResponse

Provides a GARichResponse with text item.

fun I18nTranslator.richResponse(text: CharSequence, linkOutSuggestion: GALinkOutSuggestion? = null, suggestions: List<CharSequence>): GARichResponse
fun I18nTranslator.richResponse(text: CharSequence, linkOutSuggestion: GALinkOutSuggestion? = null, vararg suggestions: CharSequence): GARichResponse
fun I18nTranslator.richResponse(text: CharSequence, vararg suggestions: CharSequence): GARichResponse
fun I18nTranslator.richResponse(text: CharSequence, suggestions: List<CharSequence>): GARichResponse

Provides a GARichResponse with a text and a GABasicCard.

fun I18nTranslator.richResponse(text: CharSequence, basicCard: GABasicCard, linkOutSuggestion: GALinkOutSuggestion? = null, suggestions: List<CharSequence>): GARichResponse
fun I18nTranslator.richResponse(text: CharSequence, basicCard: GABasicCard, suggestions: List<CharSequence>): GARichResponse
fun I18nTranslator.richResponse(text: CharSequence, basicCard: GABasicCard, vararg suggestions: CharSequence): GARichResponse

Provides a GARichResponse with a GABasicCard.

fun I18nTranslator.richResponse(basicCard: GABasicCard, linkOutSuggestion: GALinkOutSuggestion? = null, suggestions: List<CharSequence>): GARichResponse
fun I18nTranslator.richResponse(basicCard: GABasicCard, suggestions: List<CharSequence>): GARichResponse
fun I18nTranslator.richResponse(basicCard: GABasicCard, vararg suggestions: CharSequence): GARichResponse

selectItem

Provides a GASelectItem with String parameters.

fun <T : Bus<T>> T.selectItem(title: CharSequence, targetIntent: IntentAware, vararg parameters: Pair<String, String>): GASelectItem

Provides a GASelectItem with option title and String parameters.

fun <T : Bus<T>> T.selectItem(title: CharSequence, targetIntent: IntentAware, optionTitle: CharSequence? = null, vararg parameters: Pair<String, String>): GASelectItem

Provides a GASelectItem with option title, StoryStep and Parameters parameters.

fun <T : Bus<T>> T.selectItem(title: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>, optionTitle: CharSequence? = null, parameters: Parameters): GASelectItem

Provides a GASelectItem with option title, StoryStep and String parameters.

fun <T : Bus<T>> T.selectItem(title: CharSequence, targetIntent: IntentAware, step: StoryStep<out StoryHandlerDefinition>? = null, optionTitle: CharSequence? = null, vararg parameters: Pair<String, String>): GASelectItem

sendToGoogleAssistant

Sends a Google Assistant message only if the ConnectorType of the current BotBus is gaConnectorType.

fun <T : Bus<T>> T.sendToGoogleAssistant(messageProvider: T.() -> GAResponseConnectorMessage, delay: Long = defaultDelay(currentAnswerIndex)): T

simpleResponse

Provides a GASimpleResponse with specified CharSequence.

fun I18nTranslator.simpleResponse(text: CharSequence): GASimpleResponse

suggestion

Provides a GASuggestion.

fun I18nTranslator.suggestion(text: CharSequence): GASuggestion

updatePermissionIntent

Google Assistant Message asking for update GAPermission.

fun I18nTranslator.updatePermissionIntent(intent: String): GAExpectedIntent

withGoogleAssistant

Adds a Google Assistant ConnectorMessage if the current connector is Google Assistant. You need to call BotBus.send or BotBus.end later to send this message.

fun <T : Bus<T>> T.withGoogleAssistant(messageProvider: () -> GAResponseConnectorMessage): T

withGoogleVoiceAssistant

If the device supports audio, adds a Google Assistant ConnectorMessage if the current connector is Google Assistant. You need to call BotBus.send or BotBus.end later to send this message.

fun <T : Bus<T>> T.withGoogleVoiceAssistant(messageProvider: () -> GAResponseConnectorMessage): T