LCIMConversation

Objective-C

@interface LCIMConversation : NSObject

/**
 *  The ID of the client which the conversation belongs to.
 */
@property (nonatomic, strong, readonly, nullable) NSString *clientId;

/**
 *  The ID of the conversation.
 */
@property (nonatomic, strong, readonly, nullable) NSString *conversationId;

/**
 *  The clientId of the conversation creator.
 */
@property (nonatomic, strong, readonly, nullable) NSString *creator;

/// The creation time of the conversation.
@property (nonatomic, strong, readonly, nullable) NSDate *createdAt;

/// The last updating time of the conversation. When fields like name, members changes, this time will changes.
@property (nonatomic, strong, readonly, nullable) NSDate *updatedAt;

/**
 *  The last message in this conversation.
 *  @attention Getter method may query lastMessage from SQL, this may take a long time, be careful to use getter method in main thread.
 */
@property (nonatomic, strong, readonly, nullable) LCIMMessage *lastMessage;

/**
 *  The send timestamp of the last message in this conversation.
 */
@property (nonatomic, strong, readonly, nullable) NSDate *lastMessageAt;

/**
 *  The last timestamp your message read by other.
 */
@property (nonatomic, strong, readonly, nullable) NSDate *lastReadAt;

/**
 *  The last timestamp your message delivered to other.
 */
@property (nonatomic, strong, readonly, nullable) NSDate *lastDeliveredAt;

/**
 *  The count of unread messages in current conversation.
 */
@property (nonatomic, assign, readonly) NSUInteger unreadMessagesCount;

/**
 *  A flag indicates whether an unread message mentioned you.
 */
@property (nonatomic, assign) BOOL unreadMessagesMentioned;

/**
 *  The name of this conversation. Can be changed by update:callback: .
 */
@property (nonatomic, strong, readonly, nullable) NSString *name;

/**
 *  The ids of the clients who join the conversation. Can be changed by addMembersWithClientIds:callback: or removeMembersWithClientIds:callback: .
 */
@property (nonatomic, strong, readonly, nullable) NSArray<NSString *> *members;

/**
 *  The attributes of the conversation. Intend to save any extra data of the conversation.
 *  Can be set when creating the conversation or can be updated by update:callback: .
 */
@property (nonatomic, strong, readonly, nullable) NSDictionary *attributes;

/**
 Unique ID of Unique Conversation.
 */
@property (nonatomic, strong, readonly, nullable) NSString *uniqueId;

/**
 Indicate whether it is a unique conversation.
 */
@property (nonatomic, assign, readonly) BOOL unique;

/**
 *  Indicate whether it is a transient conversation. 
 *  @see LCIMConversationOptionTransient
 */
@property (nonatomic, assign, readonly) BOOL transient;

/**
 Indicate whether it is a system conversation.
 */
@property (nonatomic, assign, readonly) BOOL system;

/**
 Indicate whether it is a temporary conversation.
 */
@property (nonatomic, assign, readonly) BOOL temporary;

/**
 Temporary Conversation's Time to Live.
 */
@property (nonatomic, assign, readonly) NSUInteger temporaryTTL;

/**
 *  Muting status. If muted, when you have offline messages, will not receive Apple APNS notification.
 *  Can be changed by muteWithCallback: or unmuteWithCallback:.
 */
@property (nonatomic, assign, readonly) BOOL muted;

/**
 *  The LCIMClient object which this conversation belongs to.
 */
@property (nonatomic, weak, readonly, nullable) LCIMClient *imClient;

+ (instancetype)new NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;

/**
 * Add custom property for conversation.
 *
 * @param object The property value.
 * @param key    The property name.
 */
- (void)setObject:(id _Nullable)object forKey:(NSString *)key;

/**
 * Support to use subscript to set custom property.
 *
 * @see -[LCIMConversation setObject:forKey:]
 */
- (void)setObject:(id _Nullable)object forKeyedSubscript:(NSString *)key;

/*!
 * Get custom property value for conversation.
 *
 * @param key The custom property name.
 *
 * @return The custom property value.
 */
- (id _Nullable)objectForKey:(NSString *)key;

/**
 * Support to use subscript to set custom property.
 *
 * @see -[LCIMConversation objectForKey:]
 */
- (id _Nullable)objectForKeyedSubscript:(NSString *)key;

/*!
 Creates an LCIMKeyedConversation object for serialization.
 @return LCIMKeyedConversation object.
 */
