TCHMessages Class Reference

Inherits from NSObject
Declared in TCHMessages.h

Overview

Representation of a chat channel’s message list.

  lastConsumedMessageIndex

Index of the last Message the User has consumed in this Channel.

@property (nonatomic, copy, readonly, nullable) NSNumber *lastConsumedMessageIndex

Discussion

Index of the last Message the User has consumed in this Channel.

Declared In

TCHMessages.h

– sendMessageWithOptions:completion:

Sends a message to the channel.

- (void)sendMessageWithOptions:(nonnull TCHMessageOptions *)options completion:(nullable TCHMessageCompletion)completion

Parameters

options

Message options.

completion

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

Discussion

Sends a message to the channel.

Declared In

TCHMessages.h

– removeMessage:completion:

Removes the specified message from the channel.

- (void)removeMessage:(nonnull TCHMessage *)message completion:(nullable TCHCompletion)completion

Parameters

message

The message to remove.

completion

Completion block that will specify the result of the operation.

Discussion

Removes the specified message from the channel.

Declared In

TCHMessages.h

– getLastMessagesWithCount:completion:

Fetches the most recent count messages. This will return locally cached messages if they are all available or may require a load from the server.

- (void)getLastMessagesWithCount:(NSUInteger)count completion:(nonnull TCHMessagesCompletion)completion

Parameters

count

The number of most recent messages to return.

completion

Completion block that will specify the result of the operation as well as the requested messages if successful. If no completion block is specified, no operation will be executed.

Discussion

Fetches the most recent count messages. This will return locally cached messages if they are all available or may require a load from the server.

Declared In

TCHMessages.h

– getMessagesBefore:withCount:completion:

Fetches at most count messages including and prior to the specified index. This will return locally cached messages if they are all available or may require a load from the server.

- (void)getMessagesBefore:(NSUInteger)index withCount:(NSUInteger)count completion:(nonnull TCHMessagesCompletion)completion

Parameters

index

The starting point for the request.

count

The number of preceeding messages to return.

completion

Completion block that will specify the result of the operation as well as the requested messages if successful. If no completion block is specified, no operation will be executed.

Discussion

Fetches at most count messages including and prior to the specified index. This will return locally cached messages if they are all available or may require a load from the server.

Declared In

TCHMessages.h

– getMessagesAfter:withCount:completion:

Fetches at most count messages including and subsequent to the specified index. This will return locally cached messages if they are all available or may require a load from the server.

- (void)getMessagesAfter:(NSUInteger)index withCount:(NSUInteger)count completion:(nonnull TCHMessagesCompletion)completion

Parameters

index

The starting point for the request.

count

The number of succeeding messages to return.

completion

Completion block that will specify the result of the operation as well as the requested messages if successful. If no completion block is specified, no operation will be executed.

Discussion

Fetches at most count messages including and subsequent to the specified index. This will return locally cached messages if they are all available or may require a load from the server.

Declared In

TCHMessages.h

– messageWithIndex:completion:

Returns the message with the specified index.

- (void)messageWithIndex:(nonnull NSNumber *)index completion:(nonnull TCHMessageCompletion)completion

Parameters

index

The index of the message.

completion

Completion block that will specify the result of the operation as well as the requested message if successful. If no completion block is specified, no operation will be executed.

Discussion

Returns the message with the specified index.

Declared In

TCHMessages.h

– messageForConsumptionIndex:completion:

Returns the oldest message starting at index. If the message at index exists, it will be returned otherwise the next oldest message that presently exists will be returned.

- (void)messageForConsumptionIndex:(nonnull NSNumber *)index completion:(nonnull TCHMessageCompletion)completion

Parameters

index

The index of the last message reported as read (may refer to a deleted message).

completion

Completion block that will specify the result of the operation as well as the requested message if successful. If no completion block is specified, no operation will be executed.

Discussion

Returns the oldest message starting at index. If the message at index exists, it will be returned otherwise the next oldest message that presently exists will be returned.

Declared In

TCHMessages.h

– setLastConsumedMessageIndex:

Set the last consumed index for this Member and Channel. Allows you to set any value, including smaller than the current index. (Deprecated: See setLastConsumedMessageIndex:completion:)

- (void)setLastConsumedMessageIndex:(nonnull NSNumber *)index

Parameters

index

The new index.

Discussion

Set the last consumed index for this Member and Channel. Allows you to set any value, including smaller than the current index.

Declared In

TCHMessages.h

– setLastConsumedMessageIndex:completion:

Set the last consumed index for this Member and Channel. Allows you to set any value, including smaller than the current index.

- (void)setLastConsumedMessageIndex:(nonnull NSNumber *)index completion:(nullable TCHCountCompletion)completion

Parameters

index

The new index.

completion

Optional completion block that will specify the result of the operation and an updated unconsumed message count for the user on this channel.

Discussion

Set the last consumed index for this Member and Channel. Allows you to set any value, including smaller than the current index.

Declared In

TCHMessages.h

– advanceLastConsumedMessageIndex:

Update the last consumed index for this Member and Channel. Only update the index if the value specified is larger than the previous value. (Deprecated: See advanceLastConsumedMessageIndex:completion:)

- (void)advanceLastConsumedMessageIndex:(nonnull NSNumber *)index

Parameters

index

The new index.

Discussion

Update the last consumed index for this Member and Channel. Only update the index if the value specified is larger than the previous value.

Declared In

TCHMessages.h

– advanceLastConsumedMessageIndex:completion:

Update the last consumed index for this Member and Channel. Only update the index if the value specified is larger than the previous value.

- (void)advanceLastConsumedMessageIndex:(nonnull NSNumber *)index completion:(nullable TCHCountCompletion)completion

Parameters

index

The new index.

completion

Optional completion block that will specify the result of the operation and an updated unconsumed message count for the user on this channel.

Discussion

Update the last consumed index for this Member and Channel. Only update the index if the value specified is larger than the previous value.

Declared In

TCHMessages.h

– setAllMessagesConsumed

Update the last consumed index for this Member and Channel to the max message currently on this device. (Deprecated: See setAllMessagesConsumed:completion:)

- (void)setAllMessagesConsumed

Discussion

Update the last consumed index for this Member and Channel to the max message currently on this device.

Declared In

TCHMessages.h

– setAllMessagesConsumedWithCompletion:

Update the last consumed index for this Member and Channel to the max message currently on this device.

- (void)setAllMessagesConsumedWithCompletion:(nullable TCHCountCompletion)completion

Parameters

completion

Optional completion block that will specify the result of the operation and an updated unconsumed message count for the user on this channel.

Discussion

Update the last consumed index for this Member and Channel to the max message currently on this device.

Declared In

TCHMessages.h

– setNoMessagesConsumed

Reset the last consumed index for this Member and Channel to no messages consumed. (Deprecated: See setNoMessagesConsumed:completion:)

- (void)setNoMessagesConsumed

Discussion

Reset the last consumed index for this Member and Channel to no messages consumed.

Declared In

TCHMessages.h

– setNoMessagesConsumedWithCompletion:

Reset the last consumed index for this Member and Channel to no messages consumed.

- (void)setNoMessagesConsumedWithCompletion:(nullable TCHCountCompletion)completion

Parameters

completion

Optional completion block that will specify the result of the operation and an updated unconsumed message count for the user on this channel.

Discussion

Reset the last consumed index for this Member and Channel to no messages consumed.

Declared In

TCHMessages.h