SBDBaseMessage Class Reference

Inherits from NSObject
Conforms to NSCopying
SBDMappable
Declared in SBDBaseMessage.h

Overview

The SBDBaseMessage class represents the base message which is generated by a user or an admin. The SBDUserMessage, the SBDFileMessage and the SBDAdminMessage are derived from this class.

  requestId

Request ID for checking ACK.

@property (strong, nonatomic, readonly) NSString *requestId

Declared In

SBDBaseMessage.h

  messageId

Unique message ID.

@property (atomic) long long messageId

Declared In

SBDBaseMessage.h

  message

Message text.

@property (strong, nonatomic, readonly) NSString *message

Declared In

SBDBaseMessage.h

  sendingStatus

Represents the dispatch state of the message. If message is not dispatched completely to the Sendbird server, the value is SBDMessageSendingStatusPending. If failed to send the message, the value is SBDMessageSendingStatusFailed. And if success to send the message, the value is SBDMessageSendingStatusSucceeded.

@property (assign, nonatomic, readonly) SBDMessageSendingStatus sendingStatus

Availability

3.0.173

Declared In

SBDBaseMessage.h

  sender

Sender of the message. This is represented by SBDSender class.

@property (strong, nonatomic, nullable) SBDSender *sender

Declared In

SBDBaseMessage.h

  channelUrl

Channel URL which has this message.

@property (strong, nonatomic) NSString *channelUrl

Declared In

SBDBaseMessage.h

  channelType

Channel type of this message.

@property (strong, nonatomic) NSString *channelType

Declared In

SBDBaseMessage.h

  mentionedUsers

The list of users who was mentioned together with the message.

@property (strong, nonatomic, readonly) NSArray<SBDUser*> *mentionedUsers

Availability

3.0.90

Declared In

SBDBaseMessage.h

  mentionType

3.0.103

@property (atomic, readonly) SBDMentionType mentionType

Availability

3.0.103

Declared In

SBDBaseMessage.h

  requestedMentionUserIds

Represents target user ids to mention when success to send the message. This value is valid only when the message is a pending message or failed message. If the message is a succeeded message, see mentionedUserIds

@property (strong, nonatomic, readonly) NSArray<NSString*> *requestedMentionUserIds

Availability

3.0.147

See Also

Declared In

SBDBaseMessage.h

  createdAt

Message created time in millisecond(UTC).

@property (atomic) long long createdAt

Declared In

SBDBaseMessage.h

  updatedAt

Message updated time in millisecond(UTC).

@property (atomic) long long updatedAt

Declared In

SBDBaseMessage.h

  parentMessageId

The unique ID of the parent message. If the message object is a parent message or a single message without any reply, the value of this property is 0. If the object is a reply, the value is the unique ID of its parent message.

@property (atomic, readonly) long long parentMessageId

Availability

3.0.181

Discussion

Note: The default value is 0.

Declared In

SBDBaseMessage.h

  parentMessageText

The written text of the message object’s parent message. If the message object is a parent message, the value of this property is nil. If the object is a reply to a parent message and the type of the parent message is SBDUserMessage, the value is message. If it is SBDFileMessage, the value is the name of the uploaded file. (Deprecated: 3.0.236 (Use parentMessageInfo instead.))

@property (strong, readonly, nullable) NSString *parentMessageText

Availability

3.0.181

Declared In

SBDBaseMessage.h

  threadInfo

The thread info that belongs to this message object.

@property (strong, readonly) SBDThreadInfo *threadInfo

Availability

3.0.181

Declared In

SBDBaseMessage.h

  metaArray

d 3.0.148. (Use metaArrays instead.) (Deprecated: 3.0.148. (Use metaArrays instead.))

@property (nonatomic, readonly, getter=getAllMetaArray) NSDictionary<NSString*NSArray<NSString*> *> *metaArray

Availability

3.0.116

Declared In

SBDBaseMessage.h

  metaArrays

3.0.148

@property (strong, nonatomic, readonly, nullable) NSArray<SBDMessageMetaArray*> *metaArrays

