Package-level declarations

Types

Link copied to clipboard
data class ConversationPage(val conversations: List<VisitorConversationDto>, val hasMore: Boolean)

A page of the visitor's conversations.

Link copied to clipboard
data class DeviceRegistration(val token: String, val provider: PushProvider, val platform: String, val installId: String? = null, val locale: String? = null, val appVersion: String? = null, val osVersion: String? = null, val deviceModel: String? = null)

A device registered for pushes.

Link copied to clipboard
data class LeadResult(val conversationId: String?, val visitorId: String?)

Reply to leads.

Link copied to clipboard
data class MessagesPage(val items: List<TimelineItem>, val hasMore: Boolean)

A page of timeline items.

Link copied to clipboard
data class OfflineMessageResult(val conversation: ConversationSummary, val messageId: String)

Reply to the offline form.

Link copied to clipboard
data class ResetResult(val visitorToken: String, val visitorId: String)

Reply to reset.

Link copied to clipboard
data class RestoreResult(val visitorToken: String, val visitorId: String, val conversationId: String, val conversation: ConversationSummary? = null)

Reply to sessions/restore.

Link copied to clipboard
data class SendResult(val id: String, val seq: Int, val duplicate: Boolean)

Reply to the HTTP send fallback.

Link copied to clipboard
typealias UploadProgress = (sent: Long, total: Long) -> Unit

Called as an upload body streams out: sent of total bytes (on an OkHttp thread).

Link copied to clipboard
open class WidgetApi(baseUrl: String, val siteId: String, val appKey: String, val userAgent: String, client: OkHttpClient? = null, val timeout: Duration = 20.seconds)

The visitor REST API (/widget/v1/sites/{siteId}/…) over OkHttp. Every call sends the app key and the user agent; token calls add x-visitor-token. Failures throw HatangException: gateway errors ({statusCode, name, message}) keep their name as HatangException.code and the HTTP status; transport failures are network_error. Open so tests can script it.

Properties

Link copied to clipboard

Header carrying the site app key.

Link copied to clipboard

Header carrying the visitor token.