TwilioConversationsClient Class Reference

Inherits from NSObject
Declared in TCHConversationsClient.h

Overview

Represents a conversations client connection to Twilio.

  delegate

Messaging client delegate

@property (nonatomic, weak, nullable) id<TwilioConversationsClientDelegate> delegate

Discussion

Messaging client delegate

Declared In

TCHConversationsClient.h

  user

The logged in user in the conversation system.

@property (nonatomic, strong, readonly, nullable) TCHUser *user

Discussion

The logged in user in the conversation system.

Declared In

TCHConversationsClient.h

  connectionState

The client’s current connection state.

@property (nonatomic, assign, readonly) TCHClientConnectionState connectionState

Discussion

The client’s current connection state.

Declared In

TCHConversationsClient.h

  synchronizationStatus

The current client synchronization state.

@property (nonatomic, assign, readonly) TCHClientSynchronizationStatus synchronizationStatus

Discussion

The current client synchronization state.

Declared In

TCHConversationsClient.h

  dispatchQueue

Queue all completions and events would fire from. If not set here or in properties on a client creation, main queue would be used.

@property (nonatomic, readwrite, nonnull) dispatch_queue_t dispatchQueue

Discussion

Queue all completions and events would fire from. If not set here or in properties on a client creation, main queue would be used.

Declared In

TCHConversationsClient.h

+ setLogLevel:

Sets the logging level for the client.

+ (void)setLogLevel:(TCHLogLevel)logLevel

Parameters

logLevel

The new log level.

Discussion

Sets the logging level for the client.

Declared In

TCHConversationsClient.h

+ logLevel

The logging level for the client.

+ (TCHLogLevel)logLevel

Return Value

The log level.

Discussion

The logging level for the client.

Declared In

TCHConversationsClient.h

+ conversationsClientWithToken:properties:delegate:completion:

Initialize a new conversations client instance.

+ (void)conversationsClientWithToken:(nonnull NSString *)token properties:(nullable TwilioConversationsClientProperties *)properties delegate:(nullable id<TwilioConversationsClientDelegate>)delegate completion:(nonnull TCHTwilioClientCompletion)completion

Parameters

token

The client access token to use when communicating with Twilio.

properties

The properties to initialize the client with, if this is nil defaults will be used.

delegate

Delegate conforming to TwilioConversationsClientDelegate for conversations client lifecycle notifications.

completion

Completion block that will specify the result of the operation and a reference to the new TwilioConversationsClient.

Discussion

Initialize a new conversations client instance.

Declared In

TCHConversationsClient.h

+ sdkName

Returns the name of the SDK for diagnostic purposes.

+ (nonnull NSString *)sdkName

Return Value

An identifier for the Conversations SDK.

Discussion

Returns the name of the SDK for diagnostic purposes.

Declared In

TCHConversationsClient.h

+ sdkVersion

Returns the version of the SDK

+ (nonnull NSString *)sdkVersion

Return Value

The conversations client version.

Discussion

Returns the version of the SDK

Declared In

TCHConversationsClient.h

– updateToken:completion:

Updates the access token currently being used by the client.

- (void)updateToken:(nonnull NSString *)token completion:(nullable TCHCompletion)completion

Parameters

token

The updated client access token to use when communicating with Twilio.

completion

Completion block that will specify the result of the operation.

Discussion

Updates the access token currently being used by the client.

Declared In

TCHConversationsClient.h

– myConversations

Retrieve a list of conversations currently subscribed to on the client.

- (nullable NSArray<TCHConversation*> *)myConversations

Return Value

An array of all of the client’s currently subscribed conversations.

Discussion

Retrieve a list of conversations currently subscribed to on the client.

This will be nil until the client is fully initialized, see the client delegate callback conversationsClient:synchronizationStatusUpdated:

Declared In

TCHConversationsClient.h

– createConversationWithOptions:completion:

Create a new conversation with the specified options.

- (void)createConversationWithOptions:(nullable NSDictionary<NSString*,id> *)options completion:(nullable TCHConversationCompletion)completion

Parameters

options

Conversation options for new conversation whose keys are TCHConversationOption* constants. (optional - may be empty or nil)

completion

Completion block that will specify the result of the operation and a reference to the new conversation.

Discussion

Create a new conversation with the specified options.

TCHConversationOptionFriendlyName - String friendly name (optional)

TCHConversationOptionUniqueName - String unique name (optional)

TCHConversationOptionAttributes - Expected value is an valid json object, see also TCHConversation setAttributes:completion: (optional)

Declared In

TCHConversationsClient.h

– conversationWithSidOrUniqueName:completion:

Obtains a conversation with the specified id or unique name.

