From 1331badc6a8eb2a9269ab4bc3e07ccbd509bd891 Mon Sep 17 00:00:00 2001 From: Jang Rush Date: Fri, 24 Jul 2020 19:04:23 +0800 Subject: [PATCH] docs: api-doc zh -> en --- Common/Common/Exception/LCException.cs | 6 +- Common/Common/Json/LCJsonUtils.cs | 2 +- Common/Common/Log/LCLogLevel.cs | 12 - Common/Common/Log/LCLogger.cs | 4 +- .../Internal/LCLiveQueryConnection.cs | 31 +-- .../Internal/LCLiveQueryHeartBeat.cs | 2 +- LiveQuery/LiveQuery/LCLiveQuery.cs | 21 +- Realtime/Realtime.Test/Message.cs | 3 - .../Realtime/Conversation/LCIMChatRoom.cs | 10 +- .../Realtime/Conversation/LCIMConversation.cs | 130 +++++------ .../LCIMConversationMemberInfo.cs | 9 - .../Conversation/LCIMConversationQuery.cs | 46 ++-- .../Conversation/LCIMServiceConversation.cs | 3 - .../Conversation/LCIMTemporaryConversation.cs | 9 - .../Internal/Connection/LCConnection.cs | 60 +---- .../Internal/Connection/LCHeartBeat.cs | 15 +- .../Controller/LCIMConversationController.cs | 219 +++--------------- .../Controller/LCIMMessageController.cs | 62 +---- .../Controller/LCIMSessionController.cs | 25 +- .../Realtime/Internal/Router/LCRTMRouter.cs | 11 +- .../Internal/WebSocket/LCWebSocketClient.cs | 38 --- Realtime/Realtime/LCIMClient.cs | 109 +++++---- Realtime/Realtime/LCRealtime.cs | 14 +- Realtime/Realtime/Message/LCIMAudioMessage.cs | 6 - .../Realtime/Message/LCIMBinaryMessage.cs | 6 - Realtime/Realtime/Message/LCIMFileMessage.cs | 12 +- Realtime/Realtime/Message/LCIMImageMessage.cs | 9 - .../Realtime/Message/LCIMLocationMessage.cs | 6 - Realtime/Realtime/Message/LCIMMessage.cs | 30 +-- .../Message/LCIMMessageSendOptions.cs | 13 +- .../Realtime/Message/LCIMRecalledMessage.cs | 2 +- Realtime/Realtime/Message/LCIMTextMessage.cs | 6 - Realtime/Realtime/Message/LCIMTypedMessage.cs | 34 +-- Realtime/Realtime/Message/LCIMVideoMessage.cs | 12 - .../Realtime/Result/LCIMOperationFailure.cs | 12 - Realtime/Realtime/Result/LCIMPageResult.cs | 9 - .../Result/LCIMPartiallySuccessResult.cs | 9 - .../Signature/ILCIMSignatureFactory.cs | 28 --- Realtime/Realtime/Signature/LCIMSignature.cs | 11 +- .../Realtime/Signature/LCIMSignatureAction.cs | 20 +- .../SingleThreadSynchronizationContext.cs | 2 +- .../SingleThreadSynchronizationContext.cs | 2 +- Storage/Storage/LCACL.cs | 2 +- Storage/Storage/LCApplication.cs | 2 +- Storage/Storage/LCCaptchaClient.cs | 16 +- Storage/Storage/LCCloud.cs | 20 +- Storage/Storage/LCGeoPoint.cs | 21 -- Storage/Storage/LCObject.cs | 41 ++-- Storage/Storage/LCQuery.cs | 83 +++---- Storage/Storage/LCRelation.cs | 16 +- Storage/Storage/LCRole.cs | 12 +- Storage/Storage/LCSMSClient.cs | 14 +- Storage/Storage/LCUser.cs | 56 ++--- Storage/Storage/LCUserAuthDataLoginOption.cs | 8 +- Storage/Storage/Leaderboard/LCLeaderboard.cs | 137 +---------- .../Leaderboard/LCLeaderboardArchive.cs | 19 +- Storage/Storage/Leaderboard/LCRanking.cs | 18 -- Storage/Storage/Leaderboard/LCStatistic.cs | 12 - 58 files changed, 376 insertions(+), 1171 deletions(-) diff --git a/Common/Common/Exception/LCException.cs b/Common/Common/Exception/LCException.cs index 1daebab..7665d5c 100644 --- a/Common/Common/Exception/LCException.cs +++ b/Common/Common/Exception/LCException.cs @@ -2,18 +2,18 @@ namespace LeanCloud { /// - /// LeanCloud 异常 + /// LeanCloud Exceptions /// public class LCException : Exception { /// - /// 错误码 + /// Error code /// public int Code { get; set; } /// - /// 错误信息 + /// Error message /// public new string Message { get; set; diff --git a/Common/Common/Json/LCJsonUtils.cs b/Common/Common/Json/LCJsonUtils.cs index 25ec9fd..ad368ad 100644 --- a/Common/Common/Json/LCJsonUtils.cs +++ b/Common/Common/Json/LCJsonUtils.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; namespace LeanCloud.Common { /// - /// 为 Json 解析提供异步接口 + /// Serialize and deserialize /// public static class LCJsonUtils { public static async Task SerializeObjectAsync(object obj) { diff --git a/Common/Common/Log/LCLogLevel.cs b/Common/Common/Log/LCLogLevel.cs index f43aaf5..fd994fd 100644 --- a/Common/Common/Log/LCLogLevel.cs +++ b/Common/Common/Log/LCLogLevel.cs @@ -1,19 +1,7 @@ namespace LeanCloud { - /// - /// 日志级别 - /// public enum LCLogLevel { - /// - /// 调试级别 - /// Debug, - /// - /// 警告级别 - /// Warn, - /// - /// 错误级别 - /// Error, } } diff --git a/Common/Common/Log/LCLogger.cs b/Common/Common/Log/LCLogger.cs index 1ffbcac..d0611d0 100644 --- a/Common/Common/Log/LCLogger.cs +++ b/Common/Common/Log/LCLogger.cs @@ -3,11 +3,11 @@ using System.Text; namespace LeanCloud { /// - /// 日志类 + /// Logger /// public static class LCLogger { /// - /// 日志回调接口,方便开发者调试 + /// Configures the logger. /// /// The log delegate. public static Action LogDelegate { diff --git a/LiveQuery/LiveQuery/Internal/LCLiveQueryConnection.cs b/LiveQuery/LiveQuery/Internal/LCLiveQueryConnection.cs index cfeeb34..d2e4466 100644 --- a/LiveQuery/LiveQuery/Internal/LCLiveQueryConnection.cs +++ b/LiveQuery/LiveQuery/Internal/LCLiveQueryConnection.cs @@ -10,45 +10,28 @@ using LeanCloud.Realtime.Internal.Connection; namespace LeanCloud.LiveQuery.Internal { public class LCLiveQueryConnection { - /// - /// 发送超时 - /// private const int SEND_TIMEOUT = 10000; /// - /// 最大重连次数,超过后重置 Router 缓存后再次尝试重连 + /// After exceeding this limit, will reset the Router cache and try to reconnect again. /// private const int MAX_RECONNECT_TIMES = 10; - /// - /// 重连间隔 - /// private const int RECONNECT_INTERVAL = 10000; - /// - /// 子协议 - /// private const string SUB_PROTOCOL = "lc.json.3"; - /// - /// 通知事件 - /// + internal Action> OnNotification; - /// - /// 断线事件 - /// internal Action OnDisconnect; - /// - /// 重连成功事件 - /// internal Action OnReconnected; internal string id; /// - /// 请求回调缓存 + /// Request callback cache /// private readonly Dictionary>> responses; @@ -90,7 +73,7 @@ namespace LeanCloud.LiveQuery.Internal { } /// - /// 重置连接 + /// Resets connection /// /// internal async Task Reset() { @@ -108,7 +91,7 @@ namespace LeanCloud.LiveQuery.Internal { } /// - /// 发送请求,会在收到应答后返回 + /// Sends the request. It will return after receiving a response. /// /// /// @@ -127,7 +110,7 @@ namespace LeanCloud.LiveQuery.Internal { } /// - /// 发送文本消息 + /// Sends text message. /// /// /// @@ -142,7 +125,7 @@ namespace LeanCloud.LiveQuery.Internal { } /// - /// 关闭连接 + /// Closes the connection. /// /// internal async Task Close() { diff --git a/LiveQuery/LiveQuery/Internal/LCLiveQueryHeartBeat.cs b/LiveQuery/LiveQuery/Internal/LCLiveQueryHeartBeat.cs index 6dd5262..d3a339c 100644 --- a/LiveQuery/LiveQuery/Internal/LCLiveQueryHeartBeat.cs +++ b/LiveQuery/LiveQuery/Internal/LCLiveQueryHeartBeat.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; namespace LeanCloud.LiveQuery.Internal { /// - /// LiveQuery 心跳控制器 + /// LiveQuery heartbeat controller /// internal class LCLiveQueryHeartBeat : LCHeartBeat { private readonly LCLiveQueryConnection connection; diff --git a/LiveQuery/LiveQuery/LCLiveQuery.cs b/LiveQuery/LiveQuery/LCLiveQuery.cs index c6f96a6..da077bb 100644 --- a/LiveQuery/LiveQuery/LCLiveQuery.cs +++ b/LiveQuery/LiveQuery/LCLiveQuery.cs @@ -13,27 +13,27 @@ namespace LeanCloud.LiveQuery { /// public class LCLiveQuery { /// - /// 新对象创建事件 + /// A new LCObject which fulfills the LCQuery you subscribe is created. /// public Action OnCreate; /// - /// 对象更新事件 + /// An existing LCObject which fulfills the LCQuery you subscribe is updated. /// public Action> OnUpdate; /// - /// 对象被删除 + /// An existing LCObject which fulfills the LCQuery you subscribe is deleted. /// public Action OnDelete; /// - /// 有新的满足条件的对象产生 + /// An existing LCObject which doesn't fulfill the LCQuery is updated and now it fulfills the LCQuery. /// public Action> OnEnter; /// - /// 不再满足条件 + /// An existing LCObject which fulfills the LCQuery is updated and now it doesn't fulfill the LCQuery. /// public Action> OnLeave; /// - /// 当一个用户登录成功 + /// A LCUser logged in successfully. /// public Action OnLogin; @@ -55,10 +55,7 @@ namespace LeanCloud.LiveQuery { private static readonly string DeviceId = Guid.NewGuid().ToString(); - /// - /// 订阅 - /// - /// + public async Task Subscribe() { // TODO 判断当前连接情况 if (connection == null) { @@ -92,10 +89,6 @@ namespace LeanCloud.LiveQuery { } } - /// - /// 取消订阅 - /// - /// public async Task Unsubscribe() { Dictionary data = new Dictionary { { "id", DeviceId }, diff --git a/Realtime/Realtime.Test/Message.cs b/Realtime/Realtime.Test/Message.cs index d69ce66..fefb78f 100644 --- a/Realtime/Realtime.Test/Message.cs +++ b/Realtime/Realtime.Test/Message.cs @@ -9,9 +9,6 @@ using LeanCloud.Realtime; using static NUnit.Framework.TestContext; -/// -/// Emoji 消息 -/// class EmojiMessage : LCIMTypedMessage { public const int EmojiMessageType = 1; diff --git a/Realtime/Realtime/Conversation/LCIMChatRoom.cs b/Realtime/Realtime/Conversation/LCIMChatRoom.cs index e5f89b3..6bccd42 100644 --- a/Realtime/Realtime/Conversation/LCIMChatRoom.cs +++ b/Realtime/Realtime/Conversation/LCIMChatRoom.cs @@ -5,25 +5,21 @@ using System.Threading.Tasks; namespace LeanCloud.Realtime { /// - /// 聊天室 + /// Chatroom /// public class LCIMChatRoom : LCIMConversation { public LCIMChatRoom(LCIMClient client) : base(client) { } - /// - /// 获取在线用户数量 - /// - /// public async Task GetOnlineMembersCount() { return await GetMembersCount(); } /// - /// 获取在线用户 + /// Gets online members. /// - /// + /// Query limit, defaults to 50. /// public async Task> GetOnlineMembers(int limit = 50) { return await Client.ConversationController.GetOnlineMembers(Id, limit); diff --git a/Realtime/Realtime/Conversation/LCIMConversation.cs b/Realtime/Realtime/Conversation/LCIMConversation.cs index b0f4015..91a0623 100644 --- a/Realtime/Realtime/Conversation/LCIMConversation.cs +++ b/Realtime/Realtime/Conversation/LCIMConversation.cs @@ -7,32 +7,32 @@ using LeanCloud.Storage; namespace LeanCloud.Realtime { /// - /// 普通对话 + /// Conversation /// public class LCIMConversation { /// - /// 对话 Id + /// The ID of this conversation /// public string Id { get; internal set; } /// - /// 是否唯一 + /// Indicates whether this conversation is normal and unique. The uniqueness is based on the members when creating. /// public bool Unique { get; internal set; } /// - /// 唯一 Id + /// If this conversation is unique, then it will have a unique ID. /// public string UniqueId { get; internal set; } /// - /// 对话名称 + /// The name of this conversation. /// public string Name { get { @@ -44,14 +44,14 @@ namespace LeanCloud.Realtime { } /// - /// 创建者 Id + /// The creator of this conversation. /// public string CreatorId { get; set; } /// - /// 成员 Id + /// The members of this conversation. /// public ReadOnlyCollection MemberIds { get { @@ -60,7 +60,7 @@ namespace LeanCloud.Realtime { } /// - /// 静音成员 Id + /// Muted members of this conversation. /// public ReadOnlyCollection MutedMemberIds { get { @@ -69,42 +69,42 @@ namespace LeanCloud.Realtime { } /// - /// 未读消息数量 + /// The count of the unread messages. /// public int Unread { get; internal set; } /// - /// 最新的一条消息 + /// The last message in this conversation. /// public LCIMMessage LastMessage { get; internal set; } /// - /// 创建时间 + /// The created date of this conversation. /// public DateTime CreatedAt { get; internal set; } /// - /// 更新时间 + /// The last updated date of this conversation. /// public DateTime UpdatedAt { get; internal set; } /// - /// 最新送达消息时间戳 + /// The last timestamp of the delivered message. /// public long LastDeliveredTimestamp { get; internal set; } /// - /// 最新送达消息时间 + /// The last date of the delivered message. /// public DateTime LastDeliveredAt { get { @@ -114,14 +114,14 @@ namespace LeanCloud.Realtime { } /// - /// 最新已读消息时间戳 + /// The last timestamp of the message which has been read by other clients. /// public long LastReadTimestamp { get; internal set; } /// - /// 最新已读消息时间 + /// The last date of the message which has been read by other clients. /// public DateTime LastReadAt { get { @@ -131,9 +131,9 @@ namespace LeanCloud.Realtime { } /// - /// 设置/获取对话属性 + /// Custom attributes. /// - /// + /// Custom attribute name. /// public object this[string key] { get { @@ -145,7 +145,7 @@ namespace LeanCloud.Realtime { } /// - /// 是否已静音 + /// Indicates whether offline notifications about this conversation has been muted. /// public bool IsMute { get; private set; @@ -170,7 +170,7 @@ namespace LeanCloud.Realtime { } /// - /// 获取对话人数,或暂态对话的在线人数 + /// The count of members of this conversation. /// /// public async Task GetMembersCount() { @@ -178,7 +178,7 @@ namespace LeanCloud.Realtime { } /// - /// 将该会话标记为已读 + /// Mark the last message of this conversation as read. /// /// /// @@ -191,9 +191,9 @@ namespace LeanCloud.Realtime { } /// - /// 修改对话属性 + /// Update attributes of this conversation. /// - /// + /// Attributes to update. /// public async Task UpdateInfo(Dictionary attributes) { if (attributes == null || attributes.Count == 0) { @@ -206,9 +206,9 @@ namespace LeanCloud.Realtime { } /// - /// 添加用户到对话 + /// Adds members to this conversation. /// - /// 用户 Id + /// Member list. /// public virtual async Task AddMembers(IEnumerable clientIds) { if (clientIds == null || clientIds.Count() == 0) { @@ -220,9 +220,9 @@ namespace LeanCloud.Realtime { } /// - /// 删除用户 + /// Removes members from this conversation. /// - /// 用户 Id + /// Member list. /// public async Task RemoveMembers(IEnumerable removeIds) { if (removeIds == null || removeIds.Count() == 0) { @@ -234,7 +234,7 @@ namespace LeanCloud.Realtime { } /// - /// 加入对话 + /// Joins this conversation. /// /// public async Task Join() { @@ -249,7 +249,7 @@ namespace LeanCloud.Realtime { } /// - /// 离开对话 + /// Leaves this conversation. /// /// public async Task Quit() { @@ -261,9 +261,9 @@ namespace LeanCloud.Realtime { } /// - /// 发送消息 + /// Sends a message in this conversation. /// - /// + /// The message to send. /// public async Task Send(LCIMMessage message, LCIMMessageSendOptions options = null) { @@ -279,7 +279,7 @@ namespace LeanCloud.Realtime { } /// - /// 静音 + /// Turns off the offline notifications of this conversation. /// /// public async Task Mute() { @@ -288,7 +288,7 @@ namespace LeanCloud.Realtime { } /// - /// 取消静音 + /// Turns on the offline notifications of this conversation. /// /// public async Task Unmute() { @@ -297,9 +297,9 @@ namespace LeanCloud.Realtime { } /// - /// 禁言 + /// Mutes members of this conversatino. /// - /// + /// Member list. /// public async Task MuteMembers(IEnumerable clientIds) { if (clientIds == null || clientIds.Count() == 0) { @@ -313,9 +313,9 @@ namespace LeanCloud.Realtime { } /// - /// 取消禁言 + /// Unmutes members of this conversatino. /// - /// + /// Member list. /// public async Task UnmuteMembers(IEnumerable clientIds) { if (clientIds == null || clientIds.Count() == 0) { @@ -329,9 +329,9 @@ namespace LeanCloud.Realtime { } /// - /// 将用户加入黑名单 + /// Adds members to the blocklist of this conversation. /// - /// + /// Member list. /// public async Task BlockMembers(IEnumerable clientIds) { if (clientIds == null || clientIds.Count() == 0) { @@ -341,9 +341,9 @@ namespace LeanCloud.Realtime { } /// - /// 将用户移除黑名单 + /// Removes members from the blocklist of this conversation. /// - /// + /// Member list. /// public async Task UnblockMembers(IEnumerable clientIds) { if (clientIds == null || clientIds.Count() == 0) { @@ -353,9 +353,9 @@ namespace LeanCloud.Realtime { } /// - /// 撤回消息 + /// Recalls a sent message. /// - /// + /// The message to recall. /// public async Task RecallMessage(LCIMMessage message) { if (message == null) { @@ -365,10 +365,10 @@ namespace LeanCloud.Realtime { } /// - /// 修改消息 + /// Updates a sent message. /// - /// - /// + /// The message to update. + /// The updated message. /// public async Task UpdateMessage(LCIMMessage oldMessage, LCIMMessage newMessage) { if (oldMessage == null) { @@ -381,10 +381,10 @@ namespace LeanCloud.Realtime { } /// - /// 更新对话中成员的角色 + /// Updates the role of a member of this conversation. /// - /// - /// + /// The member to update. + /// The new role of the member. /// public async Task UpdateMemberRole(string memberId, string role) { if (string.IsNullOrEmpty(memberId)) { @@ -397,7 +397,7 @@ namespace LeanCloud.Realtime { } /// - /// 获取对话中成员的角色(只返回管理员) + /// Gets all member roles. /// /// public async Task> GetAllMemberInfo() { @@ -405,9 +405,9 @@ namespace LeanCloud.Realtime { } /// - /// 获取对话中指定成员的角色 + /// Gets the role of a specific member. /// - /// + /// The member to query. /// public async Task GetMemberInfo(string memberId) { if (string.IsNullOrEmpty(memberId)) { @@ -423,10 +423,10 @@ namespace LeanCloud.Realtime { } /// - /// 查询禁言用户 + /// Queries muted members. /// - /// - /// + /// Limits the number of returned results. + /// Can be used for pagination with the limit parameter. /// public async Task QueryMutedMembers(int limit = 10, string next = null) { @@ -434,10 +434,10 @@ namespace LeanCloud.Realtime { } /// - /// 查询黑名单用户 + /// Queries blocked members. /// - /// 限制 - /// 其实用户 Id + /// Limits the number of returned results. + /// Can be used for pagination with the limit parameter. /// public async Task QueryBlockedMembers(int limit = 10, string next = null) { @@ -445,13 +445,13 @@ namespace LeanCloud.Realtime { } /// - /// 查询聊天记录 + /// Retrieves messages. /// - /// 起点 - /// 终点 - /// 查找方向 - /// 限制 - /// 消息类型 + /// Start message ID. + /// End message ID. + /// Query direction (defaults to NewToOld). + /// Limits the number of returned results. Its default value is 20. + /// The message type to query. The default value is 0 (text message). /// public async Task> QueryMessages(LCIMMessageQueryEndpoint start = null, LCIMMessageQueryEndpoint end = null, @@ -462,7 +462,7 @@ namespace LeanCloud.Realtime { } /// - /// 获取会话已收/已读时间戳 + /// Fetches receipt timestamp. /// /// public async Task FetchReciptTimestamps() { diff --git a/Realtime/Realtime/Conversation/LCIMConversationMemberInfo.cs b/Realtime/Realtime/Conversation/LCIMConversationMemberInfo.cs index 5809dec..48e4324 100644 --- a/Realtime/Realtime/Conversation/LCIMConversationMemberInfo.cs +++ b/Realtime/Realtime/Conversation/LCIMConversationMemberInfo.cs @@ -1,18 +1,9 @@ namespace LeanCloud.Realtime { public class LCIMConversationMemberInfo { - /// - /// 群主 - /// public const string Owner = "Owner"; - /// - /// 管理员 - /// public const string Manager = "Manager"; - /// - /// 成员 - /// public const string Member = "Member"; public string ConversationId { diff --git a/Realtime/Realtime/Conversation/LCIMConversationQuery.cs b/Realtime/Realtime/Conversation/LCIMConversationQuery.cs index 700ba8d..bc66d2e 100644 --- a/Realtime/Realtime/Conversation/LCIMConversationQuery.cs +++ b/Realtime/Realtime/Conversation/LCIMConversationQuery.cs @@ -17,7 +17,7 @@ namespace LeanCloud.Realtime { } /// - /// 等于 + /// The value corresponding to key is equal to value, or the array corresponding to key contains value. /// /// /// @@ -29,7 +29,7 @@ namespace LeanCloud.Realtime { } /// - /// 不等于 + /// The value corresponding to key is not equal to value, or the array corresponding to key does not contain value. /// /// /// @@ -41,7 +41,7 @@ namespace LeanCloud.Realtime { } /// - /// 包含 + /// Values contains value corresponding to key, or values contains at least one element in the array corresponding to key. /// /// /// @@ -53,7 +53,7 @@ namespace LeanCloud.Realtime { } /// - /// 包含全部 + /// The array corresponding to key contains all elements in values. /// /// /// @@ -65,7 +65,7 @@ namespace LeanCloud.Realtime { } /// - /// 存在 + /// The attribute corresponding to key exists. /// /// /// @@ -75,7 +75,7 @@ namespace LeanCloud.Realtime { } /// - /// 不存在 + /// The attribute corresponding to key does not exist. /// /// /// @@ -85,7 +85,7 @@ namespace LeanCloud.Realtime { } /// - /// 长度等于 + /// The size of the array corresponding to key is equal to size. /// /// /// @@ -97,7 +97,7 @@ namespace LeanCloud.Realtime { } /// - /// 大于 + /// The value corresponding to key is greater than value. /// /// /// @@ -109,7 +109,7 @@ namespace LeanCloud.Realtime { } /// - /// 大于等于 + /// The value corresponding to key is greater than or equal to value. /// /// /// @@ -121,7 +121,7 @@ namespace LeanCloud.Realtime { } /// - /// 小于 + /// The value corresponding to key is less than value. /// /// /// @@ -133,7 +133,7 @@ namespace LeanCloud.Realtime { } /// - /// 小于等于 + /// The value corresponding to key is less than or equal to value. /// /// /// @@ -145,7 +145,7 @@ namespace LeanCloud.Realtime { } /// - /// 前缀 + /// The string corresponding to key has a prefix. /// /// /// @@ -157,7 +157,7 @@ namespace LeanCloud.Realtime { } /// - /// 后缀 + /// The string corresponding to key has a suffix. /// /// /// @@ -168,7 +168,7 @@ namespace LeanCloud.Realtime { } /// - /// 字符串包含 + /// The string corresponding to key has a subString. /// /// /// @@ -179,9 +179,9 @@ namespace LeanCloud.Realtime { } /// - /// 按 key 升序 + /// The ascending order by the value corresponding to key. /// - /// + /// Multi-field sorting is supported with comma. /// public LCIMConversationQuery OrderBy(string key) { Condition.OrderByAscending(key); @@ -189,9 +189,9 @@ namespace LeanCloud.Realtime { } /// - /// 按 key 降序 + /// The descending order by the value corresponding to key. /// - /// + /// Multi-field sorting is supported with comma. /// public LCIMConversationQuery OrderByDescending(string key) { Condition.OrderByDescending(key); @@ -199,7 +199,7 @@ namespace LeanCloud.Realtime { } /// - /// 拉取 key 的完整对象 + /// Includes nested LCObject for the provided key. /// /// /// @@ -209,7 +209,7 @@ namespace LeanCloud.Realtime { } /// - /// 包含 key + /// Restricts the keys of the LCObject returned. /// /// /// @@ -219,7 +219,7 @@ namespace LeanCloud.Realtime { } /// - /// 跳过 + /// Sets the amount of results to skip before returning any results. /// /// /// @@ -229,7 +229,7 @@ namespace LeanCloud.Realtime { } /// - /// 限制数量 + /// Sets the limit of the number of results to return. /// /// /// @@ -243,7 +243,7 @@ namespace LeanCloud.Realtime { } /// - /// 查找 + /// Retrieves a list of LCObjects matching this query. /// /// public async Task> Find() { diff --git a/Realtime/Realtime/Conversation/LCIMServiceConversation.cs b/Realtime/Realtime/Conversation/LCIMServiceConversation.cs index 93e8da2..b2159a6 100644 --- a/Realtime/Realtime/Conversation/LCIMServiceConversation.cs +++ b/Realtime/Realtime/Conversation/LCIMServiceConversation.cs @@ -2,9 +2,6 @@ using System.Threading.Tasks; namespace LeanCloud.Realtime { - /// - /// 系统对话 - /// public class LCIMServiceConversation : LCIMConversation { public LCIMServiceConversation(LCIMClient client) : base(client) { } diff --git a/Realtime/Realtime/Conversation/LCIMTemporaryConversation.cs b/Realtime/Realtime/Conversation/LCIMTemporaryConversation.cs index 01f20ad..3fc19c3 100644 --- a/Realtime/Realtime/Conversation/LCIMTemporaryConversation.cs +++ b/Realtime/Realtime/Conversation/LCIMTemporaryConversation.cs @@ -1,20 +1,11 @@ using System; namespace LeanCloud.Realtime { - /// - /// 临时对话 - /// public class LCIMTemporaryConversation : LCIMConversation { - /// - /// 过期时间 - /// public DateTime ExpiredAt { get; } - /// - /// 是否过期 - /// public bool IsExpired { get { return DateTime.Now > ExpiredAt; diff --git a/Realtime/Realtime/Internal/Connection/LCConnection.cs b/Realtime/Realtime/Internal/Connection/LCConnection.cs index 1e7732a..6073502 100644 --- a/Realtime/Realtime/Internal/Connection/LCConnection.cs +++ b/Realtime/Realtime/Internal/Connection/LCConnection.cs @@ -10,7 +10,7 @@ using LeanCloud.Realtime.Internal.Protocol; namespace LeanCloud.Realtime.Internal.Connection { /// - /// 连接层,只与数据协议相关 + /// Connection layer /// public class LCConnection { // 请求/应答比对,即 I 相等 @@ -24,53 +24,29 @@ namespace LeanCloud.Realtime.Internal.Connection { } } - /// - /// 连接状态 - /// enum State { /// - /// 初始状态 + /// Initial /// None, - /// - /// 连接中 - /// Connecting, /// - /// 连接成功 + /// Connected /// Open, - /// - /// 关闭的 - /// Closed, } - /// - /// 发送超时 - /// private const int SEND_TIMEOUT = 10000; - /// - /// 最大重连次数,超过后重置 Router 缓存后再次尝试重连 - /// private const int MAX_RECONNECT_TIMES = 10; - /// - /// 重连间隔 - /// private const int RECONNECT_INTERVAL = 10000; - /// - /// 子协议 - /// private const string SUB_PROTOCOL = "lc.protobuf2.3"; internal string id; - /// - /// 请求回调缓存 - /// private readonly Dictionary> requestToResponses; private int requestI = 1; @@ -134,11 +110,6 @@ namespace LeanCloud.Realtime.Internal.Connection { } } - /// - /// 发送请求,会在收到应答后返回 - /// - /// - /// internal async Task SendRequest(GenericCommand request) { if (IsIdempotentCommand(request)) { GenericCommand sendingReq = requestToResponses.Keys.FirstOrDefault(item => { @@ -166,11 +137,6 @@ namespace LeanCloud.Realtime.Internal.Connection { return await tcs.Task; } - /// - /// 发送命令 - /// - /// - /// internal async Task SendCommand(GenericCommand command) { LCLogger.Debug($"{id} => {FormatCommand(command)}"); byte[] bytes = command.ToByteArray(); @@ -182,9 +148,6 @@ namespace LeanCloud.Realtime.Internal.Connection { } } - /// - /// 断开连接 - /// private void Disconnect() { state = State.Closed; heartBeat.Stop(); @@ -194,10 +157,6 @@ namespace LeanCloud.Realtime.Internal.Connection { } } - /// - /// 消息接收回调 - /// - /// private void OnMessage(byte[] bytes) { try { GenericCommand command = GenericCommand.Parser.ParseFrom(bytes); @@ -241,18 +200,11 @@ namespace LeanCloud.Realtime.Internal.Connection { } } - /// - /// 连接断开回调 - /// private void OnDisconnect() { Disconnect(); _ = Reconnect(); } - /// - /// 重置连接 - /// - /// internal void Reset() { Disconnect(); // 重新创建连接组件 @@ -318,16 +270,10 @@ namespace LeanCloud.Realtime.Internal.Connection { } } - /// - /// 暂停连接 - /// internal void Pause() { Disconnect(); } - /// - /// 恢复连接 - /// internal void Resume() { _ = Reconnect(); } diff --git a/Realtime/Realtime/Internal/Connection/LCHeartBeat.cs b/Realtime/Realtime/Internal/Connection/LCHeartBeat.cs index bd62a3b..d82e53e 100644 --- a/Realtime/Realtime/Internal/Connection/LCHeartBeat.cs +++ b/Realtime/Realtime/Internal/Connection/LCHeartBeat.cs @@ -5,10 +5,11 @@ using LeanCloud.Realtime.Internal.Protocol; namespace LeanCloud.Realtime.Internal.Connection { /// - /// 心跳控制器,由于 .Net Standard 2.0 不支持发送 ping frame,所以需要发送逻辑心跳 - /// 1. 每隔 180s 发送 ping 包 - /// 2. 接收到 pong 包刷新上次 pong 时间 - /// 3. 每隔 180s 检测 pong 包间隔,超过 360s 则认为断开 + /// Heartbeat controller is needed because .Net Standard 2.0 does not support sending ping frame. + /// 1. Ping every 180 seconds. + /// 2. Receiving a pong packet will refresh the pong interval. + /// 3. Check pong interval every 180 seconds. + /// If the interval is greater than 360 seconds, the connection is considered disconnected. /// public class LCHeartBeat { private const int PING_INTERVAL = 180 * 1000; @@ -32,9 +33,6 @@ namespace LeanCloud.Realtime.Internal.Connection { this.connection = connection; } - /// - /// 启动心跳 - /// public void Start() { running = true; heartBeatCTS = new CancellationTokenSource(); @@ -92,9 +90,6 @@ namespace LeanCloud.Realtime.Internal.Connection { lastPongTime = DateTimeOffset.Now; } - /// - /// 停止心跳监听 - /// public void Stop() { running = false; heartBeatCTS.Cancel(); diff --git a/Realtime/Realtime/Internal/Controller/LCIMConversationController.cs b/Realtime/Realtime/Internal/Controller/LCIMConversationController.cs index b2f288f..fac4d49 100644 --- a/Realtime/Realtime/Internal/Controller/LCIMConversationController.cs +++ b/Realtime/Realtime/Internal/Controller/LCIMConversationController.cs @@ -16,17 +16,6 @@ namespace LeanCloud.Realtime.Internal.Controller { #region 内部接口 - /// - /// 创建对话 - /// - /// - /// - /// - /// - /// - /// - /// - /// internal async Task CreateConv( IEnumerable members = null, string name = null, @@ -94,11 +83,7 @@ namespace LeanCloud.Realtime.Internal.Controller { return conversation; } - /// - /// 查询成员数量 - /// - /// - /// +> internal async Task GetMembersCount(string convId) { ConvCommand conv = new ConvCommand { Cid = convId, @@ -109,12 +94,7 @@ namespace LeanCloud.Realtime.Internal.Controller { return response.ConvMessage.Count; } - /// - /// 更新对话属性 - /// - /// - /// - /// + internal async Task> UpdateInfo(string convId, Dictionary attributes) { ConvCommand conv = new ConvCommand { @@ -135,12 +115,7 @@ namespace LeanCloud.Realtime.Internal.Controller { return null; } - /// - /// 增加成员 - /// - /// - /// - /// +> internal async Task AddMembers(string convId, IEnumerable clientIds) { ConvCommand conv = new ConvCommand { @@ -165,12 +140,7 @@ namespace LeanCloud.Realtime.Internal.Controller { return NewPartiallySuccessResult(allowedIds, errors); } - /// - /// 移除成员 - /// - /// - /// - /// + internal async Task RemoveMembers(string convId, IEnumerable removeIds) { ConvCommand conv = new ConvCommand { @@ -195,11 +165,7 @@ namespace LeanCloud.Realtime.Internal.Controller { return NewPartiallySuccessResult(allowedIds, errors); } - /// - /// 静音 - /// - /// - /// + internal async Task Mute(string convId) { ConvCommand conv = new ConvCommand { Cid = convId @@ -209,11 +175,6 @@ namespace LeanCloud.Realtime.Internal.Controller { await Connection.SendRequest(request); } - /// - /// 解除静音 - /// - /// - /// internal async Task Unmute(string convId) { ConvCommand conv = new ConvCommand { Cid = convId @@ -223,12 +184,6 @@ namespace LeanCloud.Realtime.Internal.Controller { await Connection.SendRequest(request); } - /// - /// 禁言用户 - /// - /// - /// - /// internal async Task MuteMembers(string convId, IEnumerable clientIds) { if (clientIds == null || clientIds.Count() == 0) { @@ -244,12 +199,7 @@ namespace LeanCloud.Realtime.Internal.Controller { return NewPartiallySuccessResult(response.ConvMessage.AllowedPids, response.ConvMessage.FailedPids); } - /// - /// 解除用户禁言 - /// - /// - /// - /// + internal async Task UnmuteMembers(string convId, IEnumerable clientIds) { ConvCommand conv = new ConvCommand { @@ -262,12 +212,7 @@ namespace LeanCloud.Realtime.Internal.Controller { return NewPartiallySuccessResult(response.ConvMessage.AllowedPids, response.ConvMessage.FailedPids); } - /// - /// 拉黑成员 - /// - /// - /// - /// + internal async Task BlockMembers(string convId, IEnumerable clientIds) { BlacklistCommand blacklist = new BlacklistCommand { @@ -289,12 +234,7 @@ namespace LeanCloud.Realtime.Internal.Controller { return NewPartiallySuccessResult(response.BlacklistMessage.AllowedPids, response.BlacklistMessage.FailedPids); } - /// - /// 移除成员黑名单 - /// - /// - /// - /// +> internal async Task UnblockMembers(string convId, IEnumerable clientIds) { BlacklistCommand blacklist = new BlacklistCommand { @@ -316,13 +256,7 @@ namespace LeanCloud.Realtime.Internal.Controller { return NewPartiallySuccessResult(response.BlacklistMessage.AllowedPids, response.BlacklistMessage.FailedPids); } - /// - /// 修改成员角色 - /// - /// - /// - /// - /// +> internal async Task UpdateMemberRole(string convId, string memberId, string role) { @@ -339,11 +273,7 @@ namespace LeanCloud.Realtime.Internal.Controller { GenericCommand response = await Connection.SendRequest(request); } - /// - /// 获取所有成员角色 - /// - /// - /// + internal async Task> GetAllMemberInfo(string convId) { string path = "classes/_ConversationMemberInfo"; string token = await Client.SessionController.GetToken(); @@ -367,13 +297,7 @@ namespace LeanCloud.Realtime.Internal.Controller { }).ToList().AsReadOnly(); } - /// - /// 查询禁言成员 - /// - /// - /// - /// - /// + internal async Task QueryMutedMembers(string convId, int limit = 10, string next = null) { @@ -392,14 +316,7 @@ namespace LeanCloud.Realtime.Internal.Controller { Next = response.ConvMessage.Next }; } - - /// - /// 查询黑名单用户 - /// - /// - /// - /// - /// +> internal async Task QueryBlockedMembers(string convId, int limit = 10, string next = null) { @@ -419,11 +336,7 @@ namespace LeanCloud.Realtime.Internal.Controller { }; } - /// - /// 查找 - /// - /// - /// + internal async Task> Find(LCIMConversationQuery query) { GenericCommand command = new GenericCommand { Cmd = CommandType.Conv, @@ -468,11 +381,7 @@ namespace LeanCloud.Realtime.Internal.Controller { }).ToList().AsReadOnly(); } - /// - /// 获取临时对话 - /// - /// - /// + internal async Task> GetTemporaryConversations(IEnumerable convIds) { if (convIds == null || convIds.Count() == 0) { return null; @@ -493,11 +402,7 @@ namespace LeanCloud.Realtime.Internal.Controller { return convList; } - /// - /// 拉取对话接收/已读情况 - /// - /// - /// + internal async Task FetchReciptTimestamp(string convId) { ConvCommand convCommand = new ConvCommand { Cid = convId @@ -511,12 +416,7 @@ namespace LeanCloud.Realtime.Internal.Controller { conversation.LastReadTimestamp = convCommand.MaxReadTimestamp; } - /// - /// 获取在线成员 - /// - /// - /// - /// + internal async Task> GetOnlineMembers(string convId, int limit) { ConvCommand conv = new ConvCommand { @@ -531,11 +431,7 @@ namespace LeanCloud.Realtime.Internal.Controller { return members; } - /// - /// 查询是否订阅 - /// - /// - /// + internal async Task CheckSubscription(string convId) { ConvCommand conv = new ConvCommand(); conv.Cids.Add(convId); @@ -666,21 +562,13 @@ namespace LeanCloud.Realtime.Internal.Controller { } } - /// - /// 当前用户加入会话 - /// - /// - /// + private async Task OnJoined(ConvCommand convMessage) { LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid); Client.OnInvited?.Invoke(conversation, convMessage.InitBy); } - /// - /// 有用户加入会话 - /// - /// - /// + private async Task OnMembersJoined(ConvCommand convMessage) { LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid); ReadOnlyCollection joinedIds = new ReadOnlyCollection(convMessage.M); @@ -688,11 +576,7 @@ namespace LeanCloud.Realtime.Internal.Controller { Client.OnMembersJoined?.Invoke(conversation, joinedIds, convMessage.InitBy); } - /// - /// 当前用户离开会话 - /// - /// - /// + private async Task OnLeft(ConvCommand convMessage) { LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid); // 从内存中清除对话 @@ -700,11 +584,6 @@ namespace LeanCloud.Realtime.Internal.Controller { Client.OnKicked?.Invoke(conversation, convMessage.InitBy); } - /// - /// 有成员离开会话 - /// - /// - /// private async Task OnMemberLeft(ConvCommand convMessage) { LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid); ReadOnlyCollection leftIdList = new ReadOnlyCollection(convMessage.M); @@ -712,31 +591,19 @@ namespace LeanCloud.Realtime.Internal.Controller { Client.OnMembersLeft?.Invoke(conversation, leftIdList, convMessage.InitBy); } - /// - /// 当前用户被禁言 - /// - /// - /// + private async Task OnMuted(ConvCommand convMessage) { LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid); Client.OnMuted?.Invoke(conversation, convMessage.InitBy); } - /// - /// 当前用户被解除禁言 - /// - /// - /// + private async Task OnUnmuted(ConvCommand convMessage) { LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid); Client.OnUnmuted?.Invoke(conversation, convMessage.InitBy); } - /// - /// 有成员被禁言 - /// - /// - /// + private async Task OnMembersMuted(ConvCommand convMessage) { LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid); ReadOnlyCollection mutedMemberIds = new ReadOnlyCollection(convMessage.M); @@ -744,11 +611,7 @@ namespace LeanCloud.Realtime.Internal.Controller { Client.OnMembersMuted?.Invoke(conversation, mutedMemberIds, convMessage.InitBy); } - /// - /// 有成员被解除禁言 - /// - /// - /// + private async Task OnMembersUnmuted(ConvCommand convMessage) { LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid); ReadOnlyCollection unmutedMemberIds = new ReadOnlyCollection(convMessage.M); @@ -756,53 +619,31 @@ namespace LeanCloud.Realtime.Internal.Controller { Client.OnMembersUnmuted?.Invoke(conversation, unmutedMemberIds, convMessage.InitBy); } - /// - /// 当前用户被拉黑 - /// - /// - /// private async Task OnBlocked(ConvCommand convMessage) { LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid); Client.OnBlocked?.Invoke(conversation, convMessage.InitBy); } - /// - /// 当前用户被解除黑名单 - /// - /// - /// + private async Task OnUnblocked(ConvCommand convMessage) { LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid); Client.OnUnblocked?.Invoke(conversation, convMessage.InitBy); } - /// - /// 有用户被拉黑 - /// - /// - /// + private async Task OnMembersBlocked(ConvCommand convMessage) { LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid); ReadOnlyCollection blockedMemberIds = convMessage.M.ToList().AsReadOnly(); Client.OnMembersBlocked?.Invoke(conversation, blockedMemberIds, convMessage.InitBy); } - /// - /// 有用户被移除黑名单 - /// - /// - /// + private async Task OnMembersUnblocked(ConvCommand convMessage) { LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid); ReadOnlyCollection unblockedMemberIds = convMessage.M.ToList().AsReadOnly(); Client.OnMembersUnblocked?.Invoke(conversation, unblockedMemberIds, convMessage.InitBy); } - /// - /// 对话属性被修改 - /// - /// - /// private async Task OnPropertiesUpdated(ConvCommand conv) { LCIMConversation conversation = await Client.GetOrQueryConversation(conv.Cid); Dictionary updatedAttr = JsonConvert.DeserializeObject>(conv.AttrModified.Data, @@ -814,11 +655,7 @@ namespace LeanCloud.Realtime.Internal.Controller { conv.InitBy); } - /// - /// 用户角色被修改 - /// - /// - /// + private async Task OnMemberInfoChanged(ConvCommand conv) { LCIMConversation conversation = await Client.GetOrQueryConversation(conv.Cid); ConvMemberInfo memberInfo = conv.Info; diff --git a/Realtime/Realtime/Internal/Controller/LCIMMessageController.cs b/Realtime/Realtime/Internal/Controller/LCIMMessageController.cs index cec51cc..97a2dcd 100644 --- a/Realtime/Realtime/Internal/Controller/LCIMMessageController.cs +++ b/Realtime/Realtime/Internal/Controller/LCIMMessageController.cs @@ -14,12 +14,7 @@ namespace LeanCloud.Realtime.Internal.Controller { #region 内部接口 - /// - /// 发送消息 - /// - /// - /// - /// + internal async Task Send(string convId, LCIMMessage message, LCIMMessageSendOptions options) { @@ -74,12 +69,7 @@ namespace LeanCloud.Realtime.Internal.Controller { return message; } - /// - /// 撤回消息 - /// - /// - /// - /// + internal async Task RecallMessage(string convId, LCIMMessage message) { PatchCommand patch = new PatchCommand(); @@ -97,13 +87,6 @@ namespace LeanCloud.Realtime.Internal.Controller { await Connection.SendRequest(request); } - /// - /// 修改消息 - /// - /// - /// - /// - /// internal async Task UpdateMessage(string convId, LCIMMessage oldMessage, LCIMMessage newMessage) { @@ -133,16 +116,6 @@ namespace LeanCloud.Realtime.Internal.Controller { GenericCommand response = await Connection.SendRequest(request); } - /// - /// 查询消息 - /// - /// - /// - /// - /// - /// - /// - /// internal async Task> QueryMessages(string convId, LCIMMessageQueryEndpoint start = null, LCIMMessageQueryEndpoint end = null, @@ -197,12 +170,7 @@ namespace LeanCloud.Realtime.Internal.Controller { }).ToList().AsReadOnly(); } - /// - /// 确认收到消息 - /// - /// - /// - /// + internal async Task Ack(string convId, string msgId) { AckCommand ack = new AckCommand { @@ -214,12 +182,6 @@ namespace LeanCloud.Realtime.Internal.Controller { await Connection.SendCommand(command); } - /// - /// 确认已读消息 - /// - /// - /// - /// internal async Task Read(string convId, LCIMMessage msg) { ReadCommand read = new ReadCommand(); @@ -248,11 +210,7 @@ namespace LeanCloud.Realtime.Internal.Controller { } } - /// - /// 接收消息事件 - /// - /// - /// + private async Task OnMessaage(GenericCommand notification) { DirectCommand direct = notification.DirectMessage; // 反序列化消息 @@ -288,11 +246,7 @@ namespace LeanCloud.Realtime.Internal.Controller { Client.OnMessage?.Invoke(conversation, message); } - /// - /// 消息被修改事件 - /// - /// - /// + private async Task OnMessagePatched(GenericCommand notification) { PatchCommand patchMessage = notification.PatchMessage; foreach (PatchItem patch in patchMessage.Patches) { @@ -320,11 +274,7 @@ namespace LeanCloud.Realtime.Internal.Controller { } } - /// - /// 消息回执事件 - /// - /// - /// + private async Task OnMessageReceipt(GenericCommand notification) { RcpCommand rcp = notification.RcpMessage; string convId = rcp.Cid; diff --git a/Realtime/Realtime/Internal/Controller/LCIMSessionController.cs b/Realtime/Realtime/Internal/Controller/LCIMSessionController.cs index 81e1861..8fd3072 100644 --- a/Realtime/Realtime/Internal/Controller/LCIMSessionController.cs +++ b/Realtime/Realtime/Internal/Controller/LCIMSessionController.cs @@ -15,10 +15,7 @@ namespace LeanCloud.Realtime.Internal.Controller { #region 内部接口 - /// - /// 打开会话 - /// - /// + internal async Task Open(bool force) { await Connection.Connect(); @@ -32,10 +29,6 @@ namespace LeanCloud.Realtime.Internal.Controller { Connection.Register(Client); } - /// - /// 重新打开会话,重连时调用 - /// - /// internal async Task Reopen() { SessionCommand session = await NewSessionCommand(); session.R = true; @@ -49,20 +42,14 @@ namespace LeanCloud.Realtime.Internal.Controller { } } - /// - /// 关闭会话 - /// - /// + internal async Task Close() { GenericCommand request = NewCommand(CommandType.Session, OpType.Close); await Connection.SendRequest(request); Connection.UnRegister(Client); } - /// - /// 获取可用 token - /// - /// + internal async Task GetToken() { if (IsExpired) { await Refresh(); @@ -134,11 +121,7 @@ namespace LeanCloud.Realtime.Internal.Controller { } } - /// - /// 被关闭 - /// - /// - /// + private void OnClosed(SessionCommand session) { int code = session.Code; string reason = session.Reason; diff --git a/Realtime/Realtime/Internal/Router/LCRTMRouter.cs b/Realtime/Realtime/Internal/Router/LCRTMRouter.cs index c1207b0..b818823 100644 --- a/Realtime/Realtime/Internal/Router/LCRTMRouter.cs +++ b/Realtime/Realtime/Internal/Router/LCRTMRouter.cs @@ -5,13 +5,8 @@ using LeanCloud.Common; using Newtonsoft.Json; namespace LeanCloud.Realtime.Internal.Router { - /// - /// RTM Router - /// + public class LCRTMRouter { - /// - /// 请求超时 - /// private const int REQUEST_TIMEOUT = 10000; private LCRTMServer rtmServer; @@ -19,10 +14,6 @@ namespace LeanCloud.Realtime.Internal.Router { public LCRTMRouter() { } - /// - /// 获取服务器地址 - /// - /// public async Task GetServer() { if (rtmServer == null || !rtmServer.IsValid) { await Fetch(); diff --git a/Realtime/Realtime/Internal/WebSocket/LCWebSocketClient.cs b/Realtime/Realtime/Internal/WebSocket/LCWebSocketClient.cs index ab4277f..1a6e5e4 100644 --- a/Realtime/Realtime/Internal/WebSocket/LCWebSocketClient.cs +++ b/Realtime/Realtime/Internal/WebSocket/LCWebSocketClient.cs @@ -4,40 +4,20 @@ using System.Net.WebSockets; using System.Text; namespace LeanCloud.Realtime.Internal.WebSocket { - /// - /// WebSocket 客户端,负责底层连接和事件,只与通信协议相关 - /// public class LCWebSocketClient { // .net standard 2.0 好像在拼合 Frame 时有 bug,所以将这个值调整大一些 private const int RECV_BUFFER_SIZE = 1024 * 5; - /// - /// 关闭超时 - /// private const int CLOSE_TIMEOUT = 5000; - /// - /// 连接超时 - /// private const int CONNECT_TIMEOUT = 10000; - /// - /// 消息事件 - /// public Action OnMessage; - /// - /// 连接关闭 - /// public Action OnClose; private ClientWebSocket ws; - /// - /// 连接指定 ws 服务器 - /// - /// - /// public async Task Connect(string server, string subProtocol = null) { LCLogger.Debug($"Connecting WebSocket: {server}"); @@ -57,10 +37,6 @@ namespace LeanCloud.Realtime.Internal.WebSocket { } } - /// - /// 主动关闭连接 - /// - /// public async Task Close() { LCLogger.Debug("Closing WebSocket"); OnMessage = null; @@ -80,11 +56,6 @@ namespace LeanCloud.Realtime.Internal.WebSocket { } } - /// - /// 发送二进制数据 - /// - /// - /// public async Task Send(byte[] data, WebSocketMessageType messageType = WebSocketMessageType.Binary) { ArraySegment bytes = new ArraySegment(data); @@ -102,19 +73,10 @@ namespace LeanCloud.Realtime.Internal.WebSocket { } } - /// - /// 发送文本数据 - /// - /// - /// public async Task Send(string text) { await Send(Encoding.UTF8.GetBytes(text), WebSocketMessageType.Text); } - /// - /// 接收数据 - /// - /// private async Task StartReceive() { byte[] buffer = new byte[RECV_BUFFER_SIZE]; try { diff --git a/Realtime/Realtime/LCIMClient.cs b/Realtime/Realtime/LCIMClient.cs index 6e08d3c..f88f296 100644 --- a/Realtime/Realtime/LCIMClient.cs +++ b/Realtime/Realtime/LCIMClient.cs @@ -8,39 +8,31 @@ using LeanCloud.Realtime.Internal.Protocol; using LeanCloud.Realtime.Internal.Controller; namespace LeanCloud.Realtime { - /// - /// 通信客户端 - /// + public class LCIMClient { /// - /// 对话缓存 + /// Conversation cache /// internal Dictionary ConversationDict; /// - /// 用户 Id + /// Client Id /// public string Id { get; private set; } /// - /// 用户标识 + /// Client tag /// public string Tag { get; private set; } - /// - /// 设备 Id - /// public string DeviceId { get; private set; } - /// - /// 登录 tokens - /// internal string SessionToken { get; private set; } @@ -50,21 +42,22 @@ namespace LeanCloud.Realtime { #region 连接状态事件 /// - /// 客户端连接断开 + /// Occurs when the connection is lost. /// public Action OnPaused { get; set; } /// - /// 客户端连接恢复正常 + /// Occurs when the connection is recovered. /// public Action OnResume { get; set; } /// - /// 当前客户端被服务端强行下线 + /// Occurs when the connection is closed and there will be no auto reconnection. + /// Possible causes include there is a single device login conflict or the client has been kicked off by the server. /// public Action OnClose { get; set; @@ -75,92 +68,92 @@ namespace LeanCloud.Realtime { #region 对话事件 /// - /// 当前用户被加入某个对话的黑名单 + /// Occurs when the current user is added into the blacklist of a conversation. /// public Action OnBlocked { get; set; } /// - /// 当用户被解除黑名单 + /// Occurs when the current user is removed from the blacklist of a conversation. /// public Action OnUnblocked { get; set; } /// - /// 当前用户在某个对话中被禁言 + /// Occurs when the current user is muted in a conversation. /// public Action OnMuted; /// - /// 当前用户在某个对话中被解除禁言 + /// Occurs when the current user is unmuted in a conversation. /// public Action OnUnmuted; /// - /// 该对话信息被更新 + /// Occurs when the properties of a conversation are updated. /// public Action, string> OnConversationInfoUpdated; /// - /// 当前用户被添加至某个对话 + /// Occurs when the current user is invited to a conversation. /// public Action OnInvited { get; set; } /// - /// 当前用户被从某个对话中移除 + /// Occurs when the current user is kicked from a conversation. /// public Action OnKicked { get; set; } /// - /// 有用户被添加至某个对话 + /// Occurs when a user joined a conversation. /// public Action, string> OnMembersJoined { get; set; } /// - /// 有成员被从某个对话中移除 + /// Occurs when a user left a conversation. /// public Action, string> OnMembersLeft { get; set; } /// - /// 有成员被加入某个对话的黑名单 + /// Occurs when a user is added to the blacklist of a conversation. /// public Action, string> OnMembersBlocked { get; set; } /// - /// 有成员被移出某个对话的黑名单 + /// Occurs when a user is removed from the blacklist of a conversation. /// public Action, string> OnMembersUnblocked { get; set; } /// - /// 有成员在某个对话中被禁言 + /// Occurs when a user is muted in a conversation. /// public Action, string> OnMembersMuted { get; set; } /// - /// 有成员被移出某个对话的黑名单 + /// Occurs when a user is unmuted in a conversation. /// public Action, string> OnMembersUnmuted { get; set; } /// - /// 有成员的对话信息被更新 + /// Occurs when the properties of someone are updated. /// public Action OnMemberInfoUpdated; @@ -169,56 +162,56 @@ namespace LeanCloud.Realtime { #region 消息事件 /// - /// 当前用户收到消息 + /// Occurs when a new message is delivered to a conversation the current user is already in. /// public Action OnMessage { get; set; } /// - /// 消息被撤回 + /// Occurs when a message is recalled. /// public Action OnMessageRecalled { get; set; } /// - /// 消息被修改 + /// Occurs when a message is updated. /// public Action OnMessageUpdated { get; set; } /// - /// 消息已送达 + /// Occurs when a message is delivered. /// public Action OnMessageDelivered { get; set; } /// - /// 消息已读 + /// Occurs when a message is read. /// public Action OnMessageRead { get; set; } /// - /// 未读消息数目更新 + /// Occurs when the number of unreadMessagesCount is updatded. /// public Action> OnUnreadMessagesCountUpdated { get; set; } /// - /// 最近分发消息更新 + /// Occurs when the last delivered message is updated. /// public Action OnLastDeliveredAtUpdated { get; set; } /// - /// 最近已读消息更新 + /// Occurs when the last delivered message is updated. /// public Action OnLastReadAtUpdated { get; set; @@ -289,9 +282,9 @@ namespace LeanCloud.Realtime { } /// - /// 登录 + /// Signing in /// - /// 是否强制登录 + /// If this is ture (default value), and single device sign-on is enabled, users already logged in on another device with the same tag will be logged out. /// public async Task Open(bool force = true) { try { @@ -305,7 +298,7 @@ namespace LeanCloud.Realtime { } /// - /// 关闭 + /// Closes the session /// /// public async Task Close() { @@ -314,12 +307,14 @@ namespace LeanCloud.Realtime { } /// - /// 创建普通对话 + /// Creates a conversation /// - /// - /// - /// - /// + /// The list of clientIds of participants in this conversation (except the creator) + /// The name of this conversation + /// Whether this conversation is unique; + /// if it is true and an existing conversation contains the same composition of members, + /// the existing conversation will be reused, otherwise a new conversation will be created. + /// Custom attributes of this conversation /// public async Task CreateConversation( IEnumerable members, @@ -333,10 +328,10 @@ namespace LeanCloud.Realtime { } /// - /// 创建聊天室 + /// Creates a chatroom /// - /// - /// + /// The name of this chatroom + /// Custom attributes of this chatroom /// public async Task CreateChatRoom( string name, @@ -348,11 +343,11 @@ namespace LeanCloud.Realtime { } /// - /// 创建临时对话 + /// Creates a temporary conversation /// - /// - /// - /// + /// The list of clientIds of participants in this temporary conversation (except the creator) + /// TTL of this temporary conversation + /// Custom attributes of this temporary conversation /// public async Task CreateTemporaryConversation( IEnumerable members, @@ -366,9 +361,9 @@ namespace LeanCloud.Realtime { } /// - /// 根据 id 获取对话 + /// Queries a conversation based on its id. /// - /// + /// objectId /// public async Task GetConversation(string id) { if (string.IsNullOrEmpty(id)) { @@ -392,9 +387,9 @@ namespace LeanCloud.Realtime { } /// - /// 获取某些特定的对话 + /// Queries conversations based on their ids. /// - /// + /// objectId list /// public async Task> GetConversationList(IEnumerable ids) { if (ids == null || ids.Count() == 0) { @@ -423,7 +418,7 @@ namespace LeanCloud.Realtime { } /// - /// 获取对话查询对象 + /// Constructs a conversation query. /// /// public LCIMConversationQuery GetQuery() { diff --git a/Realtime/Realtime/LCRealtime.cs b/Realtime/Realtime/LCRealtime.cs index 612650e..08d7c19 100644 --- a/Realtime/Realtime/LCRealtime.cs +++ b/Realtime/Realtime/LCRealtime.cs @@ -4,14 +4,14 @@ using LeanCloud.Realtime.Internal.Connection; namespace LeanCloud.Realtime { public class LCRealtime { /// - /// RTM 服务中,每个 app 对应一条连接 + /// Every application uses a connection. /// private static readonly Dictionary appToConnections = new Dictionary(); /// - /// 获取对应的 Connection + /// Gets the connection. /// - /// + /// App ID of the application /// internal static LCConnection GetConnection(string appId) { if (appToConnections.TryGetValue(appId, out LCConnection connection)) { @@ -23,15 +23,15 @@ namespace LeanCloud.Realtime { } /// - /// 移除 Connection + /// Removes the connection. /// - /// + /// The LCConnection to remove internal static void RemoveConnection(LCConnection connection) { appToConnections.Remove(connection.id); } /// - /// 主动断开所有 RTM 连接 + /// Disconnects all. /// public static void Pause() { foreach (LCConnection connection in appToConnections.Values) { @@ -40,7 +40,7 @@ namespace LeanCloud.Realtime { } /// - /// 主动恢复所有 RTM 连接 + /// Reconnects all. /// public static void Resume() { foreach (LCConnection connection in appToConnections.Values) { diff --git a/Realtime/Realtime/Message/LCIMAudioMessage.cs b/Realtime/Realtime/Message/LCIMAudioMessage.cs index 830459f..cf80bec 100644 --- a/Realtime/Realtime/Message/LCIMAudioMessage.cs +++ b/Realtime/Realtime/Message/LCIMAudioMessage.cs @@ -2,13 +2,7 @@ using LeanCloud.Storage; namespace LeanCloud.Realtime { - /// - /// 音频消息 - /// public class LCIMAudioMessage : LCIMFileMessage { - /// - /// 时长 - /// public double Duration { get; private set; } diff --git a/Realtime/Realtime/Message/LCIMBinaryMessage.cs b/Realtime/Realtime/Message/LCIMBinaryMessage.cs index d8d76fa..d0af326 100644 --- a/Realtime/Realtime/Message/LCIMBinaryMessage.cs +++ b/Realtime/Realtime/Message/LCIMBinaryMessage.cs @@ -1,11 +1,5 @@ namespace LeanCloud.Realtime { - /// - /// 二进制消息 - /// public class LCIMBinaryMessage : LCIMMessage { - /// - /// 消息数据 - /// public byte[] Data { get; internal set; } diff --git a/Realtime/Realtime/Message/LCIMFileMessage.cs b/Realtime/Realtime/Message/LCIMFileMessage.cs index 0cdf93c..0f9340a 100644 --- a/Realtime/Realtime/Message/LCIMFileMessage.cs +++ b/Realtime/Realtime/Message/LCIMFileMessage.cs @@ -4,33 +4,27 @@ using System.Collections.Generic; using LeanCloud.Storage; namespace LeanCloud.Realtime { - /// - /// 文件消息 - /// public class LCIMFileMessage : LCIMTextMessage { - /// - /// 文件 - /// public LCFile File { get; set; } /// - /// 文件大小 + /// The size of the file in bytes. /// public int Size { get; private set; } /// - /// 文件扩展名 + /// The format extension of the file. /// public string Format { get; private set; } /// - /// 文件链接 + /// The URL of the file. /// public string Url { get { diff --git a/Realtime/Realtime/Message/LCIMImageMessage.cs b/Realtime/Realtime/Message/LCIMImageMessage.cs index 5bc4144..07679ed 100644 --- a/Realtime/Realtime/Message/LCIMImageMessage.cs +++ b/Realtime/Realtime/Message/LCIMImageMessage.cs @@ -2,20 +2,11 @@ using LeanCloud.Storage; namespace LeanCloud.Realtime { - /// - /// 图像消息 - /// public class LCIMImageMessage : LCIMFileMessage { - /// - /// 图像宽度 - /// public int Width { get; private set; } - /// - /// 图像高度 - /// public int Height { get; private set; } diff --git a/Realtime/Realtime/Message/LCIMLocationMessage.cs b/Realtime/Realtime/Message/LCIMLocationMessage.cs index e4454ca..44fde3b 100644 --- a/Realtime/Realtime/Message/LCIMLocationMessage.cs +++ b/Realtime/Realtime/Message/LCIMLocationMessage.cs @@ -3,13 +3,7 @@ using System.Collections.Generic; using LeanCloud.Storage; namespace LeanCloud.Realtime { - /// - /// 位置消息 - /// public class LCIMLocationMessage : LCIMTextMessage { - /// - /// 位置 - /// public LCGeoPoint Location { get; set; } diff --git a/Realtime/Realtime/Message/LCIMMessage.cs b/Realtime/Realtime/Message/LCIMMessage.cs index e62fbcb..bdf91b0 100644 --- a/Realtime/Realtime/Message/LCIMMessage.cs +++ b/Realtime/Realtime/Message/LCIMMessage.cs @@ -3,39 +3,39 @@ using System.Collections.Generic; namespace LeanCloud.Realtime { /// - /// 消息基类 + /// The base class of message. /// public abstract class LCIMMessage { /// - /// 消息所在对话 Id + /// The conversation ID this message belongs to. /// public string ConversationId { get; set; } /// - /// 消息 Id + /// The ID of this message. /// public string Id { get; set; } /// - /// 发送者 Id + /// The ID of the client who sends this message. /// public string FromClientId { get; set; } /// - /// 发送时间戳 + /// The timestamp of this message. /// public long SentTimestamp { get; internal set; } /// - /// 发送时间 + /// The sending date of this message. /// public DateTime SentAt { get { @@ -52,7 +52,7 @@ namespace LeanCloud.Realtime { } /// - /// 送达时间 + /// The delivered date of this message. /// public DateTime DeliveredAt { get { @@ -62,14 +62,14 @@ namespace LeanCloud.Realtime { } /// - /// 已读时间戳 + /// The timestamp when this message has been read by others. /// public long ReadTimestamp { get; internal set; } /// - /// 已读时间 + /// When this message has been read by others. /// public DateTime ReadAt { get { @@ -79,14 +79,14 @@ namespace LeanCloud.Realtime { } /// - /// 修改时间戳 + /// The timestamp when this message is updated. /// public long PatchedTimestamp { get; internal set; } /// - /// 修改时间 + /// When this message is updated. /// public DateTime PatchedAt { get { @@ -96,28 +96,28 @@ namespace LeanCloud.Realtime { } /// - /// 提醒成员 Id 列表 + /// The members in the conversation mentioned by this message. /// public List MentionIdList { get; set; } /// - /// 是否提醒所有人 + /// Whether all members in the conversation are mentioned by this message. /// public bool MentionAll { get; set; } /// - /// 是否提醒当前用户 + /// Whether the current user has been mentioned in this message. /// public bool Mentioned { get; internal set; } /// - /// 是否是暂态消息 + /// Indicates whether this message is transient. /// public bool IsTransient { get; internal set; diff --git a/Realtime/Realtime/Message/LCIMMessageSendOptions.cs b/Realtime/Realtime/Message/LCIMMessageSendOptions.cs index 4e61efd..194864b 100644 --- a/Realtime/Realtime/Message/LCIMMessageSendOptions.cs +++ b/Realtime/Realtime/Message/LCIMMessageSendOptions.cs @@ -2,7 +2,7 @@ namespace LeanCloud.Realtime { /// - /// 消息优先级 + /// The priority for sending messages in chatroom. /// public enum LCIMMessagePriority { Hight = 1, @@ -11,32 +11,33 @@ namespace LeanCloud.Realtime { } /// - /// 发送消息选项 + /// The options for sending message. /// public class LCIMMessageSendOptions { /// - /// 是否作为暂态消息发送 + /// Whether this is a transient message. /// public bool Transient { get; set; } /// - /// 是否需要消息回执,仅在普通对话中有效 + /// Whether receipts are needed, only for normal conversations. /// public bool Receipt { get; set; } /// - /// 是否作为遗愿消息发送 + /// Whether this is a will message, + /// which will be sent automatically when a user goes offline unexpectedly. /// public bool Will { get; set; } /// - /// 消息优先级,仅在暂态对话中有效 + /// The priority for sending messages in chatroom. /// public LCIMMessagePriority Priority { get; set; diff --git a/Realtime/Realtime/Message/LCIMRecalledMessage.cs b/Realtime/Realtime/Message/LCIMRecalledMessage.cs index 352e585..60b3211 100644 --- a/Realtime/Realtime/Message/LCIMRecalledMessage.cs +++ b/Realtime/Realtime/Message/LCIMRecalledMessage.cs @@ -1,7 +1,7 @@  namespace LeanCloud.Realtime { /// - /// 撤回消息 + /// The recall message, i.e. a message to recall a previous sent message. /// public class LCIMRecalledMessage : LCIMTypedMessage { public LCIMRecalledMessage() { diff --git a/Realtime/Realtime/Message/LCIMTextMessage.cs b/Realtime/Realtime/Message/LCIMTextMessage.cs index 2b0fb56..e9cee7b 100644 --- a/Realtime/Realtime/Message/LCIMTextMessage.cs +++ b/Realtime/Realtime/Message/LCIMTextMessage.cs @@ -1,13 +1,7 @@ using System.Collections.Generic; namespace LeanCloud.Realtime { - /// - /// 文本消息 - /// public class LCIMTextMessage : LCIMTypedMessage { - /// - /// 文本 - /// public string Text { get; set; } diff --git a/Realtime/Realtime/Message/LCIMTypedMessage.cs b/Realtime/Realtime/Message/LCIMTypedMessage.cs index 39cbb79..95ccb59 100644 --- a/Realtime/Realtime/Message/LCIMTypedMessage.cs +++ b/Realtime/Realtime/Message/LCIMTypedMessage.cs @@ -6,40 +6,19 @@ using LeanCloud.Common; namespace LeanCloud.Realtime { /// - /// 已知类型消息 + /// Known message types. /// public class LCIMTypedMessage : LCIMMessage { - /// - /// 文本消息 - /// public const int TextMessageType = -1; - /// - /// 图像消息 - /// public const int ImageMessageType = -2; - /// - /// 音频消息 - /// public const int AudioMessageType = -3; - /// - /// 视频消息 - /// public const int VideoMessageType = -4; - /// - /// 位置消息 - /// public const int LocationMessageType = -5; - /// - /// 文件消息 - /// public const int FileMessageType = -6; - /// - /// 撤回消息 - /// public const int RecalledMessageType = -127; /// - /// 保留字段 + /// Preserved fields. /// protected const string MessageTypeKey = "_lctype"; protected const string MessageAttributesKey = "_lcattrs"; @@ -64,19 +43,16 @@ namespace LeanCloud.Realtime { private Dictionary customProperties; /// - /// 完整的消息数据 + /// Complete data of message. /// protected Dictionary data = new Dictionary(); - /// - /// 消息类型 - /// public virtual int MessageType { get; private set; } /// - /// 消息属性访问 + /// Gets message attributes. /// /// /// @@ -146,7 +122,7 @@ namespace LeanCloud.Realtime { }; /// - /// 注册自定义类型消息 + /// Registers a custom message type. /// /// /// diff --git a/Realtime/Realtime/Message/LCIMVideoMessage.cs b/Realtime/Realtime/Message/LCIMVideoMessage.cs index fb86337..c49ce9f 100644 --- a/Realtime/Realtime/Message/LCIMVideoMessage.cs +++ b/Realtime/Realtime/Message/LCIMVideoMessage.cs @@ -2,27 +2,15 @@ using LeanCloud.Storage; namespace LeanCloud.Realtime { - /// - /// 视频消息 - /// public class LCIMVideoMessage : LCIMFileMessage { - /// - /// 宽度 - /// public int Width { get; private set; } - /// - /// 高度 - /// public int Height { get; private set; } - /// - /// 时长 - /// public double Duration { get; private set; } diff --git a/Realtime/Realtime/Result/LCIMOperationFailure.cs b/Realtime/Realtime/Result/LCIMOperationFailure.cs index 73780e1..1f95229 100644 --- a/Realtime/Realtime/Result/LCIMOperationFailure.cs +++ b/Realtime/Realtime/Result/LCIMOperationFailure.cs @@ -1,27 +1,15 @@ using System.Collections.Generic; namespace LeanCloud.Realtime { - /// - /// 操作失败 - /// public class LCIMOperationFailure { - /// - /// 失败码 - /// public int Code { get; set; } - /// - /// 失败原因 - /// public string Reason { get; set; } - /// - /// 失败数据 - /// public List IdList { get; set; } diff --git a/Realtime/Realtime/Result/LCIMPageResult.cs b/Realtime/Realtime/Result/LCIMPageResult.cs index c0879b5..a559db6 100644 --- a/Realtime/Realtime/Result/LCIMPageResult.cs +++ b/Realtime/Realtime/Result/LCIMPageResult.cs @@ -1,20 +1,11 @@ using System.Collections.ObjectModel; namespace LeanCloud.Realtime { - /// - /// 查询分页结果 - /// public class LCIMPageResult { - /// - /// 当前分页数据集 - /// public ReadOnlyCollection Results { get; internal set; } - /// - /// 下次请求的数据 - /// public string Next { get; internal set; } diff --git a/Realtime/Realtime/Result/LCIMPartiallySuccessResult.cs b/Realtime/Realtime/Result/LCIMPartiallySuccessResult.cs index e91f336..86f61e5 100644 --- a/Realtime/Realtime/Result/LCIMPartiallySuccessResult.cs +++ b/Realtime/Realtime/Result/LCIMPartiallySuccessResult.cs @@ -1,20 +1,11 @@ using System.Collections.Generic; namespace LeanCloud.Realtime { - /// - /// 部分成功结果 - /// public class LCIMPartiallySuccessResult { - /// - /// 成功数据集 - /// public List SuccessfulClientIdList { get; internal set; } - /// - /// 失败原因 - /// public List FailureList { get; internal set; } diff --git a/Realtime/Realtime/Signature/ILCIMSignatureFactory.cs b/Realtime/Realtime/Signature/ILCIMSignatureFactory.cs index 4690302..47efa91 100644 --- a/Realtime/Realtime/Signature/ILCIMSignatureFactory.cs +++ b/Realtime/Realtime/Signature/ILCIMSignatureFactory.cs @@ -2,41 +2,13 @@ using System.Threading.Tasks; namespace LeanCloud.Realtime { - /// - /// 签名工程接口 - /// public interface ILCIMSignatureFactory { - /// - /// 登录签名 - /// - /// - /// Task CreateConnectSignature(string clientId); - /// - /// 创建开启对话签名 - /// - /// Task CreateStartConversationSignature(string clientId, IEnumerable memberIds); - /// - /// 创建会话相关签名 - /// - /// - /// - /// - /// - /// Task CreateConversationSignature(string conversationId, string clientId, IEnumerable memberIds, string action); - /// - /// 创建黑名单相关签名 - /// - /// - /// - /// - /// - /// Task CreateBlacklistSignature(string conversationId, string clientId, IEnumerable memberIds, string action); } } diff --git a/Realtime/Realtime/Signature/LCIMSignature.cs b/Realtime/Realtime/Signature/LCIMSignature.cs index 815d246..416b86d 100644 --- a/Realtime/Realtime/Signature/LCIMSignature.cs +++ b/Realtime/Realtime/Signature/LCIMSignature.cs @@ -1,24 +1,15 @@ namespace LeanCloud.Realtime { - /// - /// 签名数据 - /// public class LCIMSignature { - /// - /// 签名 - /// public string Signature { get; set; } - /// - /// 时间戳 - /// public long Timestamp { get; set; } /// - /// 随机字符串 + /// A random string. /// public string Nonce { get; set; diff --git a/Realtime/Realtime/Signature/LCIMSignatureAction.cs b/Realtime/Realtime/Signature/LCIMSignatureAction.cs index 013ed5d..fdb15ae 100644 --- a/Realtime/Realtime/Signature/LCIMSignatureAction.cs +++ b/Realtime/Realtime/Signature/LCIMSignatureAction.cs @@ -1,36 +1,18 @@ namespace LeanCloud.Realtime { /// - /// 支持签名的动作 + /// Actions supporting signatures. /// public static class LCIMSignatureAction { - /// - /// 邀请 - /// public const string Invite = "invite"; - /// - /// 踢出 - /// public const string Kick = "kick"; - /// - /// 用户拉黑对话 - /// public const string ClientBlockConversations = "client-block-conversations"; - /// - /// 用户解除拉黑对话 - /// public const string ClientUnblockConversations = "client-unblock-conversations"; - /// - /// 对话拉黑用户 - /// public const string ConversationBlockClients = "conversation-block-clients"; - /// - /// 对话解除拉黑用户 - /// public const string ConversationUnblockClients = "conversation-unblock-clients"; } } diff --git a/Sample/LiveQueryApp/SingleThreadSynchronizationContext.cs b/Sample/LiveQueryApp/SingleThreadSynchronizationContext.cs index d881cca..c1d059e 100644 --- a/Sample/LiveQueryApp/SingleThreadSynchronizationContext.cs +++ b/Sample/LiveQueryApp/SingleThreadSynchronizationContext.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; namespace LiveQueryApp { /// - /// 单线程环境,用于控制台应用 await 返回 + /// Mimics UI thread under .Net console. /// public class SingleThreadSynchronizationContext : SynchronizationContext { private readonly BlockingCollection> queue = new BlockingCollection>(); diff --git a/Sample/RealtimeApp/SingleThreadSynchronizationContext.cs b/Sample/RealtimeApp/SingleThreadSynchronizationContext.cs index fdfb2c9..fb75c27 100644 --- a/Sample/RealtimeApp/SingleThreadSynchronizationContext.cs +++ b/Sample/RealtimeApp/SingleThreadSynchronizationContext.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; namespace RealtimeApp { /// - /// 单线程环境,用于控制台应用 await 返回 + /// Mimics UI thread under .Net console. /// public class SingleThreadSynchronizationContext : SynchronizationContext { private readonly BlockingCollection> queue = new BlockingCollection>(); diff --git a/Storage/Storage/LCACL.cs b/Storage/Storage/LCACL.cs index 024c48f..d07e5c0 100644 --- a/Storage/Storage/LCACL.cs +++ b/Storage/Storage/LCACL.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; namespace LeanCloud.Storage { /// - /// 访问控制类 + /// LeanCloud Access Control Lists. /// public class LCACL { const string PublicKey = "*"; diff --git a/Storage/Storage/LCApplication.cs b/Storage/Storage/LCApplication.cs index be49ceb..846315a 100644 --- a/Storage/Storage/LCApplication.cs +++ b/Storage/Storage/LCApplication.cs @@ -5,7 +5,7 @@ using LeanCloud.Storage.Internal.Http; namespace LeanCloud { /// - /// LeanCloud 全局接口 + /// LeanCloud Application /// public class LCApplication { // SDK 版本号,用于 User-Agent 统计 diff --git a/Storage/Storage/LCCaptchaClient.cs b/Storage/Storage/LCCaptchaClient.cs index 968c730..f18d040 100644 --- a/Storage/Storage/LCCaptchaClient.cs +++ b/Storage/Storage/LCCaptchaClient.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; namespace LeanCloud.Storage { /// - /// 验证码 + /// An image CAPTCHA to prevent SMS abuse. /// public class LCCapture { public string Url { @@ -17,14 +17,14 @@ namespace LeanCloud.Storage { } /// - /// 验证码工具类 + /// Requests a CAPTCHA image and sends the verification code. /// public static class LCCaptchaClient { /// - /// 请求验证码 + /// Requests a CAPTCHA image from LeanCloud. /// - /// 验证码图片宽度 - /// 验证码图片高度 + /// Width of the CAPTCHA image. + /// Height of the CAPTCHA image. /// public static async Task RequestCaptcha(int width = 82, int height = 39) { @@ -41,10 +41,10 @@ namespace LeanCloud.Storage { } /// - /// 验证 + /// Sends the code to LeanCloud for verification. /// - /// - /// + /// entered by the user + /// for LeanCloud to recognize which CAPTCHA to verify /// public static async Task VerifyCaptcha(string code, string token) { diff --git a/Storage/Storage/LCCloud.cs b/Storage/Storage/LCCloud.cs index ed8fc2f..a1cbfd1 100644 --- a/Storage/Storage/LCCloud.cs +++ b/Storage/Storage/LCCloud.cs @@ -4,24 +4,24 @@ using LeanCloud.Storage.Internal.Codec; namespace LeanCloud.Storage { /// - /// 云引擎 + /// LeanEngine /// public static class LCCloud { private const string PRODUCTION_KEY = "X-LC-Prod"; /// - /// 是否是生产环境,默认为 true + /// Whether using production environment (default) or staging environment. /// public static bool IsProduction { get; set; } = true; /// - /// 调用云函数 + /// Invokes a cloud function. /// - /// - /// - /// 返回类型为 Dictionary + /// Cloud function name. + /// Parameters of cloud function. + /// Dictionary or List. public static async Task> Run(string name, Dictionary parameters = null) { string path = $"functions/{name}"; @@ -36,11 +36,11 @@ namespace LeanCloud.Storage { } /// - /// 调用 RPC 云函数 + /// Invokes a cloud function as a remote procedure call. /// - /// - /// - /// 返回类型为 LCObject 容器类型 + /// Cloud function name. + /// Parameters of cloud function. + /// LCObject, List, or Map. public static async Task RPC(string name, object parameters = null) { string path = $"call/{name}"; Dictionary headers = new Dictionary { diff --git a/Storage/Storage/LCGeoPoint.cs b/Storage/Storage/LCGeoPoint.cs index 4e1cc39..1cb3f44 100644 --- a/Storage/Storage/LCGeoPoint.cs +++ b/Storage/Storage/LCGeoPoint.cs @@ -2,16 +2,10 @@ namespace LeanCloud.Storage { public class LCGeoPoint { - /// - /// 纬度 - /// public double Latitude { get; } - /// - /// 经度 - /// public double Longitude { get; } @@ -27,11 +21,6 @@ namespace LeanCloud.Storage { } } - /// - /// 据某点的距离(单位:千米) - /// - /// - /// public double KilometersTo(LCGeoPoint point) { if (point == null) { throw new ArgumentNullException(nameof(point)); @@ -39,11 +28,6 @@ namespace LeanCloud.Storage { return RadiansTo(point) * 6371.0; } - /// - /// 据某点的距离(单位:英里) - /// - /// - /// public double MilesTo(LCGeoPoint point) { if (point == null) { throw new ArgumentNullException(nameof(point)); @@ -51,11 +35,6 @@ namespace LeanCloud.Storage { return RadiansTo(point) * 3958.8; } - /// - /// 据某点的距离(单位:弧度) - /// - /// - /// public double RadiansTo(LCGeoPoint point) { if (point == null) { throw new ArgumentNullException(nameof(point)); diff --git a/Storage/Storage/LCObject.cs b/Storage/Storage/LCObject.cs index 4b832d2..cdbd90f 100644 --- a/Storage/Storage/LCObject.cs +++ b/Storage/Storage/LCObject.cs @@ -10,21 +10,21 @@ using LeanCloud.Storage.Internal.Codec; namespace LeanCloud.Storage { /// - /// 对象类 + /// LeanCloud Object /// public class LCObject { /// - /// 最近一次与服务端同步的数据 + /// Last synced data. /// LCObjectData data; /// - /// 预算数据 + /// Estimated data. /// internal Dictionary estimatedData; /// - /// 操作字典 + /// Operations. /// internal Dictionary operationDict; @@ -134,7 +134,7 @@ namespace LeanCloud.Storage { } /// - /// 删除字段 + /// Removes the key. /// /// public void Unset(string key) { @@ -145,11 +145,7 @@ namespace LeanCloud.Storage { ApplyOperation(key, deleteOp); } - /// - /// 增加关联 - /// - /// - /// + public void AddRelation(string key, LCObject value) { if (string.IsNullOrEmpty(key)) { throw new ArgumentNullException(nameof(key)); @@ -161,11 +157,6 @@ namespace LeanCloud.Storage { ApplyOperation(key, op); } - /// - /// 删除关联 - /// - /// - /// public void RemoveRelation(string key, LCObject value) { if (string.IsNullOrEmpty(key)) { throw new ArgumentNullException(nameof(key)); @@ -178,7 +169,7 @@ namespace LeanCloud.Storage { } /// - /// 增加数字属性值 + /// Atomically increments the value of the given key with amount. /// /// /// @@ -194,7 +185,7 @@ namespace LeanCloud.Storage { } /// - /// 在数组属性中增加一个元素 + /// Atomically adds value to the end of the array key. /// /// /// @@ -210,7 +201,7 @@ namespace LeanCloud.Storage { } /// - /// 在数组属性中增加一组元素 + /// Atomically adds values to the end of the array key. /// /// /// @@ -226,7 +217,7 @@ namespace LeanCloud.Storage { } /// - /// 在数组属性中增加一个唯一元素 + /// Atomically adds value to the array key, only if not already present. /// /// /// @@ -242,10 +233,10 @@ namespace LeanCloud.Storage { } /// - /// 在数组属性中增加一组唯一元素 + /// Atomically adds values to the array key, only if not already present. /// /// - /// + /// public void AddAllUnique(string key, IEnumerable values) { if (string.IsNullOrEmpty(key)) { throw new ArgumentNullException(nameof(key)); @@ -258,7 +249,7 @@ namespace LeanCloud.Storage { } /// - /// 移除某个元素 + /// Atomically removes all value from the array key. /// /// /// @@ -274,7 +265,7 @@ namespace LeanCloud.Storage { } /// - /// 移除一组元素 + /// Atomically removes all values from the array key. /// /// /// @@ -458,7 +449,7 @@ namespace LeanCloud.Storage { } /// - /// 序列化为 json 字符串 + /// Serializes this LCObject to a JSON string. /// /// public override string ToString() { @@ -469,7 +460,7 @@ namespace LeanCloud.Storage { } /// - /// 反序列化为 LCObject 对象 + /// Deserializes a JSON string to a LCObject. /// /// /// diff --git a/Storage/Storage/LCQuery.cs b/Storage/Storage/LCQuery.cs index 586a91d..799b354 100644 --- a/Storage/Storage/LCQuery.cs +++ b/Storage/Storage/LCQuery.cs @@ -32,7 +32,7 @@ namespace LeanCloud.Storage { } /// - /// 查询类 + /// A query to fetch LCObject. /// /// public class LCQuery : LCQuery where T : LCObject { @@ -42,7 +42,7 @@ namespace LeanCloud.Storage { } /// - /// 等于 + /// The value corresponding to key is equal to value, or the array corresponding to key contains value. /// /// /// @@ -53,7 +53,7 @@ namespace LeanCloud.Storage { } /// - /// 不等于 + /// The value corresponding to key is not equal to value, or the array corresponding to key does not contain value. /// /// /// @@ -64,7 +64,7 @@ namespace LeanCloud.Storage { } /// - /// 包含 + /// Values contains value corresponding to key, or values contains at least one element in the array corresponding to key. /// /// /// @@ -75,7 +75,7 @@ namespace LeanCloud.Storage { } /// - /// 不包含 + /// The value of key must not be contained in values. /// /// /// @@ -86,7 +86,7 @@ namespace LeanCloud.Storage { } /// - /// 包含全部 + /// The array corresponding to key contains all elements in values. /// /// /// @@ -97,7 +97,7 @@ namespace LeanCloud.Storage { } /// - /// 存在 + /// The attribute corresponding to key exists. /// /// /// @@ -107,7 +107,7 @@ namespace LeanCloud.Storage { } /// - /// 不存在 + /// The attribute corresponding to key does not exist. /// /// /// @@ -117,7 +117,7 @@ namespace LeanCloud.Storage { } /// - /// 长度等于 + /// The size of the array corresponding to key is equal to size. /// /// /// @@ -128,7 +128,7 @@ namespace LeanCloud.Storage { } /// - /// 大于 + /// The value corresponding to key is greater than value. /// /// /// @@ -139,7 +139,7 @@ namespace LeanCloud.Storage { } /// - /// 大于等于 + /// The value corresponding to key is greater than or equal to value. /// /// /// @@ -150,7 +150,7 @@ namespace LeanCloud.Storage { } /// - /// 小于 + /// The value corresponding to key is less than value. /// /// /// @@ -161,7 +161,7 @@ namespace LeanCloud.Storage { } /// - /// 小于等于 + /// The value corresponding to key is less than or equal to value. /// /// /// @@ -171,42 +171,23 @@ namespace LeanCloud.Storage { return this; } - /// - /// 相邻 - /// - /// - /// - /// public LCQuery WhereNear(string key, LCGeoPoint point) { Condition.WhereNear(key, point); return this; } - /// - /// 在坐标区域内 - /// - /// - /// - /// - /// public LCQuery WhereWithinGeoBox(string key, LCGeoPoint southwest, LCGeoPoint northeast) { Condition.WhereWithinGeoBox(key, southwest, northeast); return this; } - /// - /// 相关 - /// - /// - /// - /// public LCQuery WhereRelatedTo(LCObject parent, string key) { Condition.WhereRelatedTo(parent, key); return this; } /// - /// 前缀 + /// The string corresponding to key has a prefix. /// /// /// @@ -217,7 +198,7 @@ namespace LeanCloud.Storage { } /// - /// 后缀 + /// The string corresponding to key has a suffix. /// /// /// @@ -228,7 +209,7 @@ namespace LeanCloud.Storage { } /// - /// 字符串包含 + /// The string corresponding to key has a subString. /// /// /// @@ -239,7 +220,7 @@ namespace LeanCloud.Storage { } /// - /// 正则匹配 + /// Matches the regexp. /// /// /// @@ -251,7 +232,7 @@ namespace LeanCloud.Storage { } /// - /// 关系查询 + /// The value of key must match query. /// /// /// @@ -262,7 +243,7 @@ namespace LeanCloud.Storage { } /// - /// 不满足子查询 + /// The value of key must not match query. /// /// /// @@ -273,28 +254,20 @@ namespace LeanCloud.Storage { return this; } - /// - /// 按 key 升序 - /// - /// - /// + public LCQuery OrderByAscending(string key) { Condition.OrderByAscending(key); return this; } - /// - /// 按 key 降序 - /// - /// - /// + public LCQuery OrderByDescending(string key) { Condition.OrderByDescending(key); return this; } /// - /// 增加按 key 升序 + /// Also sorts the results in ascending order by the given key. /// /// /// @@ -304,7 +277,7 @@ namespace LeanCloud.Storage { } /// - /// 增加按 key 降序 + /// Also sorts the results in descending order by the given key. /// /// /// @@ -314,7 +287,7 @@ namespace LeanCloud.Storage { } /// - /// 拉取 key 的完整对象 + /// Includes nested LCObject for the provided key. /// /// /// @@ -324,7 +297,7 @@ namespace LeanCloud.Storage { } /// - /// 包含 key + /// Restricts the keys of the LCObject returned. /// /// /// @@ -334,7 +307,7 @@ namespace LeanCloud.Storage { } /// - /// 是否包含 ACL + /// Includes the ALC or not. /// public bool IncludeACL { get { @@ -345,7 +318,7 @@ namespace LeanCloud.Storage { } /// - /// 跳过 + /// Sets the amount of results to skip before returning any results. /// /// /// @@ -355,7 +328,7 @@ namespace LeanCloud.Storage { } /// - /// 限制数量 + /// Sets the limit of the number of results to return. /// /// /// diff --git a/Storage/Storage/LCRelation.cs b/Storage/Storage/LCRelation.cs index 6e44d76..bc989ef 100644 --- a/Storage/Storage/LCRelation.cs +++ b/Storage/Storage/LCRelation.cs @@ -1,25 +1,14 @@ namespace LeanCloud.Storage { - /// - /// 关系类 - /// + public class LCRelation where T : LCObject { - /// - /// 字段名 - /// public string Key { get; set; } - /// - /// 父对象 - /// public LCObject Parent { get; set; } - /// - /// 关联类型名 - /// public string TargetClass { get; set; } @@ -27,9 +16,6 @@ public LCRelation() { } - /// - /// 获取 Relation 的查询对象 - /// public LCQuery Query { get { LCQuery query = new LCQuery(TargetClass); diff --git a/Storage/Storage/LCRole.cs b/Storage/Storage/LCRole.cs index 39a344e..49d949c 100644 --- a/Storage/Storage/LCRole.cs +++ b/Storage/Storage/LCRole.cs @@ -1,13 +1,11 @@ namespace LeanCloud.Storage { /// - /// 角色 + /// LeanCloud Role, a group of users for the purposes of granting permissions. /// public class LCRole : LCObject { public const string CLASS_NAME = "_Role"; - /// - /// 名字 - /// + public string Name { get { return this["name"] as string; @@ -17,7 +15,7 @@ } /// - /// 关联角色 + /// Child roles. /// public LCRelation Roles { get { @@ -30,7 +28,7 @@ } /// - /// 关联用户 + /// Child users. /// public LCRelation Users { get { @@ -54,7 +52,7 @@ } /// - /// 获取角色查询对象 + /// Constructs a LCQuery for this role. /// /// public static LCQuery GetQuery() { diff --git a/Storage/Storage/LCSMSClient.cs b/Storage/Storage/LCSMSClient.cs index 8688995..187fbaf 100644 --- a/Storage/Storage/LCSMSClient.cs +++ b/Storage/Storage/LCSMSClient.cs @@ -4,17 +4,17 @@ using System.Threading.Tasks; namespace LeanCloud.Storage { /// - /// 短信工具类 + /// LeanCloud SMS Client /// public static class LCSMSClient { /// - /// 请求短信验证码 + /// Requests an SMS code for operation verification. /// /// /// /// /// - /// + /// Template variables /// public static async Task RequestSMSCode(string mobile, string template = null, @@ -47,7 +47,7 @@ namespace LeanCloud.Storage { } /// - /// 请求语音验证码 + /// Requests to send the verification code via phone call. /// /// /// @@ -60,12 +60,6 @@ namespace LeanCloud.Storage { await LCApplication.HttpClient.Post>(path, data: data); } - /// - /// 验证手机号 - /// - /// - /// - /// public static async Task VerifyMobilePhone(string mobile, string code) { string path = $"verifySmsCode/{code}"; Dictionary data = new Dictionary { diff --git a/Storage/Storage/LCUser.cs b/Storage/Storage/LCUser.cs index bfd21db..a8b1f9a 100644 --- a/Storage/Storage/LCUser.cs +++ b/Storage/Storage/LCUser.cs @@ -68,7 +68,7 @@ namespace LeanCloud.Storage { } /// - /// 是否是匿名登录 + /// Checks whether this user is anonymous. /// public bool IsAnonymous => AuthData != null && AuthData.ContainsKey("anonymous"); @@ -90,7 +90,7 @@ namespace LeanCloud.Storage { } /// - /// 注册 + /// Signs up a new user. /// /// public async Task SignUp() { @@ -111,9 +111,9 @@ namespace LeanCloud.Storage { } /// - /// 请求登录注册码 + /// Requests sending a login sms code. /// - /// + /// The mobile number of an existing user /// public static async Task RequestLoginSMSCode(string mobile) { if (string.IsNullOrEmpty(mobile)) { @@ -126,7 +126,7 @@ namespace LeanCloud.Storage { } /// - /// 使用手机号和验证码注册或登录 + /// Signs up or signs in a user with their mobile number and verification code. /// /// /// @@ -149,7 +149,7 @@ namespace LeanCloud.Storage { } /// - /// 以账号和密码登陆 + /// Signs in a user with their username and password. /// /// /// @@ -169,7 +169,7 @@ namespace LeanCloud.Storage { } /// - /// 以邮箱和密码登陆 + /// Signs in a user with their email and password. /// /// /// @@ -189,7 +189,7 @@ namespace LeanCloud.Storage { } /// - /// 以手机号和密码登陆 + /// Signs in a user with their mobile number and password. /// /// /// @@ -209,7 +209,7 @@ namespace LeanCloud.Storage { } /// - /// 以手机号和验证码登录 + /// Signs in a user with their mobile number and verification code. /// /// /// @@ -229,7 +229,7 @@ namespace LeanCloud.Storage { } /// - /// 使用第三方数据登录 + /// Signs up or signs in a user with third party authData. /// /// /// @@ -250,7 +250,7 @@ namespace LeanCloud.Storage { } /// - /// 使用第三方数据和 Union Id 登录 + /// Signs up or signs in a user with third party authData and unionId. /// /// /// @@ -276,7 +276,7 @@ namespace LeanCloud.Storage { } /// - /// 绑定第三方登录 + /// Associates this user with a third party authData. /// /// /// @@ -292,7 +292,7 @@ namespace LeanCloud.Storage { } /// - /// 使用 Union Id 绑定第三方登录 + /// Associates this user with a third party authData and unionId. /// /// /// @@ -318,7 +318,7 @@ namespace LeanCloud.Storage { } /// - /// 解绑第三方登录 + /// Unlinks a user from a third party platform. /// /// /// @@ -330,7 +330,7 @@ namespace LeanCloud.Storage { } /// - /// 匿名登录 + /// Creates an anonymous user. /// /// public static Task LoginAnonymously() { @@ -341,7 +341,7 @@ namespace LeanCloud.Storage { } /// - /// 请求验证邮箱 + /// Requests a verification email to be sent to a user's email address. /// /// /// @@ -356,7 +356,7 @@ namespace LeanCloud.Storage { } /// - /// 请求手机验证码 + /// Requests a verification SMS to be sent to a user's mobile number. /// /// /// @@ -371,7 +371,7 @@ namespace LeanCloud.Storage { } /// - /// 验证手机号 + /// Requests to verify a user's mobile number with sms code they received. /// /// /// @@ -391,7 +391,7 @@ namespace LeanCloud.Storage { } /// - /// 设置当前用户 + /// Signs in a user with a sessionToken. /// /// /// @@ -410,7 +410,7 @@ namespace LeanCloud.Storage { } /// - /// 请求使用邮箱重置密码 + /// Requests a password reset email to be sent to a user's email address. /// /// /// @@ -426,7 +426,7 @@ namespace LeanCloud.Storage { } /// - /// 请求验证码重置密码 + /// Requests a reset password sms code to be sent to a user's mobile number. /// /// /// @@ -442,7 +442,7 @@ namespace LeanCloud.Storage { } /// - /// 使用验证码重置密码 + /// Resets a user's password via mobile phone. /// /// /// @@ -467,7 +467,7 @@ namespace LeanCloud.Storage { } /// - /// 更新密码 + /// Updates newPassword safely with oldPassword. /// /// /// @@ -490,7 +490,7 @@ namespace LeanCloud.Storage { } /// - /// 注销登录 + /// Logs out the currently logged in user session. /// public static Task Logout() { currentUser = null; @@ -500,7 +500,7 @@ namespace LeanCloud.Storage { } /// - /// 是否是有效登录 + /// Checks whether the current sessionToken is valid. /// /// public async Task IsAuthenticated() { @@ -516,7 +516,7 @@ namespace LeanCloud.Storage { } /// - /// 得到 LCUser 类型的查询对象 + /// Constructs a LCQuery for LCUser. /// /// public static LCQuery GetQuery() { @@ -557,7 +557,7 @@ namespace LeanCloud.Storage { } /// - /// 请求修改手机号验证码 + /// Requests an SMS code for updating phone number. /// /// /// @@ -576,7 +576,7 @@ namespace LeanCloud.Storage { } /// - /// 验证修改手机号验证码 + /// Verify code for updating phone number. /// /// /// diff --git a/Storage/Storage/LCUserAuthDataLoginOption.cs b/Storage/Storage/LCUserAuthDataLoginOption.cs index e4541ef..0d88718 100644 --- a/Storage/Storage/LCUserAuthDataLoginOption.cs +++ b/Storage/Storage/LCUserAuthDataLoginOption.cs @@ -1,24 +1,24 @@ /// -/// 第三方登录选项 +/// LCUser UnionID login parameters. /// namespace LeanCloud.Storage { public class LCUserAuthDataLoginOption { /// - /// Union Id 平台 + /// The platform of the UnionID. /// public string UnionIdPlatform { get; set; } /// - /// 是否作为主账号 + /// Whether the current authentication information will be used as the main account. /// public bool AsMainAccount { get; set; } /// - /// 是否在不存在的情况下返回失败 + /// Whether the login request will fail if no user matching this authData exists. /// public bool FailOnNotExist { get; set; diff --git a/Storage/Storage/Leaderboard/LCLeaderboard.cs b/Storage/Storage/Leaderboard/LCLeaderboard.cs index 75c360a..8062563 100644 --- a/Storage/Storage/Leaderboard/LCLeaderboard.cs +++ b/Storage/Storage/Leaderboard/LCLeaderboard.cs @@ -7,121 +7,53 @@ using System.Collections.Generic; using LeanCloud.Storage.Internal.Codec; namespace LeanCloud.Storage { - /// - /// 排行榜顺序 - /// public enum LCLeaderboardOrder { - /// - /// 升序 - /// Ascending, - /// - /// 降序 - /// Descending } - /// - /// 排行榜更新策略 - /// public enum LCLeaderboardUpdateStrategy { - /// - /// 更好的 - /// Better, - /// - /// 最近的 - /// Last, - /// - /// 总和 - /// Sum } - /// - /// 排行榜刷新频率 - /// public enum LCLeaderboardVersionChangeInterval { - /// - /// 从不 - /// Never, - /// - /// 每天 - /// Day, - /// - /// 每周 - /// Week, - /// - /// 每月 - /// Month } - /// - /// 排行榜 - /// public class LCLeaderboard { - /// - /// 成绩名字 - /// public string StatisticName { get; private set; } - /// - /// 排名顺序 - /// public LCLeaderboardOrder Order { get; private set; } - /// - /// 排名更新策略 - /// public LCLeaderboardUpdateStrategy UpdateStrategy { get; private set; } - /// - /// 版本更新频率 - /// public LCLeaderboardVersionChangeInterval VersionChangeInterval { get; private set; } - /// - /// 版本号 - /// public int Version { get; private set; } - /// - /// 下次重置时间 - /// public DateTime NextResetAt { get; private set; } - /// - /// 创建时间 - /// public DateTime CreatedAt { get; private set; } - /// - /// 创建排行榜 - /// - /// - /// - /// - /// - /// public static async Task CreateLeaderboard(string statisticName, LCLeaderboardOrder order = LCLeaderboardOrder.Descending, LCLeaderboardUpdateStrategy updateStrategy = LCLeaderboardUpdateStrategy.Better, @@ -144,7 +76,7 @@ namespace LeanCloud.Storage { } /// - /// 创建只包含名称的排行榜对象 + /// Creates an empty leaderboard with a specified name. /// /// /// @@ -157,23 +89,12 @@ namespace LeanCloud.Storage { }; } - /// - /// 获取排行榜 - /// - /// - /// public static Task GetLeaderboard(string statisticName) { LCLeaderboard leaderboard = CreateWithoutData(statisticName); return leaderboard.Fetch(); } - /// - /// 更新用户成绩 - /// - /// - /// - /// - /// + public static async Task> UpdateStatistics(LCUser user, Dictionary statistics, bool overwrite = true) { @@ -205,12 +126,7 @@ namespace LeanCloud.Storage { return null; } - /// - /// 获得用户成绩 - /// - /// - /// - /// + public static async Task> GetStatistics(LCUser user, IEnumerable statisticNames = null) { if (user == null) { @@ -234,12 +150,7 @@ namespace LeanCloud.Storage { return null; } - /// - /// 删除用户成绩 - /// - /// - /// - /// + public static async Task DeleteStatistics(LCUser user, IEnumerable statisticNames) { if (user == null) { @@ -254,7 +165,7 @@ namespace LeanCloud.Storage { } /// - /// 获取排行榜历史数据 + /// Gets historical data of this leaderboard. /// /// /// @@ -283,15 +194,7 @@ namespace LeanCloud.Storage { return null; } - /// - /// 获取排行榜结果 - /// - /// - /// - /// - /// - /// - /// + public Task> GetResults(int version = -1, int skip = 0, int limit = 10, @@ -300,15 +203,7 @@ namespace LeanCloud.Storage { return GetResults(null, version, skip, limit, selectUserKeys, includeStatistics); } - /// - /// 获取用户及附近的排名 - /// - /// - /// - /// - /// - /// - /// + public async Task> GetResultsAroundUser(int version = -1, int skip = 0, int limit = 10, @@ -353,11 +248,7 @@ namespace LeanCloud.Storage { return null; } - /// - /// 设置更新策略 - /// - /// - /// + public async Task UpdateUpdateStrategy(LCLeaderboardUpdateStrategy updateStrategy) { Dictionary data = new Dictionary { { "updateStrategy", updateStrategy.ToString().ToLower() } @@ -372,11 +263,7 @@ namespace LeanCloud.Storage { return this; } - /// - /// 设置版本更新频率 - /// - /// - /// + public async Task UpdateVersionChangeInterval(LCLeaderboardVersionChangeInterval versionChangeInterval) { Dictionary data = new Dictionary { { "versionChangeInterval", versionChangeInterval.ToString().ToLower() } @@ -392,7 +279,7 @@ namespace LeanCloud.Storage { } /// - /// 拉取排行榜数据 + /// Fetches leaderboard data. /// /// public async Task Fetch() { @@ -403,7 +290,7 @@ namespace LeanCloud.Storage { } /// - /// 重置排行榜 + /// Resets this leaderboard. /// /// public async Task Reset() { @@ -414,7 +301,7 @@ namespace LeanCloud.Storage { } /// - /// 销毁排行榜 + /// Destroys this leaderboard. /// /// public async Task Destroy() { diff --git a/Storage/Storage/Leaderboard/LCLeaderboardArchive.cs b/Storage/Storage/Leaderboard/LCLeaderboardArchive.cs index a53e353..7319ae1 100644 --- a/Storage/Storage/Leaderboard/LCLeaderboardArchive.cs +++ b/Storage/Storage/Leaderboard/LCLeaderboardArchive.cs @@ -4,46 +4,37 @@ using LeanCloud.Storage.Internal.Codec; namespace LeanCloud.Storage { /// - /// 归档的排行榜 + /// Archived leaderboard. /// public class LCLeaderboardArchive { - /// - /// 名称 - /// public string StatisticName { get; internal set; } - /// - /// 版本号 - /// public int Version { get; internal set; } /// - /// 状态 + /// Archive status. One of scheduled, inProgress, failed, completed. /// public string Status { get; internal set; } - + /// - /// 下载地址 + /// Download URL of the archived leaderboard file. /// public string Url { get; internal set; } - /// - /// 激活时间 - /// public DateTime ActivatedAt { get; internal set; } /// - /// 归档时间 + /// Archive time. /// public DateTime DeactivatedAt { get; internal set; diff --git a/Storage/Storage/Leaderboard/LCRanking.cs b/Storage/Storage/Leaderboard/LCRanking.cs index 6fdd3bf..ea3ca9c 100644 --- a/Storage/Storage/Leaderboard/LCRanking.cs +++ b/Storage/Storage/Leaderboard/LCRanking.cs @@ -4,41 +4,23 @@ using System.Collections.ObjectModel; using LeanCloud.Storage.Internal.Object; namespace LeanCloud.Storage { - /// - /// 排名 - /// public class LCRanking { - /// - /// 名次 - /// public int Rank { get; private set; } - /// - /// 用户 - /// public LCUser User { get; private set; } - /// - /// 成绩名称 - /// public string StatisticName { get; private set; } - /// - /// 分数 - /// public double Value { get; private set; } - /// - /// 成绩 - /// public ReadOnlyCollection IncludedStatistics { get; private set; } diff --git a/Storage/Storage/Leaderboard/LCStatistic.cs b/Storage/Storage/Leaderboard/LCStatistic.cs index d7402e6..a9823a5 100644 --- a/Storage/Storage/Leaderboard/LCStatistic.cs +++ b/Storage/Storage/Leaderboard/LCStatistic.cs @@ -2,27 +2,15 @@ using System.Collections.Generic; namespace LeanCloud.Storage { - /// - /// 成绩 - /// public class LCStatistic { - /// - /// 排行榜名字 - /// public string Name { get; private set; } - /// - /// 成绩值 - /// public double Value { get; private set; } - /// - /// 排行榜版本 - /// public int Version { get; internal set; }