- (LCIMKeyedConversation * _Nullable)keyedConversation;

// MARK: - RCP Timestamps & Read

/*!
 Fetches last receipt timestamps of the message.
 */
- (void)fetchReceiptTimestampsInBackground;

/*!
 Marks the latest message sent by other members as read.
 The message sender will receives a read notification.
 */
- (void)readInBackground;

// MARK: - Conversation Update

/*!
 Fetches latest data from the cloud.
 @param callback - A callback on results.
 */
- (void)fetchWithCallback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;

/*!
 Sends updates to the cloud.
 @param callback - A callback on results.
 */
- (void)updateWithCallback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;

// MARK: - Conversation Mute

/*!
 Turns off the offline notifications of this conversation.
 @param callback - A callback on results.
 */
- (void)muteWithCallback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;

/*!
 Turns on the offline notifications of this conversation. 
 @param callback - A callback on results.
 */
- (void)unmuteWithCallback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;

// MARK: - Members

/*!
 Joins this conversation.
 @param callback - A callback on results. 
 */
- (void)joinWithCallback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;

/*!
 Quits from this conversation.
 @param callback - A callback on results.
 */
- (void)quitWithCallback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;

/*!
 Adds members to this conversation.
 @param clientIds - Member list.
 @param callback - A callback on results.
 */
- (void)addMembersWithClientIds:(NSArray<NSString *> *)clientIds
                       callback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;

/*!
 Removes members from this conversation.
 @param clientIds - Member list.
 @param callback - A callback on results. 
 */
- (void)removeMembersWithClientIds:(NSArray<NSString *> *)clientIds
                          callback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;

/*!
 Counts the members of this conversation.
 @param callback - A callback on results.
 */
- (void)countMembersWithCallback:(void (^)(NSInteger count, NSError * _Nullable error))callback;

// MARK: - Message Send

/*!
 Sends a message to this conversation.
 @param message - The message to send.
 @param callback - A callback on results.
 */
- (void)sendMessage:(LCIMMessage *)message
           callback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;

/*!
 Sends a message to this conversation. 
 @param message - The message to send.
 @param option - Message sending options.
 @param callback - A callback on results.
 */
- (void)sendMessage:(LCIMMessage *)message
             option:(LCIMMessageOption * _Nullable)option
           callback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;

/*!
 Sends a message to this conversation.
 @param message - The message to send. 
 @param progressBlock - A callback on uploading progress. This is only applicable to uploading files. This callback will not be invoked when sending a text message.
 @param callback - A callback on results.
 */
- (void)sendMessage:(LCIMMessage *)message
      progressBlock:(void (^ _Nullable)(NSInteger progress))progressBlock
           callback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;

/*!
 Sends a message to this conversation. 
 @param message - The message to send. 
 @param option - Message sending options. 
 @param progressBlock - A callback on uploading progress. This is only applicable to uploading files. This callback will not be invoked when sending a text message. 
 @param callback - A callback on results. 
 */
- (void)sendMessage:(LCIMMessage *)message
             option:(nullable LCIMMessageOption *)option
      progressBlock:(void (^ _Nullable)(NSInteger progress))progressBlock
           callback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;

// MARK: - Message Update

/*!
 Replace a message you sent with a new message.

 @param oldMessage The message you've sent which will be replaced by newMessage.
 @param newMessage A new message.
 @param callback   Callback of message update.
 */
- (void)updateMessage:(LCIMMessage *)oldMessage
         toNewMessage:(LCIMMessage *)newMessage
             callback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;

/*!
 Recall a message.

 @param oldMessage The message you've sent which will be replaced by newMessage.
 @param callback   Callback of message update.
 */
- (void)recallMessage:(LCIMMessage *)oldMessage
             callback:(void (^)(BOOL succeeded, NSError * _Nullable error, LCIMRecalledMessage * _Nullable recalledMessage))callback;

// MARK: - Message Cache

/*!
 Add a message to cache.

 @param message The message to be cached.
 */
- (void)addMessageToCache:(LCIMMessage *)message;

/*!
 Remove a message from cache.

 @param message The message which you want to remove from cache.
 */
- (void)removeMessageFromCache:(LCIMMessage *)message;

// MARK: - Message Query

/*!
 Queries recent messages from the cloud.
 @param limit The default is 20. The maximum is 1000.
 @param callback A callback on returned results.
 */