- (void)conversationWithSidOrUniqueName:(nonnull NSString *)sidOrUniqueName completion:(nonnull TCHConversationCompletion)completion

Parameters

sidOrUniqueName

Identifier or unique name for the conversation.

completion

Completion block that will specify the result of the operation and a reference to the requested conversation if it exists.

Discussion

Obtains a conversation with the specified id or unique name.

Declared In

TCHConversationsClient.h

– participantsWithIdentity:

Obtain all participants across available conversations with the given identity.

- (nonnull NSArray<TCHParticipant*> *)participantsWithIdentity:(nonnull NSString *)identity

Parameters

identity

The identity of the user to to search in multiple conversations.

Return Value

The array of participants for this user.

Discussion

Obtain all participants across available conversations with the given identity.

Declared In

TCHConversationsClient.h

– users

Provides all subscribed-to users.

- (nullable NSArray<TCHUser*> *)users

Return Value

The array of subscribed users.

Discussion

Provides all subscribed-to users.

Declared In

TCHConversationsClient.h

– subscribedUserWithIdentity:completion:

Obtain a subscribed user object for the given identity. If no current subscription exists for this user, this will fetch the user and subscribe them. The least recently subscribed user object will be unsubscribed if you reach your instance’s user subscription limit.

- (void)subscribedUserWithIdentity:(nonnull NSString *)identity completion:(nonnull TCHUserCompletion)completion

Parameters

identity

The identity of the user to obtain.

completion

Completion block that will specify the result of the operation and the newly subscribed user.

Discussion

Obtain a subscribed user object for the given identity. If no current subscription exists for this user, this will fetch the user and subscribe them. The least recently subscribed user object will be unsubscribed if you reach your instance’s user subscription limit.

Declared In

TCHConversationsClient.h

– registerWithNotificationToken:completion:

Register APNS token for push notification updates.

- (void)registerWithNotificationToken:(nonnull NSData *)token completion:(nullable TCHCompletion)completion

Parameters

token

The APNS token which usually comes from didRegisterForRemoteNotificationsWithDeviceToken.

completion

Completion block that will specify the result of the operation.

Discussion

Register APNS token for push notification updates.

Declared In

TCHConversationsClient.h

– deregisterWithNotificationToken:completion:

De-register from push notification updates.

- (void)deregisterWithNotificationToken:(nonnull NSData *)token completion:(nullable TCHCompletion)completion

Parameters

token

The APNS token which usually comes from didRegisterForRemoteNotificationsWithDeviceToken.

completion

Completion block that will specify the result of the operation.

Discussion

De-register from push notification updates.

Declared In

TCHConversationsClient.h

– handleNotification:completion:

Queue the incoming notification with the messaging library for processing - notifications usually arrive from didReceiveRemoteNotification.

- (void)handleNotification:(nonnull NSDictionary *)notification completion:(nullable TCHCompletion)completion

Parameters

notification

The incoming notification.

completion

Completion block that will specify the result of the operation.

Discussion

Queue the incoming notification with the messaging library for processing - notifications usually arrive from didReceiveRemoteNotification.

Declared In

TCHConversationsClient.h

– isReachabilityEnabled

Indicates whether reachability is enabled for this instance.

- (BOOL)isReachabilityEnabled

Return Value

YES if reachability is enabled.

Discussion

Indicates whether reachability is enabled for this instance.

Declared In

TCHConversationsClient.h

– shutdown

Cleanly shut down the messaging subsystem when you are done with it.

- (void)shutdown

Discussion

Cleanly shut down the messaging subsystem when you are done with it.

Declared In

TCHConversationsClient.h

– getTemporaryContentUrlsForMedia:completion:

Get content URLs for all media attachments in the given set using a single network request.

- (nullable TCHCancellationToken *)getTemporaryContentUrlsForMedia:(nonnull NSSet<TCHMedia*> *)media completion:(nonnull TCHMediaSidsCompletion)completion

Parameters

media

The set of media objects to query for content URLs.

completion

The listener to receive a map of media sids to a content temporary URL.

Return Value

The cancellation token to cancel the network request.

Discussion

Get content URLs for all media attachments in the given set using a single network request.

Declared In

TCHConversationsClient.h

– getTemporaryContentUrlsForMediaSids:completion:

Get content URLs for all media attachments in the given set using a single network request.

- (nullable TCHCancellationToken *)getTemporaryContentUrlsForMediaSids:(nonnull NSSet<NSString*> *)sids completion:(nonnull TCHMediaSidsCompletion)completion

Parameters

sids

The set of sids of media sids to query for content URLs.

completion

The listener to receive a map of media sids to a content temporary URL.

Return Value

The cancellation token to cancel the network request.

Discussion

Get content URLs for all media attachments in the given set using a single network request.

Declared In

TCHConversationsClient.h