UnbluAgentApi
public class UnbluAgentApi : UnbluCoreApi
The API to use to access unblu suite functionality like showing, opening conversations
Before calling any other function #configureApi should be called inside the AppDelegate.
Use the constants of UnbluEventApi to register for events and access their user info data
A typical flow for the usage would be:
AppDelegate#application() {
UnbluAgentApi.instance.configureApi(UnbluApiConfiguration(unbluBaseUrl: "<base-url>", apiKey: "<apiKey>"))
//register for general errors and/or also other events
NotificationCenter.default.addObserver(self, selector: #selector(AppDelegate.handleErrorEvent(notification:)), name: Notification.Name.UnbluError, object: nil)
//start the api. This could also be done later when it is needed, but it will take a while until the api is ready
UnbluAgentApi.instance.initApi(success: {<success handling>}, failure: {<error handling>})
}
SomeViewController#showConversations() {
//the conversations should be shown
UnbluAgentApi.instance.showUi(visible: true)
}
-
The instance of the UnbluAgentApi
Declaration
Swift
public static let instance: UnbluAgentApi