- (void)queryMessagesFromServerWithLimit:(NSUInteger)limit
                                callback:(void (^)(NSArray<LCIMMessage *> * _Nullable messages, NSError * _Nullable error))callback;

/*!
 Queries recent messages from the cache. 
 @param limit The default is 20. The maximum is 1000.
 @return An array of messages.
 */
- (NSArray *)queryMessagesFromCacheWithLimit:(NSUInteger)limit;

/*!
 Queries recent messages.
 @param limit The default is 20. The maximum is 1000.
 @param callback A callback on returned results.
 */
- (void)queryMessagesWithLimit:(NSUInteger)limit
                      callback:(void (^)(NSArray<LCIMMessage *> * _Nullable messages, NSError * _Nullable error))callback;

/*!
 Queries historical messages.
 @warning `timestamp` must equal to the timestamp of the message that messageId equal to `messageId`, if the `timestamp` and `messageId` not match, continuity of querying message can't guarantee.
 
 @param messageId Messages before this message.
 @param timestamp Messages before this timestamp.
 @param limit The default is 20. The maximum is 1000. 
 @param callback A callback on returned results.
 */
- (void)queryMessagesBeforeId:(NSString *)messageId
                    timestamp:(int64_t)timestamp
                        limit:(NSUInteger)limit
                     callback:(void (^)(NSArray<LCIMMessage *> * _Nullable messages, NSError * _Nullable error))callback;

/**
 Query messages from a message to an another message with specified direction applied.

 @param interval  A message interval.
 @param direction Direction of message query.
 @param limit     Limit of messages you want to query.
 @param callback  Callback of query request.
 */
- (void)queryMessagesInInterval:(nullable LCIMMessageInterval *)interval
                      direction:(LCIMMessageQueryDirection)direction
                          limit:(NSUInteger)limit
                       callback:(void (^)(NSArray<LCIMMessage *> * _Nullable messages, NSError * _Nullable error))callback;

/**
 Query Specific Media Type Message from Server.

 @param type Specific Media Type you want to query, see `LCIMMessageMediaType`.
 @param limit Limit of messages you want to query.
 @param messageId If set it and MessageId is Valid, the Query Result is Decending base on Timestamp and will Not Include the Message that its messageId is this parameter.
 @param timestamp Set Zero or Negative, it will query from latest Message and result include the latest Message; Set a valid timestamp, the Query Result is Decending base on Timestamp and will Not Include the Message that its timestamp is this parameter.
 @param callback Result callback.
 */
- (void)queryMediaMessagesFromServerWithType:(LCIMMessageMediaType)type
                                       limit:(NSUInteger)limit
                               fromMessageId:(NSString * _Nullable)messageId
                               fromTimestamp:(int64_t)timestamp
                                    callback:(void (^)(NSArray<LCIMMessage *> * _Nullable messages, NSError * _Nullable error))callback;

// MARK: - Member Info

/**
 Get all member info. using cache as a default.

 @param callback Result callback.
 */
- (void)getAllMemberInfoWithCallback:(void (^)(NSArray<LCIMConversationMemberInfo *> * _Nullable memberInfos, NSError * _Nullable error))callback;

/**
 Get all member info.

 @param ignoringCache Cache option.
 @param callback Result callback.
 */
- (void)getAllMemberInfoWithIgnoringCache:(BOOL)ignoringCache
                                 callback:(void (^)(NSArray<LCIMConversationMemberInfo *> * _Nullable memberInfos, NSError * _Nullable error))callback;

/**
 Get a member info by member id. using cache as a default.

 @param memberId Equal to client id.
 @param callback Result callback.
 */
- (void)getMemberInfoWithMemberId:(NSString *)memberId
                         callback:(void (^)(LCIMConversationMemberInfo * _Nullable memberInfo, NSError * _Nullable error))callback;

/**
 Get a member info by member id.

 @param ignoringCache Cache option.
 @param memberId Equal to client id.
 @param callback Result callback.
 */
- (void)getMemberInfoWithIgnoringCache:(BOOL)ignoringCache
                              memberId:(NSString *)memberId
                              callback:(void (^)(LCIMConversationMemberInfo * _Nullable memberInfo, NSError * _Nullable error))callback;

/**
 Change a member's role.

 @param memberId Equal to client id.
 @param role Changing role.
 @param callback Result callback.
 */
