ChatThreadsProvider
public protocol ChatThreadsProvider
The provider for thread related properties and methods.
-
The dynamic pre-chat survey element with title and custom fields.
To fill in the parameters of the pre-chat survey, use the
create(with:)
method.Declaration
Swift
var preChatSurvey: PreChatSurvey? { get }
-
The provider for message related properties and methods.
Declaration
Swift
var messages: MessagesProvider { get }
-
The provider for chat fields related properties and methods.
Declaration
Swift
var customFields: ContactCustomFieldsProvider { get }
-
The list of all chat threads.
Declaration
Swift
func get() -> [ChatThread]
Return Value
List of chat threads if any exist.
-
create()
AsynchronousCreates a new thread by sending an initial message to the thread.
Warning
If attempted on a channel that only supports a single thread, this will fail once a thread is already created.Warning
Channel might have configured dynamic pre-chat survey with required contact custom fields. These identifiers and values must be sent. To fill in the parameters of the pre-chat survey, use the
create(with:)
method. Otherwise; this method throwsmissingPreChatCustomFields
.Throws
notConnected
if an attempt was made to use a method without connecting first. Make sure you call theconnect
method first.Throws
unsupportedChannelConfig
if the method being called is not supported with the current channel configuration.Throws
missingPreChatCustomFields
if the prechat survey has missing required fields.Declaration
Swift
func create() async throws
-
create(with:
Asynchronous) Creates a new thread with custom fields by sending an initial message to the thread.
Channel might have configured dynamic pre-chat survey with required contact custom fields. These values with its identifiers has to be sent in this method. Otherwise; this method throws
missingPreChatCustomFields
.Warning
If attempted on a channel that only supports a single thread, this will fail once a thread is already created.
Throws
notConnected
if an attempt was made to use a method without connecting first. Make sure you call theconnect
method first.Throws
unsupportedChannelConfig
if the method being called is not supported with the current channel configuration.Throws
missingPreChatCustomFields
if the server requires to fill-up some contact custom fields before initializing chat thread.Declaration
Swift
func create(with customFields: [String : String]) async throws
Parameters
customFields
The custom fields to be saved with thread creation.
-
Loads the a thread for the customer and gets messages.
Warning
If method receives
UUID
for a non existing thread, it throwsinvalidThread
error.Warning
Should only be used when opening a thread for multithreaded channel configuration or to reconnect after returning from the background.
Throws
notConnected
if an attempt was made to use a method without connecting first. Make sure you call theconnect
method first.Throws
customerAssociationFailure
if the SDK could not get customer identity and it may not have been set.Throws
invalidThread
if the provided ID for the thread was invalid, so the action could not be performed.Throws
EncodingError.invalidValue(_:_:)
if the given value is invalid in the current context for this format.Declaration
Swift
func load(with id: UUID?) throws
Parameters
id
The id of the thread to load. Optional, if omitted, it will attempt to load the customer’s active thread. If there is no active thread, this returns an error.
-
Updates the name for a thread.
Warning
Should only be used on a channel configured for multiple threads.
Throws
notConnected
if an attempt was made to use a method without connecting first. Make sure you call theconnect
method first.Throws
unsupportedChannelConfig
if the method being called is not supported with the current channel configuration.Throws
invalidThread
if the provided ID for the thread was invalid, so the action could not be performed.Throws
EncodingError.invalidValue(_:_:)
if the given value is invalid in the current context for this format.Throws
illegalThreadState
if the chat thread is not in the correct state.Declaration
Swift
func updateName(_ name: String, for id: UUID) throws
Parameters
name
The new name for the thread.
id
The unique identifier of the thread to load.
-
Archives a thread from the list of all threads.
Warning
Should only be used on a channel configured for multiple threads.
Throws
notConnected
if an attempt was made to use a method without connecting first. Make sure you call theconnect
method first.Throws
illegalThreadState
if the chat thread is not in the correct state.Throws
customerAssociationFailure
if the SDK could not get customer identity and it may not have been set.Throws
unsupportedChannelConfig
if the method being called is not supported with the current channel configuration.Throws
invalidThread
if the provided ID for the thread was invalid, so the action could not be performed.Throws
EncodingError.invalidValue(_:_:)
if the given value is invalid in the current context for this format.Declaration
Swift
func archive(_ thread: ChatThread) throws
Parameters
thread
The thread to load.
-
Reports that the most recent message of the specified thread was read by the customer.
Throws
notConnected
if an attempt was made to use a method without connecting first. Make sure you call theconnect
method first.Throws
customerAssociationFailure
if the SDK could not get customer identity and it may not have been set.Throws
illegalThreadState
if the chat thread is not in the correct state.Throws
EncodingError.invalidValue(_:_:)
if the given value is invalid in the current context for this format.Declaration
Swift
func markRead(_ thread: ChatThread) throws
Parameters
thread
The thread to load.
-
Invoke this when the customer wishes to end conversation.
Declaration
Swift
func endContact(_ thread: ChatThread) throws
Parameters
thread
The thread to be close.
Warning
Should only be used on a channel configured for live chat.Throws
notConnected
if an attempt was made to use a method without connecting first. Make sure you call theconnect
method first.Throws
customerAssociationFailure
if the SDK could not get customer identity and it may not have been set.Throws
unsupportedChannelConfig
if the method being called is not supported with the current channel configuration.Throws
missingParameter(_:)
if thecontactId
has not been set properly or it was unable to unwrap it as a required type.Throws
EncodingError.invalidValue(_:_:)
if the given value is invalid in the current context for this format. -
Reports that the customer has started or finished typing in the specified chat thread.
Throws
notConnected
if an attempt was made to use a method without connecting first. Make sure you call theconnect
method first.Throws
customerAssociationFailure
if the SDK could not get customer identity and it may not have been set.Throws
illegalThreadState
if the chat thread is not in the correct state.Throws
EncodingError.invalidValue(_:_:)
if the given value is invalid in the current context for this format.Declaration
Swift
func reportTypingStart(_ didStart: Bool, in thread: ChatThread) throws
Parameters
didStart
Indicator for start of finish typing.
thread
The thread where typing was started.