TwilioConversationsClient Class Reference

Inherits from NSObject
Declared in TwilioConversationsClient.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

TwilioConversationsClient.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

TwilioConversationsClient.h

  connectionState

The client’s current connection state.

@property (nonatomic, assign, readonly) TCHClientConnectionState connectionState

Discussion

The client’s current connection state.

Declared In

TwilioConversationsClient.h

  synchronizationStatus

The current client synchronization state.

@property (nonatomic, assign, readonly) TCHClientSynchronizationStatus synchronizationStatus

Discussion

The current client synchronization state.

Declared In

TwilioConversationsClient.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

TwilioConversationsClient.h

+ logLevel

The logging level for the client.

+ (TCHLogLevel)logLevel

Return Value

The log level.

Discussion

The logging level for the client.

Declared In

TwilioConversationsClient.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

TwilioConversationsClient.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

TwilioConversationsClient.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

TwilioConversationsClient.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

TwilioConversationsClient.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

TwilioConversationsClient.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

TwilioConversationsClient.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

TwilioConversationsClient.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

TwilioConversationsClient.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

TwilioConversationsClient.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

TwilioConversationsClient.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

TwilioConversationsClient.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 incomming 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

TwilioConversationsClient.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

TwilioConversationsClient.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

TwilioConversationsClient.h