- (void)updateMemberRoleWithMemberId:(NSString *)memberId
                                role:(LCIMConversationMemberRole)role
                            callback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;

// MARK: - Member Block

/**
 Blocking some members in the conversation.

 @param memberIds Who will be blocked.
 @param callback Result callback.
 */
- (void)blockMembers:(NSArray<NSString *> *)memberIds
            callback:(void (^)(NSArray<NSString *> * _Nullable successfulIds, NSArray<LCIMOperationFailure *> * _Nullable failedIds, NSError * _Nullable error))callback;

/**
 Unblocking some members in the conversation.

 @param memberIds Who will be unblocked.
 @param callback Result callback.
 */
- (void)unblockMembers:(NSArray<NSString *> *)memberIds
              callback:(void (^)(NSArray<NSString *> * _Nullable successfulIds, NSArray<LCIMOperationFailure *> * _Nullable failedIds, NSError * _Nullable error))callback;

/**
 Query blocked members in the conversation.

 @param limit Count of the blocked members you want to query.
 @param next Offset, if callback's next is nil or empty, that means there is no more blocked members.
 @param callback Result callback.
 */
- (void)queryBlockedMembersWithLimit:(NSInteger)limit
                                next:(NSString * _Nullable)next
                            callback:(void (^)(NSArray<NSString *> * _Nullable blockedMemberIds, NSString * _Nullable next, NSError * _Nullable error))callback;

// MARK: - Member Mute

/**
 Muting some members in the conversation.
 
 @param memberIds Who will be muted.
 @param callback Result callback.
 */
- (void)muteMembers:(NSArray<NSString *> *)memberIds
           callback:(void (^)(NSArray<NSString *> * _Nullable successfulIds, NSArray<LCIMOperationFailure *> * _Nullable failedIds, NSError * _Nullable error))callback;

/**
 Unmuting some members in the conversation.
 
 @param memberIds Who will be unmuted.
 @param callback Result callback.
 */
- (void)unmuteMembers:(NSArray<NSString *> *)memberIds
             callback:(void (^)(NSArray<NSString *> * _Nullable successfulIds, NSArray<LCIMOperationFailure *> * _Nullable failedIds, NSError * _Nullable error))callback;

/**
 Query muted members in the conversation.
 
 @param limit Count of the muted members you want to query.
 @param next Offset, if callback's next is nil or empty, that means there is no more muted members.
 @param callback Result callback.
 */
- (void)queryMutedMembersWithLimit:(NSInteger)limit
                              next:(NSString * _Nullable)next
                          callback:(void (^)(NSArray<NSString *> * _Nullable mutedMemberIds, NSString * _Nullable next, NSError * _Nullable error))callback;

@end

Swift

class LCIMConversation : NSObject

