-
public interface ConnectorA connector connects bots to users via a dedicated interface (like Messenger, Google Assistant, Slack... ).
There is one Connector for each user front-end application. See ai.tock.bot.connector.messenger.MessengerConnector or ai.tock.bot.connector.ga.GAConnector for examples of Connector implementations.
-
-
Method Summary
Modifier and Type Method Description BooleanhasFeature(ConnectorFeature feature, ConnectorType targetConnectorType)Is this feature supported ? abstract Unitregister(ConnectorController controller)Registers the connector for the specified controller. Unitunregister(ConnectorController controller)Unregisters the connector. abstract Unitsend(Event event, ConnectorCallback callback, Long delayInMs)Send an event with this connector for the specified delay. Unitnotify(ConnectorController controller, PlayerId recipientId, IntentAware intent, StoryStep<out StoryHandlerDefinition> step, Map<String, String> parameters, ActionNotificationType notificationType, Function1<Throwable, Unit> errorListener)Sends a notification to the connector. UserPreferencesloadProfile(ConnectorCallback callback, PlayerId userId)Load user preferences - default implementation returns null. UserPreferencesrefreshProfile(ConnectorCallback callback, PlayerId userId)Refresh user preferences - default implementation returns null. Function1<BotBus, ConnectorMessage>addSuggestions(CharSequence text, List<CharSequence> suggestions)Returns a ConnectorMessage with the specified list of suggestions. Function1<BotBus, ConnectorMessage>addSuggestions(ConnectorMessage message, List<CharSequence> suggestions)Updates a ConnectorMessage with the specified list of suggestions. Function1<BotBus, List<ConnectorMessage>>toConnectorMessage(MediaMessage message)Maps a MediaMessage into a ConnectorMessage. abstract ConnectorTypegetConnectorType()The type of the connector. Set<ConnectorFeature>getSupportedFeatures()-
-
Method Detail
-
hasFeature
Boolean hasFeature(ConnectorFeature feature, ConnectorType targetConnectorType)
Is this feature supported ?
-
register
abstract Unit register(ConnectorController controller)
Registers the connector for the specified controller.
-
unregister
Unit unregister(ConnectorController controller)
Unregisters the connector.
-
send
abstract Unit send(Event event, ConnectorCallback callback, Long delayInMs)
Send an event with this connector for the specified delay.
- Parameters:
event- the event to sendcallback- the initial connector callbackdelayInMs- the optional delay
-
notify
Unit notify(ConnectorController controller, PlayerId recipientId, IntentAware intent, StoryStep<out StoryHandlerDefinition> step, Map<String, String> parameters, ActionNotificationType notificationType, Function1<Throwable, Unit> errorListener)
Sends a notification to the connector. A BotBus is created and the corresponding story is called.
- Parameters:
controller- the connector controllerrecipientId- the recipient identifierintent- the notification intentstep- the optional step targetparameters- the optional parametersnotificationType- notification type if anyerrorListener- called when a message has not been delivered
-
loadProfile
UserPreferences loadProfile(ConnectorCallback callback, PlayerId userId)
Load user preferences - default implementation returns null.
-
refreshProfile
UserPreferences refreshProfile(ConnectorCallback callback, PlayerId userId)
Refresh user preferences - default implementation returns null. Only not null values are taken into account.
-
addSuggestions
Function1<BotBus, ConnectorMessage> addSuggestions(CharSequence text, List<CharSequence> suggestions)
Returns a ConnectorMessage with the specified list of suggestions. If the connector does not support suggestions, returns null.
-
addSuggestions
Function1<BotBus, ConnectorMessage> addSuggestions(ConnectorMessage message, List<CharSequence> suggestions)
Updates a ConnectorMessage with the specified list of suggestions. Default returns message unmodified.
-
toConnectorMessage
Function1<BotBus, List<ConnectorMessage>> toConnectorMessage(MediaMessage message)
Maps a MediaMessage into a ConnectorMessage. If toConnectorMessage returns an empty list, the mapping is not supported for this connector. Default returns an empty list.
-
getConnectorType
abstract ConnectorType getConnectorType()
The type of the connector.
-
getSupportedFeatures
Set<ConnectorFeature> getSupportedFeatures()
-
-
-
-