Chat SDK for Unity and Windows v1.2.0
Public 成员函数 | 所有成员列表
AgoraChat.ChatThreadManager类 参考
类 AgoraChat.ChatThreadManager 继承关系图:

Public 成员函数

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)
 

成员函数说明

◆ CreateThread()

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

创建子区。

子区所属群组的所有成员均可调用该方法。

子区创建成功后,会出现如下情况:

参数
threadName要创建的子区的名称。长度不超过 64 个字符。
msgId父消息 ID。
groupId父 ID,即群组 ID。
callback结果回调:

◆ JoinThread()

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

加入子区。

子区所属群组的所有成员均可调用该方法。

多端多设备登录时,注意以下几点:

参数
threadId子区 ID。
callback结果回调:

◆ LeaveThread()

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

退出子区。

子区中的所有成员均可调用该方法。

多设备登录情况下,注意以下几点:

参数
threadId要退出的子区的 ID。
callback结果回调:

◆ DestroyThread()

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

解散子区。

只有子区所属群组的群主及管理员可调用该方法。

注意

参数
threadId子区 ID。
callback结果回调:

◆ RemoveThreadMember()

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

移除子区成员。

只有子区所属群主、群管理员及子区创建者可调用该方法。

被移出的成员会收到 IChatThreadManagerDelegate#OnUserKickOutOfChatThread(ChatThreadEvent) 回调。

你可通过设置 IChatThreadManagerDelegate 监听子区事件。

参数
threadId子区 ID。
userId被移出子区的成员的用户 ID。
callback结果回调。

◆ ChangeThreadName()

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

修改子区名称。

只有子区所属群主、群管理员及子区创建者可调用该方法。

子区所属群组的成员会收到 IChatThreadManagerDelegate#OnChatThreadUpdate(ChatThreadEvent) 回调。

你可通过设置 IChatThreadManagerDelegate 监听子区事件。

参数
threadId子区 ID。
newName子区的新名称。长度不超过 64 个字符。
callback结果回调:

◆ FetchThreadMembers()

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

分页获取子区成员。

子区所属群组的所有成员均可调用该方法。

参数
threadId子区 ID。
cursor开始获取数据的游标位置,首次调用方法时传 null 或空字符串,按成员加入子区时间的正序获取数据。
pageSize每页期望返回的成员数。取值范围为 [1,50]。
callBack结果回调:

Gets a list of members in the message thread with pagination.

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

参数
threadIdThe message thread ID.
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 chronological order of when members join the message thread.
pageSizeThe number of members that you expect to get on each page. The value range is [1,50].
callBackThe result callback:

◆ FetchThreadListOfGroup()

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

分页从服务器端获取指定群组的子区列表。

参数
groupId父 ID,即群组 ID。
joined是否是当前用户加入的子区。
cursor开始取数据的游标位置。首次获取数据时传 null 或空字符串,按子区创建时间的倒序获取数据。
pageSize每页期望返回的子区数。取值范围为 [1,50]。
callBack结果回调:

◆ FetchMineJoinedThreadList()

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

分页从服务器获取当前用户加入的子区列表。

参数
cursor开始获取数据的游标位置。首次调用方法时传 null 或空字符串,按用户加入子区时间的倒序获取数据。
pageSize每页期望返回的子区数。取值范围为 [1,50]。
callBack结果回调:

◆ GetThreadDetail()

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

从服务器获取子区详情。

参数
threadId子区 ID。
callback结果回调:

◆ GetLastMessageAccordingThreads()

void AgoraChat.ChatThreadManager.GetLastMessageAccordingThreads ( List< string >  threadIds,
ValueCallBack< Dictionary< string, Message > >  callback = null 
)

从服务器批量获取指定子区中的最新一条消息。

参数
threadIds要查询的子区 ID 列表,每次最多可传 20 个子区。
callback结果回调:

Gets the last reply in the specified message threads from the server.

参数
threadIdsThe list of message thread IDs to query. You can pass a maximum of 20 message thread IDs each time.
callbackThe result callback:

◆ AddThreadManagerDelegate()

void AgoraChat.ChatThreadManager.AddThreadManagerDelegate ( IChatThreadManagerDelegate  threadManagerDelegate)

注册子区事件监听器,用于监听子区变化,如子区的创建和解散等。

你可以调用 RemoveThreadManagerDelegate 移除不需要的监听器。

参数
threadManagerDelegate要注册的子区事件监听器。

◆ RemoveThreadManagerDelegate()

void AgoraChat.ChatThreadManager.RemoveThreadManagerDelegate ( IChatThreadManagerDelegate  threadManagerDelegate)

移除子区事件监听器。

在利用 AddThreadManagerDelegate 注册子区事件监听器后调用此方法。

参数
listener要移除的子区事件监听器。