Chat SDK for Unity and Windows v1.2.0
Public Member Functions | List of all members
AgoraChat.ChatThreadManager Class Reference
Inheritance diagram for AgoraChat.ChatThreadManager:

Public Member Functions

void CreateThread (string threadName, string msgId, string groupId, ValueCallBack< ChatThread > callback=null)
 
void JoinThread (string threadId, ValueCallBack< ChatThread > callback=null)
 
void LeaveThread (string threadId, CallBack callback=null)
 
void DestroyThread (string threadId, CallBack callback=null)
 
void RemoveThreadMember (string threadId, string userId, CallBack callback=null)
 
void ChangeThreadName (string threadId, string newName, CallBack callback=null)
 
void FetchThreadMembers (string threadId, string cursor=null, int pageSize=20, ValueCallBack< CursorResult< string > > callback=null)
 
void FetchThreadListOfGroup (string groupId, bool joined, string cursor=null, int pageSize=20, ValueCallBack< CursorResult< ChatThread > > callback=null)
 
void FetchMineJoinedThreadList (string cursor=null, int pageSize=20, ValueCallBack< CursorResult< ChatThread > > callback=null)
 
void GetThreadDetail (string threadId, ValueCallBack< ChatThread > callback=null)
 
void GetLastMessageAccordingThreads (List< string > threadIds, ValueCallBack< Dictionary< string, Message > > callback=null)
 
void AddThreadManagerDelegate (IChatThreadManagerDelegate threadManagerDelegate)
 
void RemoveThreadManagerDelegate (IChatThreadManagerDelegate threadManagerDelegate)
 

Member Function Documentation

◆ CreateThread()

void AgoraChat.ChatThreadManager.CreateThread ( string  threadName,
string  msgId,
string  groupId,
ValueCallBack< ChatThread callback = null 
)

Creates a message thread.

Each member of the chat group where the message thread belongs can call this method.

Upon the creation of a message thread, the following will occur:

Parameters
threadNameThe name of the new message thread. It can contain a maximum of 64 characters.
msgIdThe ID of the parent message.
groupIdThe parent ID, which is the group ID.
callbackThe result callback:

◆ JoinThread()

void AgoraChat.ChatThreadManager.JoinThread ( string  threadId,
ValueCallBack< ChatThread callback = null 
)

Joins a message thread.

Each member of the group where the message thread belongs can call this method.

In a multi-device login scenario, note the following:

Parameters
threadIdThe message thread ID.
callbackThe result callback:

◆ LeaveThread()

void AgoraChat.ChatThreadManager.LeaveThread ( string  threadId,
CallBack  callback = null 
)

Leaves a message thread.

Each member in the message thread can call this method.

In a multi-device login scenario, note the following:

Parameters
threadIdThe ID of the message thread that the current user wants to leave.
callbackThe result callback:

◆ DestroyThread()

void AgoraChat.ChatThreadManager.DestroyThread ( string  threadId,
CallBack  callback = null 
)

Destroys the message thread.

Only the owner or admins of the group where the message thread belongs can call this method.

Note

Parameters
threadIdThe message thread ID.
callbackThe result callback:

◆ RemoveThreadMember()

void AgoraChat.ChatThreadManager.RemoveThreadMember ( string  threadId,
string  userId,
CallBack  callback = null 
)

Removes a member from the message thread.

Only the owner or admins of the group where the message thread belongs and the message thread creator can call this method.

The removed member will receive the IChatThreadManagerDelegate#OnUserKickOutOfChatThread(ChatThreadEvent) callback.

You can listen for message thread events by setting IChatThreadManagerDelegate.

Parameters
threadIdThe message thread ID.
userIdThe user ID of the member to be removed from the message thread.
callbackThe result callback.

◆ ChangeThreadName()

void AgoraChat.ChatThreadManager.ChangeThreadName ( string  threadId,
string  newName,
CallBack  callback = null 
)

Changes the name of the message thread.

Only the owner or admins of the group where the message thread belongs and the message thread creator can call this method.

Each member of the group to which the message thread belongs will receive the IChatThreadManagerDelegate#OnChatThreadUpdate(ChatThreadEvent) callback.

You can listen for message thread events by setting IChatThreadManagerDelegate.

Parameters
threadIdThe message thread ID.
newNameThe new message thread name. It can contain a maximum of 64 characters.
callbackThe result callback:

◆ FetchThreadListOfGroup()

void AgoraChat.ChatThreadManager.FetchThreadListOfGroup ( string  groupId,
bool  joined,
string  cursor = null,
int  pageSize = 20,
ValueCallBack< CursorResult< ChatThread > >  callback = null 
)

Use the pagination to get the list of message threads in the specified group.

This method gets data from the server.

Parameters
groupIdThe parent ID, which is the group ID.
joinedWhether the current user has joined the thread.
cursorThe position from which to start getting data. At the first method call, if you set cursor to null or an empty string, the SDK will get data in the reverse chronological order of when message threads are created.
pageSizeThe number of message threads that you expect to get on each page. The value range is [1,50].
callBackThe result callback:

◆ FetchMineJoinedThreadList()

void AgoraChat.ChatThreadManager.FetchMineJoinedThreadList ( string  cursor = null,
int  pageSize = 20,
ValueCallBack< CursorResult< ChatThread > >  callback = null 
)

Uses the pagination to get the list of message threads that the current user has joined.

This method gets data from the server.

Parameters
cursorThe position from which to start getting data. At the first method call, if you set cursor to null or an empty string, the SDK will get data in the reverse chronological order of when the user joins the message threads.
pageSizeThe number of message threads that you expect to get on each page. The value range is [1,50].
callBackThe result callback:

◆ GetThreadDetail()

void AgoraChat.ChatThreadManager.GetThreadDetail ( string  threadId,
ValueCallBack< ChatThread callback = null 
)

Gets the details of the message thread from the server.

Parameters
threadIdThe message thread ID.
callbackThe result callback:

◆ AddThreadManagerDelegate()

void AgoraChat.ChatThreadManager.AddThreadManagerDelegate ( IChatThreadManagerDelegate  threadManagerDelegate)

Adds the message thread event listener, which listens for message thread changes, such as the message thread creation and destruction.

You can call RemoveThreadManagerDelegate to remove an unnecessary message thread event listener.

Parameters
threadManagerDelegateThe message thread event listener to add.

◆ RemoveThreadManagerDelegate()

void AgoraChat.ChatThreadManager.RemoveThreadManagerDelegate ( IChatThreadManagerDelegate  threadManagerDelegate)

Removes the message thread event listener.

After a message thread event listener is added with AddThreadManagerDelegate, you can call this method to remove it when it is not required.

Parameters
listenerThe message thread event listener to remove.