Availability

3.0.148

Declared In

SBDBaseMessage.h

  data

The custom data for message.

@property (strong, nonatomic, readonly) NSString *data

Declared In

SBDBaseMessage.h

  customType

Custom message type.

@property (strong, nonatomic, readonly, nullable) NSString *customType

Declared In

SBDBaseMessage.h

  reactions

@property (strong, nonatomic, readonly, getter=getReactions) NSArray<SBDReaction*> *reactions

  messageSurvivalSeconds

@property (atomic, readonly) NSInteger messageSurvivalSeconds

  silent

Whether the message is silent or not

@property (atomic, readonly, getter=isSilent) BOOL silent

Availability

3.0.184

Discussion

Note: If the message is silent, last message won’t be changed and channelWasChanged: will not get called on receiver’s sidel

Declared In

SBDBaseMessage.h

  errorCode

The error code of file. This value generated only when message send fails.

@property (assign, nonatomic, readonly) NSUInteger errorCode

Availability

3.0.161

Declared In

SBDBaseMessage.h

  ogMetaData

Optional open graph information if the message contains links. We only support first open graph tag appearance on the first link

@property (nonatomic, strong, readonly, nullable) SBDOGMetaData *ogMetaData

Availability

3.0.193

Declared In

SBDBaseMessage.h

  plugins

List of plugin that are corresponding to this message

@property (nonatomic, strong, readonly, nullable) NSArray<SBDPlugin*> *plugins

Availability

3.0.207

Declared In

SBDBaseMessage.h

  isOperatorMessage

Represents whether this message was created by an operator.

@property (atomic, readonly) BOOL isOperatorMessage

Availability

3.0.198

Declared In

SBDBaseMessage.h

  messageParams

An object that was used to resend this message. This property is valid when the sendingStatus is SBDMessageSendingStatusPending or SBDMessageSendingStatusFailed. When this message is trying to be resent, this property will be used as well. If the message object is SBDUserMessage class, then the messageParams has to be casted to SBDUserMessageParams class. If the message object is SBDFileMessage class, then the messageParams has to be casted to SBDFileMessageParams class.

@property (strong, nonatomic, nullable) SBDBaseMessageParams *messageParams

Availability

3.1.0

Declared In

SBDBaseMessage.h

  parentMessage

Current message’s parent message object. When parentMessage is SBDUserMessage it only has 3 properties: - NSString message - SBDSender sender - long long createdAt When parentMessage is SBDAdminMessage it only has 3 properties: - NSString message - SBDSender sender - long long createdAt When parentMessage is SBDFileMessage it only has 6 properties: - NSString message - SBDSender sender - long long createdAt - NSString name - NSString url - NSString type

@property (atomic, nullable) SBDBaseMessage *parentMessage

Availability

3.0.236

Declared In

SBDBaseMessage.h

  isReplyToChannel

Determines whether current message is also shown on channel.

@property (atomic) BOOL isReplyToChannel

Availability

3.0.236

Declared In

SBDBaseMessage.h

  mentionedMessageTemplate

The template for the message that has the mentioned users.

@property (strong, readonly, nullable) NSString *mentionedMessageTemplate

Availability

3.1.11

Declared In

SBDBaseMessage.h

– isOpenChannel

Returns YES, when this is open channel.

- (BOOL)isOpenChannel

Return Value

Returns YES, when this is open channel.

Declared In

SBDBaseMessage.h

– isGroupChannel

Returns YES, when this is group channel.

- (BOOL)isGroupChannel

Return Value

Returns YES, when this is group channel.

Declared In

SBDBaseMessage.h

– isResendable

If YES, this message can resend.

- (BOOL)isResendable

Return Value

If YES, this message can resend.

Availability

3.0.161

Declared In

SBDBaseMessage.h

+ buildFromSerializedData:

Serialized data.

+ (nullable instancetype)buildFromSerializedData:(NSData *_Nonnull)data

Parameters

data

Serialized data.

Return Value

SBDBaseMessage object.

Declared In

SBDBaseMessage.h

