Interface BotBus
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classBotBus.Companion
-
Method Summary
Modifier and Type Method Description BooleanisIntent(IntentAware intentOwner)To know if the current intent is owned by the IntentAware. NlpCallStatsnlpStats()Returns the NLP call stats if an NLP call has occurred, null either. BooleanisChoiceAction()Is this current action is a SendChoice? Stringchoice(ParameterKey key)Returns the value of the specified choice parameter, null if the user action is not a SendChoice or if this parameter is not set. BooleanbooleanChoice(ParameterKey key)Returns true if the specified choice parameter has the "true" value, false either. BooleanhasChoiceValue(ParameterKey param, ParameterKey value)Checks that the specified choice parameter has the specified value. BooleanhasActionEntity(String role)Returns true if the current action has the specified entity role. BooleanhasActionEntity(Entity entity)Returns true if the current action has the specified entity role. <T extends Value> TentityValue(String role, Function1<EntityValue, T> valueTransformer)Returns the current value for the specified entity role. <T extends Value> TentityValue(Entity entity, Function1<EntityValue, T> valueTransformer)Returns the current value for the specified entity. StringentityText(Entity entity)Returns the current text content for the specified entity. StringentityText(String role)Returns the current text content for the specified entity. EntityValueentityValueDetails(Entity entity)Returns the current EntityValue for the specified entity. EntityValueentityValueDetails(String role)Returns the current EntityValue for the specified role. UnitchangeEntityValue(String role, EntityValue newValue)Updates the current entity value in the dialog. UnitchangeEntityValue(Entity entity, Value newValue)Updates the current entity value in the dialog. UnitchangeEntityValue(Entity entity, EntityValue newValue)Updates the current entity value in the dialog. UnitchangeEntityText(Entity entity, String textContent)Updates the current entity text value in the dialog. UnitremoveEntityValue(String role)Removes entity value for the specified role. UnitremoveEntityValue(Entity entity)Removes entity value for the specified role. UnitremoveAllEntityValues()Removes all current entity values. UnitresetDialogState()Resets all entity values, context values, ai.tock.bot.engine.dialog.DialogState.userLocation and ai.tock.bot.engine.dialog.DialogState.nextActionState but keep entity values history. abstract UnitchangeUserLocale(Locale locale)Sets the user's current locale, and updates this bus so that following translations use the same locale <T extends Any> TcontextValue(String name)Returns the persistent current context value. <T extends Any> TcontextValue(ParameterKey key)Returns the persistent current context value. UnitchangeContextValue(String name, Object value)Updates persistent context value. UnitchangeContextValue(ParameterKey key, Object value)Updates persistent context value. abstract <T extends Any> TgetBusContextValue(String name)Returns the non persistent current context value. <T extends Any> TgetBusContextValue(ParameterKey key)Returns the non persistent current context value. abstract UnitsetBusContextValue(String key, Object value)Updates the non persistent current context value. UnitsetBusContextValue(ParameterKey key, Object value)Updates the non persistent current context value. BotBusendRawText(CharSequence plainText, Long delay)Sends text that should not be translated as last bot answer. BotBusend(Message message, Long delay)Sends Message as last bot answer. abstract BotBusend(Action action, Long delay)Sends Action as last bot answer. BotBusend(MessagesList messages, Long initialDelay)Sends a MessagesList and end the dialog. BotBusend(Long delay, Function1<BotBus, Object> messageProvider)Sends messages provided by messageProvider as last bot answer. BotBusend(CharSequence i18nText, Long delay, Object i18nArgs)Sends i18nText as last bot answer. BotBusend(CharSequence i18nText, Object i18nArgs)Sends i18nText as last bot answer. BotBusend(Long delay)Send previously registered ConnectorMessage as last bot answer. BotBussend(Message message, Long delay)Sends a Message. BotBussend(MessagesList messages, Long initialDelay)Sends a MessagesList. abstract BotBussend(Action action, Long delay)Sends an Action. BotBussend(Event event, Long delayInMs)BotBussend(Long delay, Function1<BotBus, Object> messageProvider)Sends messages provided by messageProvider. BotBussend(Long delay)Sends previously registered ConnectorMessage. BotBussend(CharSequence i18nText, Long delay, Object i18nArgs)Sends i18nText. BotBussend(CharSequence i18nText, Object i18nArgs)Sends i18nText. abstract BotBuswithPriority(ActionPriority priority)Adds the specified ActionPriority to the bus context. abstract BotBuswithNotificationType(ActionNotificationType notificationType)Adds the specified ActionNotificationType to the bus context. abstract BotBuswithVisibility(ActionVisibility visibility)Adds the specified ActionVisibility to the bus context. abstract UnitreloadProfile()Reloads the user profile. UnitswitchStory(StoryDefinition storyDefinition, Intent starterIntent)Switches the context to the specified story definition (start a new Story). UnithandleAndSwitchStory(StoryDefinition storyDefinition, Intent starterIntent)Handles the action and switches the context to the specified story definition. MetriccreateMetric(MetricType type, String indicatorName, String indicatorValueName)Create one Metric StringgetTrackedStoryId()A tracked story is the last story in the dialog, wich flagged non metricStory, If it doesn't exist, the tracked story is the current one UnitskipAnswer()Does not send an answer. BooleanisFeatureEnabled(FeatureType feature, Boolean default)Is the feature enabled? abstract UnitmarkAsUnknown()Marks the current as not understood in the nlp model. I18nLabelValuei18n(CharSequence defaultLabel, List<Object> args)I18nLabelValuei18nKey(String key, CharSequence defaultLabel, Object args)Gets an i18n label with the specified key. I18nLabelValuei18nKey(String key, CharSequence defaultLabel, Set<I18nLocalizedLabel> localizedDefaults, Object args)Gets an i18n label with the specified key and defaults. LongdefaultDelay(Integer answerIndex)Get the default delay between two answers. BooleanisCompatibleWith(ConnectorType connectorType)Compatibility with other connector message is delegated to connector BotBuswithMessage(ConnectorMessage message)Adds the specified ConnectorMessage to the bus context if the targetConnectorType is compatible. abstract BotDefinitiongetBotDefinition()The bot definition of the current bot. abstract UserTimelinegetUserTimeline()The user timeline. abstract DialoggetDialog()The initial dialog for this user. abstract DialoggetCurrentDialog()The current dialog for this user (may be different from the initial dialog). IntentAwaregetCurrentIntent()abstract StorygetStory()The current story. abstract UnitsetStory(Story story)The current story. abstract ActiongetAction()The user action. abstract ConnectorDatagetConnectorData()The data specific to the connector (if any). abstract UserPreferencesgetUserPreferences()User preferences of the current user. abstract ConnectorgetUnderlyingConnector()The underlying Connector used. abstract Map<String, EntityStateValue>getEntities()The entities in the dialog state. abstract I18nKeyProvidergetI18nProvider()To manage i18n. abstract UnitsetI18nProvider(I18nKeyProvider i18nProvider)To manage i18n. abstract NextUserActionStategetNextUserActionState()Qualify the next user action. abstract UnitsetNextUserActionState(NextUserActionState nextUserActionState)Qualify the next user action. StoryStep<out StoryHandlerDefinition>getStep()UnitsetStep(StoryStep<out StoryHandlerDefinition> step)StringgetStepName()StringgetUserText()StringgetContextId()BooleangetTest()-
Methods inherited from class ai.tock.translator.I18nKeyProvider
i18n -
Methods inherited from class ai.tock.bot.engine.Bus
getApplicationId, getBotId, getCurrentAnswerIndex, getIntent, getUserId, sendDebugData, sendRawText, withMessage, withMessage -
Methods inherited from class ai.tock.bot.engine.I18nTranslator
getSourceConnectorType, getTargetConnectorType, getUserInterfaceType, getUserLocale, translate, translate, translate, translateAndReturnBlankAsNull -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
isIntent
Boolean isIntent(IntentAware intentOwner)
To know if the current intent is owned by the IntentAware.
-
nlpStats
NlpCallStats nlpStats()
Returns the NLP call stats if an NLP call has occurred, null either.
-
isChoiceAction
Boolean isChoiceAction()
Is this current action is a SendChoice?
-
choice
String choice(ParameterKey key)
Returns the value of the specified choice parameter, null if the user action is not a SendChoice or if this parameter is not set.
-
booleanChoice
Boolean booleanChoice(ParameterKey key)
Returns true if the specified choice parameter has the "true" value, false either.
-
hasChoiceValue
Boolean hasChoiceValue(ParameterKey param, ParameterKey value)
Checks that the specified choice parameter has the specified value.
-
hasActionEntity
Boolean hasActionEntity(String role)
Returns true if the current action has the specified entity role.
-
hasActionEntity
Boolean hasActionEntity(Entity entity)
Returns true if the current action has the specified entity role.
-
entityValue
<T extends Value> T entityValue(String role, Function1<EntityValue, T> valueTransformer)
Returns the current value for the specified entity role.
-
entityValue
<T extends Value> T entityValue(Entity entity, Function1<EntityValue, T> valueTransformer)
Returns the current value for the specified entity.
-
entityText
String entityText(Entity entity)
Returns the current text content for the specified entity.
-
entityText
String entityText(String role)
Returns the current text content for the specified entity.
-
entityValueDetails
EntityValue entityValueDetails(Entity entity)
Returns the current EntityValue for the specified entity.
-
entityValueDetails
EntityValue entityValueDetails(String role)
Returns the current EntityValue for the specified role.
-
changeEntityValue
Unit changeEntityValue(String role, EntityValue newValue)
Updates the current entity value in the dialog.
- Parameters:
role- entity rolenewValue- the new entity value
-
changeEntityValue
Unit changeEntityValue(Entity entity, Value newValue)
Updates the current entity value in the dialog.
- Parameters:
entity- the entity definitionnewValue- the new entity value
-
changeEntityValue
Unit changeEntityValue(Entity entity, EntityValue newValue)
Updates the current entity value in the dialog.
- Parameters:
entity- the entity definitionnewValue- the new entity value
-
changeEntityText
Unit changeEntityText(Entity entity, String textContent)
Updates the current entity text value in the dialog.
- Parameters:
entity- the entity definitiontextContent- the new entity text content
-
removeEntityValue
Unit removeEntityValue(String role)
Removes entity value for the specified role.
-
removeEntityValue
Unit removeEntityValue(Entity entity)
Removes entity value for the specified role.
-
removeAllEntityValues
Unit removeAllEntityValues()
Removes all current entity values.
-
resetDialogState
Unit resetDialogState()
Resets all entity values, context values, ai.tock.bot.engine.dialog.DialogState.userLocation and ai.tock.bot.engine.dialog.DialogState.nextActionState but keep entity values history.
-
changeUserLocale
abstract Unit changeUserLocale(Locale locale)
Sets the user's current locale, and updates this bus so that following translations use the same locale
-
contextValue
<T extends Any> T contextValue(String name)
Returns the persistent current context value.
-
contextValue
<T extends Any> T contextValue(ParameterKey key)
Returns the persistent current context value.
-
changeContextValue
Unit changeContextValue(String name, Object value)
Updates persistent context value. Do not store Collection or Map in the context, only plain objects or typed arrays.
-
changeContextValue
Unit changeContextValue(ParameterKey key, Object value)
Updates persistent context value.
-
getBusContextValue
abstract <T extends Any> T getBusContextValue(String name)
Returns the non persistent current context value. Bus context values are useful to store a temporary (ie request scoped) state.
-
getBusContextValue
<T extends Any> T getBusContextValue(ParameterKey key)
Returns the non persistent current context value. Bus context values are useful to store a temporary (ie request scoped) state.
-
setBusContextValue
abstract Unit setBusContextValue(String key, Object value)
Updates the non persistent current context value. Bus context values are useful to store a temporary (ie request scoped) state.
-
setBusContextValue
Unit setBusContextValue(ParameterKey key, Object value)
Updates the non persistent current context value. Bus context values are useful to store a temporary (ie request scoped) state.
-
endRawText
BotBus endRawText(CharSequence plainText, Long delay)
Sends text that should not be translated as last bot answer.
-
end
BotBus end(MessagesList messages, Long initialDelay)
Sends a MessagesList and end the dialog.
-
end
BotBus end(Long delay, Function1<BotBus, Object> messageProvider)
Sends messages provided by messageProvider as last bot answer. if messageProvider returns a CharSequence send it as text. Else call simply end().
-
end
BotBus end(CharSequence i18nText, Long delay, Object i18nArgs)
Sends i18nText as last bot answer.
-
end
BotBus end(CharSequence i18nText, Object i18nArgs)
Sends i18nText as last bot answer.
-
end
BotBus end(Long delay)
Send previously registered ConnectorMessage as last bot answer.
-
send
BotBus send(MessagesList messages, Long initialDelay)
Sends a MessagesList.
-
send
BotBus send(Long delay, Function1<BotBus, Object> messageProvider)
Sends messages provided by messageProvider. if messageProvider returns a CharSequence send it as text. Else call simply send().
-
send
BotBus send(Long delay)
Sends previously registered ConnectorMessage.
-
send
BotBus send(CharSequence i18nText, Long delay, Object i18nArgs)
Sends i18nText.
-
send
BotBus send(CharSequence i18nText, Object i18nArgs)
Sends i18nText.
-
withPriority
abstract BotBus withPriority(ActionPriority priority)
Adds the specified ActionPriority to the bus context.
-
withNotificationType
abstract BotBus withNotificationType(ActionNotificationType notificationType)
Adds the specified ActionNotificationType to the bus context.
-
withVisibility
abstract BotBus withVisibility(ActionVisibility visibility)
Adds the specified ActionVisibility to the bus context.
-
reloadProfile
abstract Unit reloadProfile()
Reloads the user profile.
-
switchStory
Unit switchStory(StoryDefinition storyDefinition, Intent starterIntent)
Switches the context to the specified story definition (start a new Story).
-
handleAndSwitchStory
Unit handleAndSwitchStory(StoryDefinition storyDefinition, Intent starterIntent)
Handles the action and switches the context to the specified story definition.
-
createMetric
Metric createMetric(MetricType type, String indicatorName, String indicatorValueName)
Create one Metric
- Parameters:
type- mandatory type of MetricindicatorName- optional indicator nameindicatorValueName- optional indicator value name
-
getTrackedStoryId
String getTrackedStoryId()
A tracked story is the last story in the dialog, wich flagged non metricStory, If it doesn't exist, the tracked story is the current one
-
skipAnswer
Unit skipAnswer()
Does not send an answer. Synchronous Connectors (like Google Assistant or Alexa) usually do not support skipping answer.
-
isFeatureEnabled
Boolean isFeatureEnabled(FeatureType feature, Boolean default)
Is the feature enabled?
- Parameters:
feature- the feature to checkdefault- the default value if the feature state is unknown
-
markAsUnknown
abstract Unit markAsUnknown()
Marks the current as not understood in the nlp model.
-
i18n
I18nLabelValue i18n(CharSequence defaultLabel, List<Object> args)
-
i18nKey
I18nLabelValue i18nKey(String key, CharSequence defaultLabel, Object args)
Gets an i18n label with the specified key.
-
i18nKey
I18nLabelValue i18nKey(String key, CharSequence defaultLabel, Set<I18nLocalizedLabel> localizedDefaults, Object args)
Gets an i18n label with the specified key and defaults.
-
defaultDelay
Long defaultDelay(Integer answerIndex)
Get the default delay between two answers.
-
isCompatibleWith
Boolean isCompatibleWith(ConnectorType connectorType)
Compatibility with other connector message is delegated to connector
-
withMessage
BotBus withMessage(ConnectorMessage message)
Adds the specified ConnectorMessage to the bus context if the targetConnectorType is compatible.
-
getBotDefinition
abstract BotDefinition getBotDefinition()
The bot definition of the current bot.
-
getUserTimeline
abstract UserTimeline getUserTimeline()
The user timeline. Gets history and data about the user.
-
getCurrentDialog
abstract Dialog getCurrentDialog()
The current dialog for this user (may be different from the initial dialog).
-
getCurrentIntent
IntentAware getCurrentIntent()
-
getConnectorData
abstract ConnectorData getConnectorData()
The data specific to the connector (if any).
-
getUserPreferences
abstract UserPreferences getUserPreferences()
User preferences of the current user.
-
getUnderlyingConnector
abstract Connector getUnderlyingConnector()
The underlying Connector used. Please do not use this method as it is exposed for third party libraries only.
-
getEntities
abstract Map<String, EntityStateValue> getEntities()
The entities in the dialog state.
-
getI18nProvider
abstract I18nKeyProvider getI18nProvider()
To manage i18n.
-
setI18nProvider
abstract Unit setI18nProvider(I18nKeyProvider i18nProvider)
To manage i18n.
-
getNextUserActionState
abstract NextUserActionState getNextUserActionState()
Qualify the next user action.
-
setNextUserActionState
abstract Unit setNextUserActionState(NextUserActionState nextUserActionState)
Qualify the next user action.
-
getStep
StoryStep<out StoryHandlerDefinition> getStep()
-
setStep
Unit setStep(StoryStep<out StoryHandlerDefinition> step)
-
getStepName
String getStepName()
-
getUserText
String getUserText()
-
getContextId
String getContextId()
-
-
-
-