TWMMessages Class Reference

Inherits from NSObject
Declared in TWMMessages.h

Overview

Representation of an IP Messaging channel’s message list.

  lastConsumedMessageIndex

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

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

Discussion

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

Declared In

TWMMessages.h

– createMessageWithBody:

Creates a place-holder message which can be populated and sent with sendMessage:completion:

- (TWMMessage *)createMessageWithBody:(NSString *)body

Parameters

body

Body for new message.

Return Value

Place-holder TWMMessage instance

Discussion

Creates a place-holder message which can be populated and sent with sendMessage:completion:

Declared In

TWMMessages.h

– sendMessage:completion:

Sends a message to the channel.

- (void)sendMessage:(TWMMessage *)message completion:(TWMCompletion)completion

Parameters

message

The message to send.

completion

Completion block that will specify the result of the operation.

Discussion

Sends a message to the channel.

Declared In

TWMMessages.h

– removeMessage:completion:

Removes the specified message from the channel.

- (void)removeMessage:(TWMMessage *)message completion:(TWMCompletion)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

TWMMessages.h

– allObjects

Returns messages received so far from backend, messages are loaded asynchronously so this may not fully represent all history available for channel. (Deprecated: Please use the get messages methods below instead.)

- (NSArray<TWMMessage*> *)allObjects

Return Value

Messages received by IP Messaging Client so far for the given channel.

Discussion

Returns messages received so far from backend, messages are loaded asynchronously so this may not fully represent all history available for channel.

Declared In

TWMMessages.h

– getLastMessagesWithCount:completion:

Fetches the most recent 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:(TWMMessagesCompletion)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.

Discussion

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

Declared In

TWMMessages.h

– getMessagesBefore:withCount:completion:

Fetches at most messages including and prior to the specified . 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:(TWMMessagesCompletion)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.

Discussion

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

Declared In

TWMMessages.h

– getMessagesAfter:withCount:completion:

Fetches at most messages inclulding and subsequent to the specified . 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:(TWMMessagesCompletion)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.

Discussion

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

Declared In

TWMMessages.h

– messageWithIndex:

Returns the message with the specified index.

- (TWMMessage *)messageWithIndex:(NSNumber *)index

Parameters

index

The index of the message.

Return Value

The requested message or nil if no such message exists.

Discussion

Returns the message with the specified index.

Declared In

TWMMessages.h

– messageForConsumptionIndex:

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.

- (TWMMessage *)messageForConsumptionIndex:(NSNumber *)index

Parameters

index

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

Return Value

Message at or prior to the specified index.

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

TWMMessages.h

– setLastConsumedMessageIndex:

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

- (void)setLastConsumedMessageIndex:(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

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

- (void)advanceLastConsumedMessageIndex:(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

TWMMessages.h

– setAllMessagesConsumed

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

- (void)setAllMessagesConsumed

Discussion

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

Declared In

TWMMessages.h