TCHMessage Class Reference
Inherits from | NSObject |
---|---|
Declared in | TCHMessage.h |
sid
The unique identifier for this message.
@property (nonatomic, copy, readonly, nullable) NSString *sid
Discussion
The unique identifier for this message.
Declared In
TCHMessage.h
index
Index of Message in the Channel’s messages stream.
@property (nonatomic, copy, readonly, nullable) NSNumber *index
Discussion
Index of Message in the Channel’s messages stream.
By design of the chat system the message indices may have arbitrary gaps between them, that does not necessarily mean they were deleted or otherwise modified - just that messages may have non-contiguous indices even if they are sent immediately one after another.
Trying to use indices for some calculations is going to be unreliable.
To calculate the number of unread messages it is better to use the consumption horizon API. See [TCHChannel getUnconsumedMessagesCountWithCompletion:] for details.
Declared In
TCHMessage.h
author
The identity of the author of the message.
@property (nonatomic, copy, readonly, nullable) NSString *author
Discussion
The identity of the author of the message.
Declared In
TCHMessage.h
body
The body of the message.
@property (nonatomic, copy, readonly, nullable) NSString *body
Discussion
The body of the message.
Declared In
TCHMessage.h
messageType
The type of the message.
@property (nonatomic, assign, readonly) TCHMessageType messageType
Discussion
The type of the message.
Declared In
TCHMessage.h
mediaSize
The size of the attached media if present, otherwise 0.
@property (nonatomic, assign, readonly) NSUInteger mediaSize
Discussion
The size of the attached media if present, otherwise 0.
Declared In
TCHMessage.h
mediaType
The mime type of the attached media if present and specified at creation, otherwise nil.
@property (nonatomic, copy, readonly, nullable) NSString *mediaType
Discussion
The mime type of the attached media if present and specified at creation, otherwise nil.
Declared In
TCHMessage.h
mediaFilename
The suggested filename the attached media if present and specified at creation, otherwise nil.
@property (nonatomic, copy, readonly, nullable) NSString *mediaFilename
Discussion
The suggested filename the attached media if present and specified at creation, otherwise nil.
Declared In
TCHMessage.h
member
The member this message is sent by.
@property (nonatomic, copy, readonly, nullable) TCHMember *member
Discussion
The member this message is sent by.
Declared In
TCHMessage.h
dateCreated
The message creation date.
@property (nonatomic, copy, readonly, nullable) NSString *dateCreated
Discussion
The message creation date.
Declared In
TCHMessage.h
dateCreatedAsDate
The message creation date as an NSDate.
@property (nonatomic, strong, readonly, nullable) NSDate *dateCreatedAsDate
Discussion
The message creation date as an NSDate.
Declared In
TCHMessage.h
dateUpdated
The message last update date.
@property (nonatomic, copy, readonly, nullable) NSString *dateUpdated
Discussion
The message last update date.
Declared In
TCHMessage.h
dateUpdatedAsDate
The message last update date as an NSDate.
@property (nonatomic, strong, readonly, nullable) NSDate *dateUpdatedAsDate
Discussion
The message last update date as an NSDate.
Declared In
TCHMessage.h
lastUpdatedBy
The identity of the user who updated the message.
@property (nonatomic, copy, readonly, nullable) NSString *lastUpdatedBy
Discussion
The identity of the user who updated the message.
Declared In
TCHMessage.h
– updateBody:completion:
Update the body of this message
- (void)updateBody:(nonnull NSString *)body completion:(nullable TCHCompletion)completion
Parameters
body |
The new body for this message. |
---|---|
completion |
Completion block that will specify the result of the operation. |
Discussion
Update the body of this message
Declared In
TCHMessage.h
– attributes
Return this message’s attributes.
- (nullable TCHJsonAttributes *)attributes
Return Value
The developer-defined extensible attributes for this message.
Discussion
Return this message’s attributes.
Declared In
TCHMessage.h
– setAttributes:completion:
Set this message’s attributes.
- (void)setAttributes:(nullable TCHJsonAttributes *)attributes completion:(nullable TCHCompletion)completion
Parameters
attributes |
The new developer-defined extensible attributes for this message. (Supported types are NSString, NSNumber, NSArray, NSDictionary and NSNull) |
---|---|
completion |
Completion block that will specify the result of the operation. |
Discussion
Set this message’s attributes.
Declared In
TCHMessage.h
– hasMedia
Determine if the message has media content.
- (BOOL)hasMedia
Return Value
A true boolean value if this message has media, false otherwise.
Discussion
Determine if the message has media content.
Declared In
TCHMessage.h
– getMediaContentTemporaryUrlWithCompletion:
Retrieve this message’s media temporary link (if there is any media attached). This URL is impermanent, it expires in several minutes. If the link became invalid (expired), need to re-request the new one. It is user’s responsibility to timely download media data by this link.
- (void)getMediaContentTemporaryUrlWithCompletion:(nonnull TCHStringCompletion)completion
Parameters
completion |
Completion block that will specify the requested URL. If no completion block is specified, no operation will be executed. |
---|
Discussion
Retrieve this message’s media temporary link (if there is any media attached). This URL is impermanent, it expires in several minutes. If the link became invalid (expired), need to re-request the new one. It is user’s responsibility to timely download media data by this link.
Declared In
TCHMessage.h
– getMediaWithOutputStream:onStarted:onProgress:onCompleted:completion:
Retrieve this message’s attached media, if there is any. (Deprecated: See getMediaContentTemporaryUrlWithCompletion:)
- (void)getMediaWithOutputStream:(nonnull NSOutputStream *)mediaStream onStarted:(nullable TCHMediaOnStarted)onStarted onProgress:(nullable TCHMediaOnProgress)onProgress onCompleted:(nullable TCHMediaOnCompleted)onCompleted completion:(nullable TCHCompletion)completion
Parameters
mediaStream |
An instance of NSOutputStream you create that the media will be written to. |
---|---|
onStarted |
Callback block which is called when the media download starts. |
onProgress |
Callback block which is called as download progresses with the most recent number of bytes read. |
onCompleted |
Callback block which is called upon media download completion with the media’s sid if successful. |
completion |
Completion block that will specify the result of the operation. |
Discussion
Retrieve this message’s attached media, if there is any.
Declared In
TCHMessage.h