Undocumented

  • The ID of the client which the conversation belongs to.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSString *clientId;

    Swift

    var clientId: String? { get }
  • The ID of the conversation.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSString *conversationId;

    Swift

    var conversationId: String? { get }
  • The clientId of the conversation creator.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSString *creator;

    Swift

    var creator: String? { get }
  • The creation time of the conversation.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSDate *createdAt;

    Swift

    var createdAt: Date? { get }
  • The last updating time of the conversation. When fields like name, members changes, this time will changes.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSDate *updatedAt;

    Swift

    var updatedAt: Date? { get }
  • The last message in this conversation. @attention Getter method may query lastMessage from SQL, this may take a long time, be careful to use getter method in main thread.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) LCIMMessage *lastMessage;

    Swift

    var lastMessage: LCIMMessage? { get }
  • The send timestamp of the last message in this conversation.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSDate *lastMessageAt;

    Swift

    var lastMessageAt: Date? { get }
  • The last timestamp your message read by other.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSDate *lastReadAt;

    Swift

    var lastReadAt: Date? { get }
  • The last timestamp your message delivered to other.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSDate *lastDeliveredAt;

    Swift

    var lastDeliveredAt: Date? { get }
  • The count of unread messages in current conversation.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSUInteger unreadMessagesCount;

    Swift

    var unreadMessagesCount: UInt { get }
  • A flag indicates whether an unread message mentioned you.

    Declaration

    Objective-C

    @property (nonatomic) BOOL unreadMessagesMentioned;

    Swift

    var unreadMessagesMentioned: Bool { get set }
  • The name of this conversation. Can be changed by update:callback: .

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSString *name;

    Swift

    var name: String? { get }
  • The ids of the clients who join the conversation. Can be changed by addMembersWithClientIds:callback: or removeMembersWithClientIds:callback: .

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSArray<NSString *> *members;

    Swift

    var members: [String]? { get }
  • The attributes of the conversation. Intend to save any extra data of the conversation. Can be set when creating the conversation or can be updated by update:callback: .

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSDictionary *attributes;

    Swift

    var attributes: [AnyHashable : Any]? { get }
  • Unique ID of Unique Conversation.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSString *uniqueId;

    Swift

    var uniqueId: String? { get }
  • Indicate whether it is a unique conversation.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL unique;

    Swift

    var unique: Bool { get }
  • Indicate whether it is a transient conversation.

    See

    LCIMConversationOptionTransient

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL transient;

    Swift

    var transient: Bool { get }
  • Indicate whether it is a system conversation.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL system;

    Swift

    var system: Bool { get }
  • Indicate whether it is a temporary conversation.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL temporary;

    Swift

    var temporary: Bool { get }
  • Temporary Conversation’s Time to Live.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSUInteger temporaryTTL;

    Swift

    var temporaryTTL: UInt { get }
  • Muting status. If muted, when you have offline messages, will not receive Apple APNS notification. Can be changed by muteWithCallback: or unmuteWithCallback:.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL muted;

    Swift

    var muted: Bool { get }
  • The LCIMClient object which this conversation belongs to.

    Declaration

    Objective-C

    @property (nonatomic, weak, readonly, nullable) LCIMClient *imClient;

    Swift

    weak var imClient: LCIMClient? { get }
  • Unavailable

    Undocumented

    Declaration

    Objective-C

    + (instancetype)new NS_UNAVAILABLE;
  • Unavailable

    Undocumented

    Declaration

    Objective-C

    - (instancetype)init NS_UNAVAILABLE;
  • Add custom property for conversation.

    Declaration

    Objective-C

    - (void)setObject:(id _Nullable)object forKey:(nonnull NSString *)key;

    Swift

    func setObject(_ object: Any?, forKey key: String)

    Parameters

    object

    The property value.

    key

    The property name.

  • Support to use subscript to set custom property.

    See

    -[LCIMConversation setObject:forKey:]

    Declaration

    Objective-C

    - (void)setObject:(id _Nullable)object
        forKeyedSubscript:(nonnull NSString *)key;
  • Undocumented

    Declaration

    Objective-C

    - (id _Nullable)objectForKey:(nonnull NSString *)key;

    Swift

    func object(forKey key: String) -> Any?
  • Support to use subscript to set custom property.

    See

    -[LCIMConversation objectForKey:]

    Declaration

    Objective-C

    - (id _Nullable)objectForKeyedSubscript:(nonnull NSString *)key;

    Swift

    subscript(key: String) -> Any? { get set }
  • Undocumented

    Declaration

    Objective-C

    - (LCIMKeyedConversation *_Nullable)keyedConversation;

    Swift

    func keyedConversation() -> LCIMKeyedConversation?
  • Undocumented

    Declaration

    Objective-C

    - (void)fetchReceiptTimestampsInBackground;

    Swift

    func fetchReceiptTimestampsInBackground()
  • Undocumented

    Declaration

    Objective-C

    - (void)readInBackground;

    Swift

    func readInBackground()
  • Undocumented

    Declaration

    Objective-C

    - (void)fetchWithCallback:(nonnull void (^)(BOOL, NSError *_Nullable))callback;

    Swift

    func fetch(callback: @escaping (Bool, Error?) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)updateWithCallback:(nonnull void (^)(BOOL, NSError *_Nullable))callback;

    Swift

    func update(callback: @escaping (Bool, Error?) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)muteWithCallback:(nonnull void (^)(BOOL, NSError *_Nullable))callback;

    Swift

    func mute(callback: @escaping (Bool, Error?) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)unmuteWithCallback:(nonnull void (^)(BOOL, NSError *_Nullable))callback;

    Swift

    func unmute(callback: @escaping (Bool, Error?) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)joinWithCallback:(nonnull void (^)(BOOL, NSError *_Nullable))callback;

    Swift

    func join(callback: @escaping (Bool, Error?) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)quitWithCallback:(nonnull void (^)(BOOL, NSError *_Nullable))callback;

    Swift

    func quit(callback: @escaping (Bool, Error?) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)addMembersWithClientIds:(nonnull NSArray<NSString *> *)clientIds
                           callback:
                               (nonnull void (^)(BOOL, NSError *_Nullable))callback;

    Swift

    func addMembers(withClientIds clientIds: [String], callback: @escaping (Bool, Error?) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)removeMembersWithClientIds:(nonnull NSArray<NSString *> *)clientIds
                              callback:(nonnull void (^)(BOOL, NSError *_Nullable))
                                           callback;

    Swift

    func removeMembers(withClientIds clientIds: [String], callback: @escaping (Bool, Error?) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)countMembersWithCallback:(nonnull void (^)(NSInteger,
                                                       NSError *_Nullable))callback;

    Swift

    func countMembers(callback: @escaping (Int, Error?) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)sendMessage:(nonnull LCIMMessage *)message
               callback:(nonnull void (^)(BOOL, NSError *_Nullable))callback;

    Swift

    func send(_ message: LCIMMessage, callback: @escaping (Bool, Error?) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)sendMessage:(nonnull LCIMMessage *)message
                 option:(LCIMMessageOption *_Nullable)option
               callback:(nonnull void (^)(BOOL, NSError *_Nullable))callback;

    Swift

    func send(_ message: LCIMMessage, option: LCIMMessageOption?, callback: @escaping (Bool, Error?) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)sendMessage:(nonnull LCIMMessage *)message
          progressBlock:(void (^_Nullable)(NSInteger))progressBlock
               callback:(nonnull void (^)(BOOL, NSError *_Nullable))callback;

    Swift

    func send(_ message: LCIMMessage, progressBlock: ((Int) -> Void)?, callback: @escaping (Bool, Error?) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)sendMessage:(nonnull LCIMMessage *)message
                 option:(nullable LCIMMessageOption *)option
          progressBlock:(void (^_Nullable)(NSInteger))progressBlock
               callback:(nonnull void (^)(BOOL, NSError *_Nullable))callback;

    Swift

    func send(_ message: LCIMMessage, option: LCIMMessageOption?, progressBlock: ((Int) -> Void)?, callback: @escaping (Bool, Error?) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)updateMessage:(nonnull LCIMMessage *)oldMessage
             toNewMessage:(nonnull LCIMMessage *)newMessage
                 callback:(nonnull void (^)(BOOL, NSError *_Nullable))callback;

    Swift

    func update(_ oldMessage: LCIMMessage, toNewMessage newMessage: LCIMMessage, callback: @escaping (Bool, Error?) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)recallMessage:(nonnull LCIMMessage *)oldMessage
                 callback:
                     (nonnull void (^)(BOOL, NSError *_Nullable,
                                       LCIMRecalledMessage *_Nullable))callback;

    Swift

    func recall(_ oldMessage: LCIMMessage, callback: @escaping (Bool, Error?, LCIMRecalledMessage?) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)addMessageToCache:(nonnull LCIMMessage *)message;

    Swift

    func addMessage(toCache message: LCIMMessage)
  • Undocumented

    Declaration

    Objective-C

    - (void)removeMessageFromCache:(nonnull LCIMMessage *)message;

    Swift

    func removeMessage(fromCache message: LCIMMessage)
  • Undocumented

    Declaration

    Objective-C

    - (void)queryMessagesFromServerWithLimit:(NSUInteger)limit
                                    callback:(nonnull void (^)(
                                                 NSArray<LCIMMessage *> *_Nullable,
                                                 NSError *_Nullable))callback;

    Swift

    func queryMessagesFromServer(withLimit limit: UInt, callback: @escaping ([LCIMMessage]?, Error?) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (nonnull NSArray *)queryMessagesFromCacheWithLimit:(NSUInteger)limit;

    Swift

    func queryMessagesFromCache(withLimit limit: UInt) -> [Any]
  • Undocumented

    Declaration

    Objective-C

    - (void)queryMessagesWithLimit:(NSUInteger)limit
                          callback:
                              (nonnull void (^)(NSArray<LCIMMessage *> *_Nullable,
                                                NSError *_Nullable))callback;

    Swift

    func queryMessages(withLimit limit: UInt, callback: @escaping ([LCIMMessage]?, Error?) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)queryMessagesBeforeId:(nonnull NSString *)messageId
                        timestamp:(int64_t)timestamp
                            limit:(NSUInteger)limit
                         callback:
                             (nonnull void (^)(NSArray<LCIMMessage *> *_Nullable,
                                               NSError *_Nullable))callback;

    Swift

    func queryMessages(beforeId messageId: String, timestamp: Int64, limit: UInt, callback: @escaping ([LCIMMessage]?, Error?) -> Void)
  • Query messages from a message to an another message with specified direction applied.

    Declaration

    Objective-C

    - (void)queryMessagesInInterval:(nullable LCIMMessageInterval *)interval
                          direction:(LCIMMessageQueryDirection)direction
                              limit:(NSUInteger)limit
                           callback:
                               (nonnull void (^)(NSArray<LCIMMessage *> *_Nullable,
                                                 NSError *_Nullable))callback;

    Swift

    func queryMessages(in interval: LCIMMessageInterval?, direction: LCIMMessageQueryDirection, limit: UInt, callback: @escaping ([LCIMMessage]?, Error?) -> Void)

    Parameters

    interval

    A message interval.

    direction

    Direction of message query.

    limit

    Limit of messages you want to query.

    callback

    Callback of query request.

  • Query Specific Media Type Message from Server.

    Declaration

    Objective-C

    - (void)queryMediaMessagesFromServerWithType:(LCIMMessageMediaType)type
                                           limit:(NSUInteger)limit
                                   fromMessageId:(NSString *_Nullable)messageId
                                   fromTimestamp:(int64_t)timestamp
                                        callback:
                                            (nonnull void (^)(
                                                NSArray<LCIMMessage *> *_Nullable,
                                                NSError *_Nullable))callback;

    Swift

    func queryMediaMessagesFromServer(withType type: LCIMMessageMediaType, limit: UInt, fromMessageId messageId: String?, fromTimestamp timestamp: Int64, callback: @escaping ([LCIMMessage]?, Error?) -> Void)

    Parameters

    type

    Specific Media Type you want to query, see LCIMMessageMediaType.

    limit

    Limit of messages you want to query.

    messageId

    If set it and MessageId is Valid, the Query Result is Decending base on Timestamp and will Not Include the Message that its messageId is this parameter.

    timestamp

    Set Zero or Negative, it will query from latest Message and result include the latest Message; Set a valid timestamp, the Query Result is Decending base on Timestamp and will Not Include the Message that its timestamp is this parameter.

    callback

    Result callback.

  • Get all member info. using cache as a default.

    Declaration

    Objective-C

    - (void)getAllMemberInfoWithCallback:
        (nonnull void (^)(NSArray<LCIMConversationMemberInfo *> *_Nullable,
                          NSError *_Nullable))callback;

    Swift

    func getAllMemberInfo(callback: @escaping ([LCIMConversationMemberInfo]?, Error?) -> Void)

    Parameters

    callback

    Result callback.

  • Get all member info.

    Declaration

    Objective-C

    - (void)getAllMemberInfoWithIgnoringCache:(BOOL)ignoringCache
                                     callback:
                                         (nonnull void (^)(
                                             NSArray<LCIMConversationMemberInfo *>
                                                 *_Nullable,
                                             NSError *_Nullable))callback;

    Swift

    func getAllMemberInfo(withIgnoringCache ignoringCache: Bool, callback: @escaping ([LCIMConversationMemberInfo]?, Error?) -> Void)

    Parameters

    ignoringCache

    Cache option.

    callback

    Result callback.

  • Get a member info by member id. using cache as a default.

    Declaration

    Objective-C

    - (void)getMemberInfoWithMemberId:(nonnull NSString *)memberId
                             callback:(nonnull void (^)(
                                          LCIMConversationMemberInfo *_Nullable,
                                          NSError *_Nullable))callback;

    Swift

    func getMemberInfo(withMemberId memberId: String, callback: @escaping (LCIMConversationMemberInfo?, Error?) -> Void)

    Parameters

    memberId

    Equal to client id.

    callback

    Result callback.

  • Get a member info by member id.

    Declaration

    Objective-C

    - (void)getMemberInfoWithIgnoringCache:(BOOL)ignoringCache
                                  memberId:(nonnull NSString *)memberId
                                  callback:
                                      (nonnull void (^)(
                                          LCIMConversationMemberInfo *_Nullable,
                                          NSError *_Nullable))callback;

    Swift

    func getMemberInfo(withIgnoringCache ignoringCache: Bool, memberId: String, callback: @escaping (LCIMConversationMemberInfo?, Error?) -> Void)

    Parameters

    ignoringCache

    Cache option.

    memberId

    Equal to client id.

    callback

    Result callback.

  • Change a member’s role.

    Declaration

    Objective-C

    - (void)updateMemberRoleWithMemberId:(nonnull NSString *)memberId
                                    role:(LCIMConversationMemberRole)role
                                callback:
                                    (nonnull void (^)(BOOL,
                                                      NSError *_Nullable))callback;

    Swift

    func updateMemberRole(withMemberId memberId: String, role: LCIMConversationMemberRole, callback: @escaping (Bool, Error?) -> Void)

    Parameters

    memberId

    Equal to client id.

    role

    Changing role.

    callback

    Result callback.

  • Blocking some members in the conversation.

    Declaration

    Objective-C

    - (void)blockMembers:(nonnull NSArray<NSString *> *)memberIds
                callback:
                    (nonnull void (^)(NSArray<NSString *> *_Nullable,
                                      NSArray<LCIMOperationFailure *> *_Nullable,
                                      NSError *_Nullable))callback;

    Swift

    func blockMembers(_ memberIds: [String], callback: @escaping ([String]?, [LCIMOperationFailure]?, Error?) -> Void)

    Parameters

    memberIds

    Who will be blocked.

    callback

    Result callback.

  • Unblocking some members in the conversation.

    Declaration

    Objective-C

    - (void)unblockMembers:(nonnull NSArray<NSString *> *)memberIds
                  callback:
                      (nonnull void (^)(NSArray<NSString *> *_Nullable,
                                        NSArray<LCIMOperationFailure *> *_Nullable,
                                        NSError *_Nullable))callback;

    Swift

    func unblockMembers(_ memberIds: [String], callback: @escaping ([String]?, [LCIMOperationFailure]?, Error?) -> Void)

    Parameters

    memberIds

    Who will be unblocked.

    callback

    Result callback.

  • Query blocked members in the conversation.

    Declaration

    Objective-C

    - (void)queryBlockedMembersWithLimit:(NSInteger)limit
                                    next:(NSString *_Nullable)next
                                callback:(nonnull void (^)(
                                             NSArray<NSString *> *_Nullable,
                                             NSString *_Nullable,
                                             NSError *_Nullable))callback;

    Swift

    func queryBlockedMembers(withLimit limit: Int, next: String?, callback: @escaping ([String]?, String?, Error?) -> Void)

    Parameters

    limit

    Count of the blocked members you want to query.

    next

    Offset, if callback’s next is nil or empty, that means there is no more blocked members.

    callback

    Result callback.

  • Muting some members in the conversation.

    Declaration

    Objective-C

    - (void)muteMembers:(nonnull NSArray<NSString *> *)memberIds
               callback:
                   (nonnull void (^)(NSArray<NSString *> *_Nullable,
                                     NSArray<LCIMOperationFailure *> *_Nullable,
                                     NSError *_Nullable))callback;

    Swift

    func muteMembers(_ memberIds: [String], callback: @escaping ([String]?, [LCIMOperationFailure]?, Error?) -> Void)

    Parameters

    memberIds

    Who will be muted.

    callback

    Result callback.

  • Unmuting some members in the conversation.

    Declaration

    Objective-C

    - (void)unmuteMembers:(nonnull NSArray<NSString *> *)memberIds
                 callback:
                     (nonnull void (^)(NSArray<NSString *> *_Nullable,
                                       NSArray<LCIMOperationFailure *> *_Nullable,
                                       NSError *_Nullable))callback;

    Swift

    func unmuteMembers(_ memberIds: [String], callback: @escaping ([String]?, [LCIMOperationFailure]?, Error?) -> Void)

    Parameters

    memberIds

    Who will be unmuted.

    callback

    Result callback.

  • Query muted members in the conversation.

    Declaration

    Objective-C

    - (void)queryMutedMembersWithLimit:(NSInteger)limit
                                  next:(NSString *_Nullable)next
                              callback:
                                  (nonnull void (^)(NSArray<NSString *> *_Nullable,
                                                    NSString *_Nullable,
                                                    NSError *_Nullable))callback;

    Swift

    func queryMutedMembers(withLimit limit: Int, next: String?, callback: @escaping ([String]?, String?, Error?) -> Void)

    Parameters

    limit

    Count of the muted members you want to query.

    next

    Offset, if callback’s next is nil or empty, that means there is no more muted members.

    callback

    Result callback.