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 Conversation’s messages stream.
@property (nonatomic, copy, readonly, nullable) NSNumber *index
Discussion
Index of Message in the Conversation’s messages stream.
By design of the conversations 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 read horizon API. See [TCHConversation getUnreadMessagesCountWithCompletion:] 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
subject
The subject of the message.
@property (nonatomic, copy, readonly, nullable) NSString *subject
Discussion
The subject 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.
For an email the body will contain the preview for the email.
To get full email body call getEmailBodyForContentType
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
participantSid
The SID of the participant this message is sent by.
@property (nonatomic, copy, readonly, nullable) NSString *participantSid
Discussion
The SID of the participant this message is sent by.
Declared In
TCHMessage.h
participant
The participant this message is sent by.
@property (nonatomic, copy, readonly, nullable) TCHParticipant *participant
Discussion
The participant 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
aggregatedDeliveryReceipt
Aggregated delivery receipt for the message.
@property (readonly, nullable) TCHAggregatedDeliveryReceipt *aggregatedDeliveryReceipt
Discussion
Aggregated delivery receipt for the message.
Declared In
TCHMessage.h
attachedMedia
All media attachments (not including email body/history attachments).
@property (readonly, nonnull) NSArray<TCHMedia*> *attachedMedia
Discussion
All media attachments (not including email body/history attachments).
Declared In
TCHMessage.h
– getDetailedDeliveryReceiptsWithCompletion:
Get detailed delivery receipts for the message.
- (void)getDetailedDeliveryReceiptsWithCompletion:(nonnull TCHDetailedDeliveryReceiptsCompletion)completion
Parameters
completion |
Completion block that will specify the result of the operation. |
---|
Discussion
Get detailed delivery receipts for 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
– getMediaByCategories:
Return a list of media matching the specific set of categories.
- (nonnull NSArray<TCHMedia*> *)getMediaByCategories:(nonnull NSSet<NSNumber*> *)categories
Parameters
categories |
The set of categories to match. |
---|
Return Value
The list of media descriptors matching given categories.
Discussion
Return a list of media matching the specific set of categories.
Declared In
TCHMessage.h
– getEmailBody
Returns the email body attachment of the default text/plain content type.
- (nullable TCHMedia *)getEmailBody
Return Value
The email body attachment or nil if message has no email body for the requested content type.
Discussion
Returns the email body attachment of the default text/plain content type.
Declared In
TCHMessage.h
– getEmailBodyForContentType:
Returns the email body attachment of the specific content type.
- (nullable TCHMedia *)getEmailBodyForContentType:(nonnull NSString *)contentType
Parameters
contentType |
The type to match. |
---|
Return Value
The email body attachment or nil if message has no email body for the requested content type.
Discussion
Returns the email body attachment of the specific content type.
Declared In
TCHMessage.h
– getEmailHistory
Returns the email history attachment of the default text/plain content type.
- (nullable TCHMedia *)getEmailHistory
Return Value
The email history attachment or nil if message has no email history for the requested content type.
Discussion
Returns the email history attachment of the default text/plain content type.
Declared In
TCHMessage.h
– getEmailHistoryForContentType:
Returns the email history attachment of the specific content type.
- (nullable TCHMedia *)getEmailHistoryForContentType:(nonnull NSString *)contentType
Parameters
contentType |
The type to match. |
---|
Return Value
The email history attachment or nil if message has no email history for the requested content type.
Discussion
Returns the email history attachment of the specific content type.
Declared In
TCHMessage.h
– getTemporaryContentUrlsForAttachedMediaWithCompletion:
Get content URLs for all attached media using a single network request.
- (nullable TCHCancellationToken *)getTemporaryContentUrlsForAttachedMediaWithCompletion:(nonnull TCHMediaSidsCompletion)completion
Parameters
completion |
The listener to receive a map of media sids to content temporary URL. |
---|
Discussion
Get content URLs for all attached media using a single network request.
Declared In
TCHMessage.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.
NB. It is a convenience method originated in the conversations client.
Declared In
TCHMessage.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.
NB. It is a convenience method originated in the conversations client.
Declared In
TCHMessage.h