IMConversation
public class IMConversation
IM Conversation
-
Undocumented
Declaration
Swift
public typealias RawData = [String : Any]
-
The client which this conversation belong to.
Declaration
Swift
public private(set) weak var client: IMClient? { get } -
The ID of the conversation.
Declaration
Swift
public let ID: String -
The ID of the client.
Declaration
Swift
public let clientID: IMClient.Identifier -
Indicates whether the conversation is unique.
Declaration
Swift
public let isUnique: Bool -
The unique ID of the unique conversation.
Declaration
Swift
public let uniqueID: String? -
The name of the conversation.
Declaration
Swift
public var name: String? { get } -
The creator of the conversation.
Declaration
Swift
public var creator: String? { get } -
The creation date of the conversation.
Declaration
Swift
public var createdAt: Date? { get } -
The updated date of the conversation.
Declaration
Swift
public var updatedAt: Date? { get } -
The attributes of the conversation.
Declaration
Swift
public var attributes: [String : Any]? { get } -
The members of the conversation.
Declaration
Swift
public var members: [String]? { get } -
Whether the offline notification of this conversation has been muted by the client.
Declaration
Swift
public var isMuted: Bool { get } -
Raw data of the conversation.
Declaration
Swift
public private(set) var rawData: RawData { get set } -
Get value via subscript syntax.
Declaration
Swift
public subscript(key: String) -> Any? { get } -
Indicates whether the data of conversation is outdated, after refresh, this property will be false.
Declaration
Swift
public internal(set) var isOutdated: Bool { get set } -
The last message of the conversation.
Declaration
Swift
public private(set) var lastMessage: IMMessage? { get set } -
The last delivered date of message
Declaration
Swift
public var lastDeliveredAt: Date? { get } -
The last delivered timestamp of message
Declaration
Swift
public internal(set) var lastDeliveredTimestamp: Int64? { get set } -
The last read date of message
Declaration
Swift
public var lastReadAt: Date? { get } -
The last read timestamp of message
Declaration
Swift
public internal(set) var lastReadTimestamp: Int64? { get set } -
The unread message count of the conversation
Declaration
Swift
public internal(set) var unreadMessageCount: Int { get set } -
Indicates whether has unread message mentioning the client.
Declaration
Swift
public var isUnreadMessageContainMention: Bool { get set } -
The table of member infomation.
Declaration
Swift
public var memberInfoTable: [String : MemberInfo]? { get }
-
Clear unread messages that its sent timestamp less than the sent timestamp of the parameter message.
Declaration
Swift
public func read(message: IMMessage? = nil)Parameters
messageThe default is the last message.
-
Get the last message receipt timestamps in this conversation. if the timestamps have been updated, then properties of this conversation, lastReadAt and lastDeliveredAt, will be updated. after lastReadAt or lastDeliveredAt has been updated, the client will dispatch relative events, @see
IMConversationEvent.Declaration
Swift
public func getMessageReceiptFlag(completion: @escaping (LCGenericResult<MessageReceiptFlag>) -> Void) throwsParameters
completionResult callback.
-
Fetch the last message receipt timestamps in this conversation. if the timestamps have been updated, then properties of this conversation, lastReadAt and lastDeliveredAt, will be updated. after lastReadAt or lastDeliveredAt has been updated, the client will dispatch relative events, @see
IMConversationEvent.Declaration
Swift
public func fetchReceiptTimestamps() throws -
Join in this conversation.
Declaration
Swift
public func join(completion: @escaping (LCBooleanResult) -> Void) throwsParameters
completioncallback.
-
Leave this conversation.
Declaration
Swift
public func leave(completion: @escaping (LCBooleanResult) -> Void) throwsParameters
completioncallback.
-
Add members to this conversation.
Declaration
Swift
public func add(members: Set<String>, completion: @escaping (MemberResult) -> Void) throwsParameters
membersThe set of member’s ID.
completioncallback.
-
Remove members from this conversation.
Declaration
Swift
public func remove(members: Set<String>, completion: @escaping (MemberResult) -> Void) throwsParameters
membersThe set of member’s ID.
completioncallback.
-
Get count of members in this conversation. if it’s chat-room, the success result means count of online-members.
Declaration
Swift
public func countMembers(completion: @escaping (LCCountResult) -> Void)Parameters
completionResult callback.
-
Check whether client joined this conversation.
Declaration
Swift
public func checkJoined(completion: @escaping (LCGenericResult<Bool>) -> Void)Parameters
completionResult callback.
-
Mute this conversation.
Declaration
Swift
public func mute(completion: @escaping (LCBooleanResult) -> Void)Parameters
completioncallback.
-
Unmute this conversation.
Declaration
Swift
public func unmute(completion: @escaping (LCBooleanResult) -> Void)Parameters
completioncallback.
-
Refresh conversation’s data.
Declaration
Swift
public func refresh(completion: @escaping (LCBooleanResult) -> Void) throwsParameters
completioncallback
-
Update conversation’s data.
Declaration
Swift
public func update(attribution data: [String : Any], completion: @escaping (LCBooleanResult) -> Void) throwsParameters
dataThe data to be updated.
completioncallback.
-
Fetching the table of member infomation in this conversation. The result will be cached in the property
memberInfoTable.Declaration
Swift
public func fetchMemberInfoTable( limit: Int = 500, offset: Int? = nil, completion: @escaping (LCBooleanResult) -> Void)Parameters
limitThe max number of results, default is
500.offsetThe number of objects to skip.
completionResult of callback.
-
Get infomation of one member in the conversation.
Declaration
Swift
public func getMemberInfo(by memberID: String, completion: @escaping (LCGenericResult<MemberInfo?>) -> Void)Parameters
memberIDThe ID of the member.
completionResult of callback.
-
Updating role of the member in the conversaiton.
Throws
If role parameter is owner, throw error.Declaration
Swift
public func update( role: MemberRole, ofMember memberID: String, completion: @escaping (LCBooleanResult) -> Void) throwsParameters
roleThe role will be updated.
memberIDThe ID of the member who will be updated.
completionResult of callback.
-
Blocking members in the conversation.
Throws
When parametermembersis empty.Declaration
Swift
public func block(members: Set<String>, completion: @escaping (MemberResult) -> Void) throwsParameters
membersThe members will be blocked.
completionResult of callback.
-
Unblocking members in the conversation.
Throws
When parametermembersis empty.Declaration
Swift
public func unblock(members: Set<String>, completion: @escaping (MemberResult) -> Void) throwsParameters
membersThe members will be unblocked.
completionResult of callback.
-
Get the blocked members in the conversation.
Throws
When limit out of range.Declaration
Swift
public func getBlockedMembers( limit: Int = 50, next: String? = nil, completion: @escaping (LCGenericResult<BlockedMembersResult>) -> Void) throwsParameters
limitCount limit.
nextOffset.
completionResult of callback.
-
Check if one member has been blocked in the conversation.
Declaration
Swift
public func checkBlocking( member ID: String, completion: @escaping (LCGenericResult<Bool>) -> Void)Parameters
IDThe ID of member.
completionResult of callback.
-
Muting members in the conversation.
Throws
When parametermembersis empty.Declaration
Swift
public func mute(members: Set<String>, completion: @escaping (MemberResult) -> Void) throwsParameters
membersThe members will be muted.
completionResult of callback.
-
Unmuting members in the conversation.
Throws
When parametermembersis empty.Declaration
Swift
public func unmute(members: Set<String>, completion: @escaping (MemberResult) -> Void) throwsParameters
membersThe members will be unmuted.
completionResult of callback.
-
Get the muted members in the conversation.
Throws
When parameterlimitout of range.Declaration
Swift
public func getMutedMembers( limit: Int = 50, next: String? = nil, completion: @escaping (LCGenericResult<MutedMembersResult>) -> Void) throwsParameters
limitCount limit.
nextOffset.
completionResult of callback.
-
Check if one member has been muted in the conversation.
Declaration
Swift
public func checkMuting( member ID: String, completion: @escaping (LCGenericResult<Bool>) -> Void)Parameters
IDThe ID of member.
completionResult of callback.
-
Undocumented
Declaration
Swift
public func insertFailedMessageToCache( _ message: IMMessage, completion: @escaping (LCBooleanResult) -> Void) throws -
Undocumented
Declaration
Swift
public func removeFailedMessageFromCache( _ message: IMMessage, completion: @escaping (LCBooleanResult) -> Void) throws
-
Message Sending Option
See moreDeclaration
Swift
public struct MessageSendOptions : OptionSet -
Send Message.
Declaration
Swift
public func send( message: IMMessage, options: MessageSendOptions = .default, priority: IMChatRoom.MessagePriority? = nil, pushData: [String: Any]? = nil, progressQueue: DispatchQueue = .main, progress: ((Double) -> Void)? = nil, completion: @escaping (LCBooleanResult) -> Void) throwsParameters
messageThe message to be sent. Properties such as
IDandsentTimeStampare updated.options@see
MessageSendOptions.prioritypushDataThe push data of APNs.
progressQueueThe queue where the progress be called. default is main.
progressThe file uploading progress.
completioncallback.
-
Update the content of a sent message.
Declaration
Swift
public func update( oldMessage: IMMessage, to newMessage: IMMessage, progressQueue: DispatchQueue = .main, progress: ((Double) -> Void)? = nil, completion: @escaping (LCBooleanResult) -> Void) throwsParameters
oldMessageThe sent message to be updated.
newMessageThe message which has new content.
progressQueueThe queue where the progress be called, default is main.
progressThe file uploading progress.
completionResult callback.
-
Recall a sent message.
Declaration
Swift
public func recall( message: IMMessage, completion: @escaping (LCGenericResult<IMRecalledMessage>) -> Void) throwsParameters
messageThe message has been sent.
completionResult callback.
-
The timestamp flag of message receipt.
See moreDeclaration
Swift
public struct MessageReceiptFlag
-
The limit of the messge query result.
Declaration
Swift
public static let limitRangeOfMessageQuery: ClosedRange<Int> -
The endpoint of the message queue.
See moreDeclaration
Swift
public struct MessageQueryEndpoint -
The query direction.
See moreDeclaration
Swift
public enum MessageQueryDirection : Int -
Policy of Message Query
default: If using local storage, it iscacheThenNetwork. If not using local storage, it isonlyNetwork.- onlyNetwork: Only query remote server
- onlyCache: Only query local storage
- cacheThenNetwork: Query local storage firstly, if not get result, then query remote server.
Declaration
Swift
public enum MessageQueryPolicy -
Message Query.
Declaration
Swift
public func queryMessage( start: MessageQueryEndpoint? = nil, end: MessageQueryEndpoint? = nil, direction: MessageQueryDirection? = nil, limit: Int = 20, type: IMMessageCategorizing.MessageType? = nil, policy: MessageQueryPolicy = .default, completion: @escaping (LCGenericResult<[IMMessage]>) -> Void) throwsParameters
startstart endpoint, @see
MessageQueryEndpoint.endend endpoint, @see
MessageQueryEndpoint.direction@see
MessageQueryDirection. default isMessageQueryDirection.newToOld.limitThe limit of the query result, should in range
limitRangeOfMessageQuery. default is 20.type@see
IMMessageCategorizing.MessageType. if this parameter did set,policywill always be.onlyNetwork.policy@see
IMConversation.MessageQueryPolicy. ifclient.optionscontains.usingLocalStorage, then default is.cacheThenNetwork, else default is.onlyNetwork.completioncallback.
-
Result for member operation.
- allSucceeded: Operation for all members are succeeded.
- failure: Operation failed.
- slicing: Operation for part members are succeeded, and for part members are failed.
Declaration
Swift
public enum MemberResult : LCResultType
-
Role of the member in the conversation. Privilege: owner > manager > member.
- owner: Who owns the conversation.
- manager: Who can manage the conversation.
- member: General member.
Declaration
Swift
public enum MemberRole : String -
The infomation of one member in the conversation.
See moreDeclaration
Swift
public struct MemberInfo
-
Undocumented
Declaration
Swift
public typealias BlockedMembersResult = (members: [String], next: String?)
-
Undocumented
Declaration
Swift
public typealias MutedMembersResult = (members: [String], next: String?)
View on GitHub
Install in Dash
IMConversation Class Reference