MXChatListModel Class Reference

Inherits from NSObject
Declared in MXChatListModel.h

Overview

The MXChatListModel class provides interfaces for creating, deleting, accepting and declining chats. It also maintains all the chats object related with current user.

  delegate

The object that acts as delegate of the chat list.

@property (nonatomic, weak, nullable) id<MXChatListModelDelegate> delegate

Declared In

MXChatListModel.h

– chats

Return an array containing all chats.

- (NSArray<MXChat*> *)chats

Declared In

MXChatListModel.h

– getChatsById:

Get a MXChat instance via its chat id

- (MXChat *)getChatsById:(NSString *)chatId

Parameters

chatId

The id of this chat.

Return Value

MXChat instance

Declared In

MXChatListModel.h

– categories

Return an array containing all chat categories.

- (NSArray<MXChatCategory*> *)categories

Declared In

MXChatListModel.h

– chatsInCategory:

Query chats of a specified category.

- (NSArray<MXChat*> *)chatsInCategory:(MXChatCategory *)category

Parameters

category

The related category.

Return Value

An array containing all chats of the specified category.

Declared In

MXChatListModel.h

– createChatWithTopic:completionHandler:

Create a group chat with the specified topic.

- (void)createChatWithTopic:(NSString *_Nullable)topic completionHandler:(void ( ^ _Nullable ) ( NSError *_Nullable errorOrNil , MXChat *_Nullable chat ))completionHandler

Parameters

topic

The topic of the created chat

completionHandler

A block object to be executed when the action completes

Discussion

If the number of chats related with the user has reached the upper limit, an error with code MXChatSDKErrorExceedLimit will occurred.

Declared In

MXChatListModel.h

– createCategoryWithName:completionHandler:

Create a category with the specified name.

- (void)createCategoryWithName:(NSString *)categoryName completionHandler:(void ( ^ _Nullable ) ( NSError *_Nullable errorOrNil , MXChatCategory *_Nullable category ))completionHandler

Parameters

categoryName

The category name.

completionHandler

A block object to be executed when the action completes.

Declared In

MXChatListModel.h

– updateCategory:withName:completionHandler:

Update a category with the specified name.

- (void)updateCategory:(MXChatCategory *)category withName:(NSString *)categoryName completionHandler:(void ( ^ _Nullable ) ( NSError *_Nullable errorOrNil ))completionHandler

Parameters

category

The category need to update

categoryName

The category name.

completionHandler

A block object to be executed when the action completes.

Declared In

MXChatListModel.h

– deleteCategory:withCompletionHandler:

Delete a category

- (void)deleteCategory:(MXChatCategory *)category withCompletionHandler:(void ( ^ _Nullable ) ( NSError *_Nullable errorOrNil ))completionHandler

Parameters

category

The category need to delete

completionHandler

A block object to be executed when the action completes.

Declared In

MXChatListModel.h

– startIndividualChatWithUniqueId:orgId:completionHandler:

Start an individual chat with a user by specifying unique id and org id.

- (void)startIndividualChatWithUniqueId:(NSString *)uniqueId orgId:(NSString *_Nullable)orgId completionHandler:(void ( ^ _Nullable ) ( NSError *_Nullable errorOrNil , MXChat *_Nullable chat ))completionHandler

Parameters

uniqueId

The related user’s unique id.

orgId

The related user’s org id which could be nil.

completionHandler

A block object to be executed when the action completes.

Discussion

If the number of chats related with the user has reached the upper limit, an error with code MXChatSDKErrorExceedLimit will occurred.

Declared In

MXChatListModel.h

– deleteOrLeaveChat:withCompletionHandler:

Delete (if the current user is the owner) or leave a chat.

- (void)deleteOrLeaveChat:(MXChat *)chat withCompletionHandler:(void ( ^ _Nullable ) ( NSError *_Nullable errorOrNil ))completionHandler

Parameters

chat

The chat that the user is going to delete or leave.

completionHandler

A block object to be executed when the action completes.

Declared In

MXChatListModel.h

– acceptChat:withCompletionHandler:

Accept a chat

- (void)acceptChat:(MXChat *)chat withCompletionHandler:(void ( ^ _Nullable ) ( NSError *_Nullable errorOrNil ))completionHandler

Parameters

chat

The chat that wait user to accept or decline

completionHandler

A block object to be excuted when the chat gets accepted

Discussion

Usually do not need to take the initiative to accept or decline a chat. If this chat invitations is sent from other non-mobile SDK, you may need to accept or decline depends on whether this chat has been accepted.

Declared In

MXChatListModel.h

– declineChat:withCompletionHandler:

Decline a chat

- (void)declineChat:(MXChat *)chat withCompletionHandler:(void ( ^ _Nullable ) ( NSError *_Nullable errorOrNil ))completionHandler

Parameters

chat

The chat that wait user to accept or decline

completionHandler

A block object to be excuted when the chat gets declined

Discussion

Usually do not need to take the initiative to accept or decline a chat. If this chat invitations is sent from other non-mobile SDK, you may need to accept or decline depends on whether this chat has been accepted.

Declared In

MXChatListModel.h