|
Chat SDK for Unity and Windows v1.3.2
|
Public 成员函数 | |
| void | MarkMessageAsRead (string messageId) |
| void | MarkAllMessageAsRead () |
| bool | InsertMessage (Message message) |
| bool | AppendMessage (Message message) |
| bool | UpdateMessage (Message message) |
| bool | DeleteMessage (string messageId) |
| bool | DeleteMessages (long startTime, long endTime) |
| bool | DeleteAllMessages () |
| Message | LoadMessage (string messageId) |
| void | LoadMessagesWithMsgType (MessageBodyType type, string sender=null, long timestamp=-1, int count=20, MessageSearchDirection direction=MessageSearchDirection.UP, ValueCallBack< List< Message > > callback=null) |
| void | LoadMessagesWithMsgTypeList (List< MessageBodyType > typeList, string sender=null, long timestamp=-1, int count=20, MessageSearchDirection direction=MessageSearchDirection.UP, ValueCallBack< List< Message > > callback=null) |
| void | LoadMessages (string startMessageId=null, int count=20, MessageSearchDirection direction=MessageSearchDirection.UP, ValueCallBack< List< Message > > callback=null) |
| void | LoadMessagesWithKeyword (string keywords, string sender=null, long timestamp=-1, int count=20, MessageSearchDirection direction=MessageSearchDirection.UP, ValueCallBack< List< Message > > callback=null) |
| void | LoadMessagesWithTime (long startTime, long endTime, int count=20, ValueCallBack< List< Message > > callback=null) |
| void | LoadMessagesWithScope (string keywords, MessageSearchScope scope=MessageSearchScope.CONTENT, long timestamp=0, int maxCount=20, string from=null, MessageSearchDirection direction=MessageSearchDirection.UP, ValueCallBack< List< Message > > callback=null) |
| int | MessagesCount () |
| int | MessagesCountWithTimestamp (long startTimestamp, long endTimestamp) |
| List< Message > | PinnedMessages () |
| List< MarkType > | Marks () |
Public 属性 | |
| string | Id |
| ConversationType | Type |
| bool | IsThread |
| bool | IsPinned |
| long | PinnedTime |
属性 | |
| Message | LastMessage [get] |
| Message | LastReceivedMessage [get] |
| Dictionary< string, string > | Ext [get, set] |
| int | UnReadCount [get] |
| void AgoraChat.Conversation.MarkMessageAsRead | ( | string | messageId | ) |
设置指定消息为已读。
| messageId | 消息 ID。 |
| void AgoraChat.Conversation.MarkAllMessageAsRead | ( | ) |
将指定会话的所有未读消息设置为已读。
| bool AgoraChat.Conversation.InsertMessage | ( | Message | message | ) |
在本地数据库的指定会话中插入一条消息。
消息的会话 ID 应该和会话的 ID 一致。
消息会根据消息里的 Unix 时间戳被插入本地数据库,SDK 会更新会话的 latestMessage 等属性。
| message | 消息实例。 |
true: 成功;false: 失败。 | bool AgoraChat.Conversation.AppendMessage | ( | Message | message | ) |
在本地数据库中指定会话的尾部插入一条消息。
消息的会话 ID 应与会话的 ID 一致。
消息插入后,SDK 会自动更新会话的 latestMessage 等属性。
| message | 消息实例。 |
true: 成功;false: 失败。 | bool AgoraChat.Conversation.UpdateMessage | ( | Message | message | ) |
更新本地数据库的指定消息。
消息更新时,消息 ID 不会修改。
消息更新后,SDK 会自动更新会话的 latestMessage 等属性。
| message | 要更新的消息。 |
true: 成功;false: 失败。 | bool AgoraChat.Conversation.DeleteMessage | ( | string | messageId | ) |
删除本地数据库中的一条指定消息。
| messageId | 要删除消息的 ID。 |
true: 成功;false: 失败。 | bool AgoraChat.Conversation.DeleteMessages | ( | long | startTime, |
| long | endTime | ||
| ) |
删除本地数据库中指定时间段的消息。
| startTime | 删除消息的起始时间。Unix 时间戳,单位为毫秒。 |
| endTime | 删除消息的结束时间。Unix 时间戳,单位为毫秒 |
true: 成功;false: 失败。 | bool AgoraChat.Conversation.DeleteAllMessages | ( | ) |
删除指定会话中所有消息。
该方法同时删除指定会话在内存和数据库中的所有消息。
true: 成功;false: 失败。 | Message AgoraChat.Conversation.LoadMessage | ( | string | messageId | ) |
加载指定消息。
SDK 首先在内存中查找消息,若在内存中未找到,SDK 会在本地数据库查询并加载。
| messageId | 要加载的消息的 ID。 |
null。 | void AgoraChat.Conversation.LoadMessagesWithMsgType | ( | MessageBodyType | type, |
| string | sender = null, |
||
| long | timestamp = -1, |
||
| int | count = 20, |
||
| MessageSearchDirection | direction = MessageSearchDirection.UP, |
||
| ValueCallBack< List< Message > > | callback = null |
||
| ) |
加载特定类型的多条消息。
SDK 首先在内存中查询消息,若在内存中未找到,SDK 会在本地数据库查询并加载。
| type | 加载消息类型。该参数必填。 |
| sender | 消息发送方的用户 ID。该参数必填。 |
| timestamp | 查询的起始 Unix 时间戳,单位为毫秒。 |
| count | 加载的最大消息数目。默认值为 20。 |
| direction | 消息加载方向。默认按消息中的时间戳(SortMessageByServerTime)的倒序加载,详见 MessageSearchDirection。 |
| callback | 加载结果回调,成功返回消息列表,失败返回错误原因,详见 ValueCallBack。 |
| void AgoraChat.Conversation.LoadMessagesWithMsgTypeList | ( | List< MessageBodyType > | typeList, |
| string | sender = null, |
||
| long | timestamp = -1, |
||
| int | count = 20, |
||
| MessageSearchDirection | direction = MessageSearchDirection.UP, |
||
| ValueCallBack< List< Message > > | callback = null |
||
| ) |
加载多种消息类型的多条消息。
SDK 首先在内存中查询消息,若在内存中未找到,SDK 会在本地数据库查询并加载。
| typeList | 加载消息类型列表。该参数必填。 |
| sender | 消息发送方的用户 ID。该参数必填。 |
| timestamp | 查询的起始 Unix 时间戳,单位为毫秒。 |
| count | 加载的最大消息数目。默认值为 20。 |
| direction | 消息加载方向。默认按消息中的时间戳(SortMessageByServerTime)的倒序加载,详见 MessageSearchDirection。 |
| callback | 加载结果回调,成功返回消息列表,失败返回错误原因,详见 ValueCallBack。 |
| void AgoraChat.Conversation.LoadMessages | ( | string | startMessageId = null, |
| int | count = 20, |
||
| MessageSearchDirection | direction = MessageSearchDirection.UP, |
||
| ValueCallBack< List< Message > > | callback = null |
||
| ) |
从指定消息 ID 开始加载消息。
SDK 首先在内存中查找消息,若在内存中未找到,SDK 会在本地数据库查询并加载。
| startMessageId | 加载的起始消息 ID。若该参数设置为 "" 或者 null,将从最近的消息开始加载。 |
| count | 加载的最大消息数目。默认值为 20。 |
| direction | 消息加载方向。默认按消息中的时间戳(SortMessageByServerTime)的倒序加载,详见 MessageSearchDirection。 |
| callback | 加载结果回调,成功返回消息列表,失败返回错误原因,详见 ValueCallBack。 |
| void AgoraChat.Conversation.LoadMessagesWithKeyword | ( | string | keywords, |
| string | sender = null, |
||
| long | timestamp = -1, |
||
| int | count = 20, |
||
| MessageSearchDirection | direction = MessageSearchDirection.UP, |
||
| ValueCallBack< List< Message > > | callback = null |
||
| ) |
根据关键字加载消息。
SDK 首先在内存中查找消息,若在内存中未找到,SDK 会在本地数据库查询并加载。
| keywords | 查询使用的关键字。 |
| sender | 消息发送方的用户 ID。 若不设置该参数,SDK 搜索消息时会忽略该参数。 |
| timestamp | 查询的起始时间戳,单位为毫秒。 |
| count | 加载的最大消息数目,默认值为 20。 |
| direction | 消息加载方向。默认按消息中的时间戳的倒序加载,详见 MessageSearchDirection。 |
| callback | 加载结果回调,成功返回消息列表,失败返回错误原因,详见 ValueCallBack。 |
| void AgoraChat.Conversation.LoadMessagesWithTime | ( | long | startTime, |
| long | endTime, | ||
| int | count = 20, |
||
| ValueCallBack< List< Message > > | callback = null |
||
| ) |
加载指定时间段内的消息。
注意
SDK 首先在内存中查找消息,若在内存中未找到,SDK 会在本地数据库查询并加载。
若加载的消息数量较大,请注意内存使用情况。
| startTimeStamp | 查询的起始时间戳。 |
| endTimeStamp | 查询的结束时间戳。 |
| count | 加载的最大消息条数。 |
| callback | 加载结果回调,成功返回消息列表,失败返回错误原因,详见 ValueCallBack。 |
| void AgoraChat.Conversation.LoadMessagesWithScope | ( | string | keywords, |
| MessageSearchScope | scope = MessageSearchScope.CONTENT, |
||
| long | timestamp = 0, |
||
| int | maxCount = 20, |
||
| string | from = null, |
||
| MessageSearchDirection | direction = MessageSearchDirection.UP, |
||
| ValueCallBack< List< Message > > | callback = null |
||
| ) |
加载指定范围内满足条件的消息。
| keywords | 查找关键字,字符串类型。 |
| scope | 查询范围,详见 MessageSearchScope。 |
| timestamp | 查询的起始时间戳。单位为毫秒。 |
| maxCount | 查询的最大消息数。 |
| from | 消息发送方的用户 ID。若不设置该参数,SDK 搜索消息时会忽略该参数。 |
| direction | 查询方向,详见 MessageSearchDirection。 |
| int AgoraChat.Conversation.MessagesCount | ( | ) |
获取 SDK 本地数据库中会话的全部消息数目。
| int AgoraChat.Conversation.MessagesCountWithTimestamp | ( | long | startTimestamp, |
| long | endTimestamp | ||
| ) |
获取 SDK 本地数据库中会话指定时间段的消息数目。
| startTimestamp | 查询的起始时间戳。单位为毫秒。 |
| endTimestamp | 查询的结束时间戳。单位为毫秒。 |
| List< Message > AgoraChat.Conversation.PinnedMessages | ( | ) |
本地获取会话的置顶消息。
| List< MarkType > AgoraChat.Conversation.Marks | ( | ) |
获取会话的所有标记。
| string AgoraChat.Conversation.Id |
会话 ID。
| ConversationType AgoraChat.Conversation.Type |
会话类型。
| bool AgoraChat.Conversation.IsThread |
判断该会话是否为子区会话:
true:是;false:否。 | bool AgoraChat.Conversation.IsPinned |
判断该会话是否被置顶。
true:是;false:否。 | long AgoraChat.Conversation.PinnedTime |
会话置顶时间戳(毫秒)。
如果 IsPinned 为 false,将返回 0。
|
get |
获取指定会话的最新消息。
该方法的调用不影响会话的未读消息数。
SDK 首先从内存中获取最新消息,若在内存中未找到,则从数据库中加载,然后将其存放在内存中。
|
get |
获取指定会话中收到的最新消息。
|
getset |
获取指定会话的扩展信息。
|
get |
获取指定会话的未读消息数。