+ buildFromSerializedData:desiredState:

Serialized data.

+ (nullable instancetype)buildFromSerializedData:(NSData *_Nonnull)data desiredState:(SBDMessageSendingStatus)desiredState

Parameters

data

Serialized data.

desiredState

The sending status that a message object will have.

Return Value

SBDBaseMessage object.

Availability

3.0.203

Declared In

SBDBaseMessage.h

– serialize

Serialized data.

- (nullable NSData *)serialize

Return Value

Serialized data.

Declared In

SBDBaseMessage.h

– getMetaArrayWithKeys:

d 3.0.148 (Deprecated: 3.0.148)

- (NSDictionary<NSString*,NSArray<NSString*> *> *)getMetaArrayWithKeys:(NSArray<NSString*> *_Nonnull)keys

Parameters

keys

Keys of the meta array.

Return Value

Meta array of the keys.

Availability

3.0.116

Declared In

SBDBaseMessage.h

– metaArraysWithKeys:

@code NSArray keys = meta_array_keys; NSArraySBDMessageMetaArray > *subMetaArrays = [message metaArraysWithKeys:keys]; @endcode

- (NSArray<SBDMessageMetaArray*> *)metaArraysWithKeys:(nonnull NSArray<NSString*> *)keys

Declared In

SBDBaseMessage.h

– applyReactionEvent:

- (BOOL)applyReactionEvent:(nonnull SBDReactionEvent *)reactionEvent

+ getMessageWithParams:completionHandler:

Retrieves a message with a specified message ID.

+ (void)getMessageWithParams:(nonnull SBDMessageRetrievalParams *)params completionHandler:(nullable void ( ^ ) ( SBDBaseMessage *_Nullable message , SBDError *_Nullable error ))completionHandler

Parameters

params

Contains a set of parameters you can set regarding the messages in the results.

completionHandler

The handler block to be executed. The message retrieves the message with the matching message ID. A value of nil indicates that there is no message with the specified message ID. The error Indicates whether there is an error. If there is no error, the value is nil.

Availability

3.0.181

Declared In

SBDBaseMessage.h

– getThreadedMessagesByTimestamp:params:completionHandler:

Retrieves the threaded replies of the current message depending on the timestamp. If the current message doesn’t have replies, the result is nil.

- (void)getThreadedMessagesByTimestamp:(long long)timestamp params:(nonnull SBDThreadedMessageListParams *)params completionHandler:(nullable void ( ^ ) ( SBDBaseMessage *_Nullable parentMessage , NSArray<SBDBaseMessage*> *_Nullable threadedReplies , SBDError *_Nullable error ))completionHandler

Parameters

timestamp

Specifies the timestamp to be the reference point of the retrieval, in Unix milliseconds format.

params

Contains a set of parameters you can set regarding the messages in the results.

completionHandler

The handler block to be executed. The parentMessage retrieves the parent message of the thread. The threadedReplies retrieves the threaded replies in the thread. The error indicates whether there is an error. If there is no error, the value is nil.

Availability

3.0.181

Declared In

SBDBaseMessage.h

– applyThreadInfoUpdateEvent:

Applies the update of the thread information to the message object. This method has to be called when the channel:didUpdateThreadInfo: event returns the SBDThreadInfoUpdateEvent object.

- (BOOL)applyThreadInfoUpdateEvent:(nonnull SBDThreadInfoUpdateEvent *)threadInfoUpdateEvent

Parameters

threadInfoUpdateEvent

The event object that is applied to.

Return Value

Returns If the threadInfoUpdateEvent parameter is nil or the targetMessageId included in the parameter doesn’t match any message, this method returns NO.

Availability

3.0.181

Declared In

SBDBaseMessage.h

– applyParentMessage:

Applies the message to the current message object as a parent message. If the parentMessageId is different with the message ID of the parentMessage, then NO will be returned.

- (BOOL)applyParentMessage:(nonnull SBDBaseMessage *)parentMessage

Parameters

parentMessage

The parent message object to be updated.

Availability

3.1.3

Declared In

SBDBaseMessage.h