diff --git a/Engine/Public/Attributes/LCEngineClassHookAttribute.cs b/Engine/Public/Attributes/LCEngineClassHookAttribute.cs
index 6fbe6d8..73bdcac 100644
--- a/Engine/Public/Attributes/LCEngineClassHookAttribute.cs
+++ b/Engine/Public/Attributes/LCEngineClassHookAttribute.cs
@@ -10,6 +10,10 @@ namespace LeanCloud.Engine {
AfterDelete
}
+ ///
+ /// LCEngineClassHookAttribute is an attribute that hooks class in LeanEngine.
+ ///
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class LCEngineClassHookAttribute : Attribute {
public string ClassName {
get;
diff --git a/Engine/Public/Attributes/LCEngineFunctionAttribute.cs b/Engine/Public/Attributes/LCEngineFunctionAttribute.cs
index 1f4ddb0..59ce4be 100644
--- a/Engine/Public/Attributes/LCEngineFunctionAttribute.cs
+++ b/Engine/Public/Attributes/LCEngineFunctionAttribute.cs
@@ -1,6 +1,9 @@
using System;
namespace LeanCloud.Engine {
+ ///
+ /// LCEngineFunctionAttribute is an attribute of cloud function in engine.
+ ///
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class LCEngineFunctionAttribute : Attribute {
public string FunctionName {
diff --git a/Engine/Public/Attributes/LCEngineFunctionParamAttribute.cs b/Engine/Public/Attributes/LCEngineFunctionParamAttribute.cs
index 157608c..c762380 100644
--- a/Engine/Public/Attributes/LCEngineFunctionParamAttribute.cs
+++ b/Engine/Public/Attributes/LCEngineFunctionParamAttribute.cs
@@ -1,6 +1,9 @@
using System;
namespace LeanCloud.Engine {
+ ///
+ /// LCEngineFunctionParamAttribute is an attribute of the parameter of cloud function in engine.
+ ///
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
public class LCEngineFunctionParamAttribute : Attribute {
public string ParamName {
diff --git a/Engine/Public/Attributes/LCEngineRealtimeHookAttribute.cs b/Engine/Public/Attributes/LCEngineRealtimeHookAttribute.cs
index 8c23d06..b8ea596 100644
--- a/Engine/Public/Attributes/LCEngineRealtimeHookAttribute.cs
+++ b/Engine/Public/Attributes/LCEngineRealtimeHookAttribute.cs
@@ -20,6 +20,10 @@ namespace LeanCloud.Engine {
ClientOffline,
}
+ ///
+ /// LCEngineRealtimeHookAttribute is an attribute that hooks realtime in engine.
+ ///
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class LCEngineRealtimeHookAttribute : Attribute {
public LCEngineRealtimeHookType HookType {
get;
diff --git a/Engine/Public/Attributes/LCEngineUserHookAttribute.cs b/Engine/Public/Attributes/LCEngineUserHookAttribute.cs
index c9485f1..bf5e25d 100644
--- a/Engine/Public/Attributes/LCEngineUserHookAttribute.cs
+++ b/Engine/Public/Attributes/LCEngineUserHookAttribute.cs
@@ -7,6 +7,10 @@ namespace LeanCloud.Engine {
OnLogin
}
+ ///
+ /// LCEngineUserHookAttribute is an attribute that hooks user in engine.
+ ///
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class LCEngineUserHookAttribute : Attribute {
public LCEngineUserHookType HookType {
get;
diff --git a/Engine/Public/LCEngine.cs b/Engine/Public/LCEngine.cs
index a71368e..276797c 100644
--- a/Engine/Public/LCEngine.cs
+++ b/Engine/Public/LCEngine.cs
@@ -11,6 +11,9 @@ using Microsoft.Extensions.DependencyInjection;
using LeanCloud.Common;
namespace LeanCloud.Engine {
+ ///
+ /// LCEngine provides the initialization of LeanEngine.
+ ///
public class LCEngine {
public const string LCEngineCORS = "LCEngineCORS";
@@ -79,6 +82,10 @@ namespace LeanCloud.Engine {
public static Dictionary ClassHooks = new Dictionary();
public static Dictionary UserHooks = new Dictionary();
+ ///
+ /// Initializes the engine with the given services.
+ ///
+ ///
public static void Initialize(IServiceCollection services) {
// 获取环境变量
LCLogger.Debug("-------------------------------------------------");
@@ -198,7 +205,7 @@ namespace LeanCloud.Engine {
});
}
- public static void PrintEnvironmentVar(string key) {
+ private static void PrintEnvironmentVar(string key) {
LCLogger.Debug($"{key} : {Environment.GetEnvironmentVariable(key)}");
}
@@ -293,7 +300,7 @@ namespace LeanCloud.Engine {
}
}
- public static object GetFunctions(HttpRequest request) {
+ internal static object GetFunctions(HttpRequest request) {
CheckMasterKey(request);
List functions = new List();
diff --git a/Engine/Public/LCEngineRequestContext.cs b/Engine/Public/LCEngineRequestContext.cs
index c04c2f9..68e9e2f 100644
--- a/Engine/Public/LCEngineRequestContext.cs
+++ b/Engine/Public/LCEngineRequestContext.cs
@@ -1,9 +1,11 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Threading;
using LeanCloud.Storage;
namespace LeanCloud.Engine {
+ ///
+ /// LCEngineRequestContext provides the context of engine request.
+ ///
public class LCEngineRequestContext {
public const string RemoteAddressKey = "__remoteAddressKey";
public const string SessionTokenKey = "__sessionToken";
@@ -31,7 +33,10 @@ namespace LeanCloud.Engine {
}
return requestContext.Value[key];
}
-
+
+ ///
+ /// The remote address of this request.
+ ///
public static string RemoteAddress {
get {
object remoteAddress = Get(RemoteAddressKey);
@@ -45,6 +50,9 @@ namespace LeanCloud.Engine {
}
}
+ ///
+ /// The session token of this request.
+ ///
public static string SessionToken {
get {
object sessionToken = Get(SessionTokenKey);
@@ -58,6 +66,9 @@ namespace LeanCloud.Engine {
}
}
+ ///
+ /// The user of this request.
+ ///
public static LCUser CurrentUser {
get {
object currentUser = Get(CurrentUserKey);
diff --git a/LiveQuery/LiveQuery/Public/LCLiveQuery.cs b/LiveQuery/LiveQuery/Public/LCLiveQuery.cs
index 1976ca5..6559e61 100644
--- a/LiveQuery/LiveQuery/Public/LCLiveQuery.cs
+++ b/LiveQuery/LiveQuery/Public/LCLiveQuery.cs
@@ -10,7 +10,7 @@ using LeanCloud.LiveQuery.Internal;
namespace LeanCloud.LiveQuery {
///
- /// LiveQuery
+ /// LeanCloud LiveQuery.
///
public class LCLiveQuery {
///
diff --git a/LiveQuery/LiveQuery/Public/LCQueryExtension.cs b/LiveQuery/LiveQuery/Public/LCQueryExtension.cs
index 66c7ec9..aa097ec 100644
--- a/LiveQuery/LiveQuery/Public/LCQueryExtension.cs
+++ b/LiveQuery/LiveQuery/Public/LCQueryExtension.cs
@@ -2,7 +2,15 @@
using LeanCloud.Storage;
namespace LeanCloud.LiveQuery {
+ ///
+ /// LCQueryExtension is the extension of a LCQuery.
+ ///
public static class LCQueryExtension {
+ ///
+ /// Subscribes a LCQuery.
+ ///
+ ///
+ ///
public static async Task Subscribe(this LCQuery query) {
LCLiveQuery liveQuery = new LCLiveQuery {
Query = query
diff --git a/Realtime/Realtime/Public/Conversation/LCIMChatRoom.cs b/Realtime/Realtime/Public/Conversation/LCIMChatRoom.cs
index 0ecccf1..c227253 100644
--- a/Realtime/Realtime/Public/Conversation/LCIMChatRoom.cs
+++ b/Realtime/Realtime/Public/Conversation/LCIMChatRoom.cs
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
namespace LeanCloud.Realtime {
///
- /// Chatroom
+ /// LCIMChatRoom is a local representation of chatroom in LeanCloud.
///
public class LCIMChatRoom : LCIMConversation {
public LCIMChatRoom(LCIMClient client) :
@@ -25,14 +25,29 @@ namespace LeanCloud.Realtime {
return await Client.ConversationController.GetOnlineMembers(Id, limit);
}
+ ///
+ /// Adds members to this conversation.
+ ///
+ ///
+ ///
public override Task AddMembers(IEnumerable clientIds) {
throw new Exception("Add members is not allowed in chat room.");
}
+ ///
+ /// Flags the read status of this conversation.
+ /// But it is an no-op in LCIMChatRoom.
+ ///
+ ///
public override Task Read() {
return Task.CompletedTask;
}
+ ///
+ /// Fetchs the recipt timestamps of this conversation.
+ /// But it is an no-op in LCIMChatRoom.
+ ///
+ ///
public override Task FetchReciptTimestamps() {
return Task.CompletedTask;
}
diff --git a/Realtime/Realtime/Public/Conversation/LCIMConversation.cs b/Realtime/Realtime/Public/Conversation/LCIMConversation.cs
index ed6e75b..77cb321 100644
--- a/Realtime/Realtime/Public/Conversation/LCIMConversation.cs
+++ b/Realtime/Realtime/Public/Conversation/LCIMConversation.cs
@@ -6,7 +6,8 @@ using System.Collections.ObjectModel;
namespace LeanCloud.Realtime {
///
- /// Conversation
+ /// LCIMConversation is a local representation of general conversation
+ /// in LeanCloud.
///
public class LCIMConversation {
///
diff --git a/Realtime/Realtime/Public/Conversation/LCIMConversationMemberInfo.cs b/Realtime/Realtime/Public/Conversation/LCIMConversationMemberInfo.cs
index 48e4324..b26253e 100644
--- a/Realtime/Realtime/Public/Conversation/LCIMConversationMemberInfo.cs
+++ b/Realtime/Realtime/Public/Conversation/LCIMConversationMemberInfo.cs
@@ -1,4 +1,7 @@
namespace LeanCloud.Realtime {
+ ///
+ /// LCIMConversationMemberInfo represents the member info of the conversation.
+ ///
public class LCIMConversationMemberInfo {
public const string Owner = "Owner";
diff --git a/Realtime/Realtime/Public/Conversation/LCIMConversationQuery.cs b/Realtime/Realtime/Public/Conversation/LCIMConversationQuery.cs
index e65f193..daf7fa5 100644
--- a/Realtime/Realtime/Public/Conversation/LCIMConversationQuery.cs
+++ b/Realtime/Realtime/Public/Conversation/LCIMConversationQuery.cs
@@ -3,10 +3,12 @@ using System.Collections;
using System.Collections.ObjectModel;
using LeanCloud.Storage.Internal.Query;
using System.Linq;
-using System.Collections.Generic;
using System;
namespace LeanCloud.Realtime {
+ ///
+ /// LCIMConversationQuery is the query for conversations.
+ ///
public class LCIMConversationQuery {
internal const int CompactFlag = 0x1;
internal const int WithLastMessageFlag = 0x2;
diff --git a/Realtime/Realtime/Public/Conversation/LCIMMessageQueryOptions.cs b/Realtime/Realtime/Public/Conversation/LCIMMessageQueryOptions.cs
index c936feb..de2b79e 100644
--- a/Realtime/Realtime/Public/Conversation/LCIMMessageQueryOptions.cs
+++ b/Realtime/Realtime/Public/Conversation/LCIMMessageQueryOptions.cs
@@ -1,6 +1,9 @@
using System;
namespace LeanCloud.Realtime {
+ ///
+ /// LCIMMessageQueryEndpoint limits the query results.
+ ///
public class LCIMMessageQueryEndpoint {
public string MessageId {
get; set;
diff --git a/Realtime/Realtime/Public/Conversation/LCIMServiceConversation.cs b/Realtime/Realtime/Public/Conversation/LCIMServiceConversation.cs
index d55a16f..68a0986 100644
--- a/Realtime/Realtime/Public/Conversation/LCIMServiceConversation.cs
+++ b/Realtime/Realtime/Public/Conversation/LCIMServiceConversation.cs
@@ -2,6 +2,10 @@
using System.Threading.Tasks;
namespace LeanCloud.Realtime {
+ ///
+ /// LCIMServiceConversation is a local representation of service conversation
+ /// in LeanCloud.
+ ///
public class LCIMServiceConversation : LCIMConversation {
public LCIMServiceConversation(LCIMClient client) : base(client) {
}
diff --git a/Realtime/Realtime/Public/Conversation/LCIMTemporaryConversation.cs b/Realtime/Realtime/Public/Conversation/LCIMTemporaryConversation.cs
index 3fc19c3..698a192 100644
--- a/Realtime/Realtime/Public/Conversation/LCIMTemporaryConversation.cs
+++ b/Realtime/Realtime/Public/Conversation/LCIMTemporaryConversation.cs
@@ -1,6 +1,10 @@
using System;
namespace LeanCloud.Realtime {
+ ///
+ /// LCIMTemporaryConversation is a local representation of temporary conversation
+ /// in LeanCloud.
+ ///
public class LCIMTemporaryConversation : LCIMConversation {
public DateTime ExpiredAt {
get;
diff --git a/Realtime/Realtime/Public/LCIMClient.cs b/Realtime/Realtime/Public/LCIMClient.cs
index 88cf67a..0d33627 100644
--- a/Realtime/Realtime/Public/LCIMClient.cs
+++ b/Realtime/Realtime/Public/LCIMClient.cs
@@ -8,7 +8,9 @@ using LeanCloud.Realtime.Internal.Protocol;
using LeanCloud.Realtime.Internal.Controller;
namespace LeanCloud.Realtime {
-
+ ///
+ /// LCIMClient is a local representation of realtime client in LeanCloud.
+ ///
public class LCIMClient {
///
/// Conversation cache
@@ -29,6 +31,9 @@ namespace LeanCloud.Realtime {
get; private set;
}
+ ///
+ /// Device Id
+ ///
public string DeviceId {
get; private set;
}
@@ -235,6 +240,13 @@ namespace LeanCloud.Realtime {
#region 接口
+ ///
+ /// Constructs a LCIMClient with client id.
+ ///
+ ///
+ ///
+ ///
+ ///
public LCIMClient(string clientId,
string tag = null,
string deviceId = null,
@@ -245,6 +257,13 @@ namespace LeanCloud.Realtime {
SetUpClient(clientId, tag, deviceId, signatureFactory);
}
+ ///
+ /// Constructs a LCIMClient with a LCUser.
+ ///
+ ///
+ ///
+ ///
+ ///
public LCIMClient(LCUser user,
string tag = null,
string deviceId = null,
diff --git a/Realtime/Realtime/Public/LCRealtime.cs b/Realtime/Realtime/Public/LCRealtime.cs
index 08d7c19..9b70960 100644
--- a/Realtime/Realtime/Public/LCRealtime.cs
+++ b/Realtime/Realtime/Public/LCRealtime.cs
@@ -2,6 +2,9 @@
using LeanCloud.Realtime.Internal.Connection;
namespace LeanCloud.Realtime {
+ ///
+ /// LCRealtime contains static functions that handle the global connection.
+ ///
public class LCRealtime {
///
/// Every application uses a connection.
diff --git a/Realtime/Realtime/Public/Message/LCIMAudioMessage.cs b/Realtime/Realtime/Public/Message/LCIMAudioMessage.cs
index cf80bec..f7103a5 100644
--- a/Realtime/Realtime/Public/Message/LCIMAudioMessage.cs
+++ b/Realtime/Realtime/Public/Message/LCIMAudioMessage.cs
@@ -2,6 +2,9 @@
using LeanCloud.Storage;
namespace LeanCloud.Realtime {
+ ///
+ /// LCIMAudioMessage is a local representation of audio message in LeanCloud.
+ ///
public class LCIMAudioMessage : LCIMFileMessage {
public double Duration {
get; private set;
diff --git a/Realtime/Realtime/Public/Message/LCIMBinaryMessage.cs b/Realtime/Realtime/Public/Message/LCIMBinaryMessage.cs
index d0af326..f5d5aa2 100644
--- a/Realtime/Realtime/Public/Message/LCIMBinaryMessage.cs
+++ b/Realtime/Realtime/Public/Message/LCIMBinaryMessage.cs
@@ -1,4 +1,7 @@
namespace LeanCloud.Realtime {
+ ///
+ /// LCIMBinaryMessage is a local representation of binary message in LeanCloud.
+ ///
public class LCIMBinaryMessage : LCIMMessage {
public byte[] Data {
get; internal set;
diff --git a/Realtime/Realtime/Public/Message/LCIMFileMessage.cs b/Realtime/Realtime/Public/Message/LCIMFileMessage.cs
index 1c8656c..d5fc485 100644
--- a/Realtime/Realtime/Public/Message/LCIMFileMessage.cs
+++ b/Realtime/Realtime/Public/Message/LCIMFileMessage.cs
@@ -5,6 +5,9 @@ using LeanCloud.Storage;
using System.Threading.Tasks;
namespace LeanCloud.Realtime {
+ ///
+ /// LCIMFileMessage is a local representation of file message in LeanCloud.
+ ///
public class LCIMFileMessage : LCIMTextMessage {
public LCFile File {
get; set;
diff --git a/Realtime/Realtime/Public/Message/LCIMImageMessage.cs b/Realtime/Realtime/Public/Message/LCIMImageMessage.cs
index 07679ed..5fd2a97 100644
--- a/Realtime/Realtime/Public/Message/LCIMImageMessage.cs
+++ b/Realtime/Realtime/Public/Message/LCIMImageMessage.cs
@@ -2,6 +2,9 @@
using LeanCloud.Storage;
namespace LeanCloud.Realtime {
+ ///
+ /// LCIMImageMessage is a local representation of image message in LeanCloud.
+ ///
public class LCIMImageMessage : LCIMFileMessage {
public int Width {
get; private set;
diff --git a/Realtime/Realtime/Public/Message/LCIMLocationMessage.cs b/Realtime/Realtime/Public/Message/LCIMLocationMessage.cs
index 44fde3b..6ebf596 100644
--- a/Realtime/Realtime/Public/Message/LCIMLocationMessage.cs
+++ b/Realtime/Realtime/Public/Message/LCIMLocationMessage.cs
@@ -3,6 +3,9 @@ using System.Collections.Generic;
using LeanCloud.Storage;
namespace LeanCloud.Realtime {
+ ///
+ /// LCIMLocationMessage is a local representation of location message in LeanCloud.
+ ///
public class LCIMLocationMessage : LCIMTextMessage {
public LCGeoPoint Location {
get; set;
diff --git a/Realtime/Realtime/Public/Message/LCIMTextMessage.cs b/Realtime/Realtime/Public/Message/LCIMTextMessage.cs
index e9cee7b..5c834fa 100644
--- a/Realtime/Realtime/Public/Message/LCIMTextMessage.cs
+++ b/Realtime/Realtime/Public/Message/LCIMTextMessage.cs
@@ -1,6 +1,9 @@
using System.Collections.Generic;
namespace LeanCloud.Realtime {
+ ///
+ /// LCIMTextMessage is a local representation of text message in LeanCloud.
+ ///
public class LCIMTextMessage : LCIMTypedMessage {
public string Text {
get; set;
diff --git a/Realtime/Realtime/Public/Message/LCIMVideoMessage.cs b/Realtime/Realtime/Public/Message/LCIMVideoMessage.cs
index c49ce9f..0fe119a 100644
--- a/Realtime/Realtime/Public/Message/LCIMVideoMessage.cs
+++ b/Realtime/Realtime/Public/Message/LCIMVideoMessage.cs
@@ -2,6 +2,9 @@
using LeanCloud.Storage;
namespace LeanCloud.Realtime {
+ ///
+ /// LCIMVideoMessage is a local representation of video message in LeanCloud.
+ ///
public class LCIMVideoMessage : LCIMFileMessage {
public int Width {
get; private set;
diff --git a/Realtime/Realtime/Public/Result/LCIMOperationFailure.cs b/Realtime/Realtime/Public/Result/LCIMOperationFailure.cs
index 1f95229..543c959 100644
--- a/Realtime/Realtime/Public/Result/LCIMOperationFailure.cs
+++ b/Realtime/Realtime/Public/Result/LCIMOperationFailure.cs
@@ -1,6 +1,9 @@
using System.Collections.Generic;
namespace LeanCloud.Realtime {
+ ///
+ /// LCIMOperationFailure is the failed result of a conversation operation.
+ ///
public class LCIMOperationFailure {
public int Code {
get; set;
diff --git a/Realtime/Realtime/Public/Result/LCIMPageResult.cs b/Realtime/Realtime/Public/Result/LCIMPageResult.cs
index a559db6..47c966b 100644
--- a/Realtime/Realtime/Public/Result/LCIMPageResult.cs
+++ b/Realtime/Realtime/Public/Result/LCIMPageResult.cs
@@ -1,6 +1,9 @@
using System.Collections.ObjectModel;
namespace LeanCloud.Realtime {
+ ///
+ /// LCIMPageResult represents the query results.
+ ///
public class LCIMPageResult {
public ReadOnlyCollection Results {
get; internal set;
diff --git a/Realtime/Realtime/Public/Result/LCIMPartiallySuccessResult.cs b/Realtime/Realtime/Public/Result/LCIMPartiallySuccessResult.cs
index 86f61e5..ab46cab 100644
--- a/Realtime/Realtime/Public/Result/LCIMPartiallySuccessResult.cs
+++ b/Realtime/Realtime/Public/Result/LCIMPartiallySuccessResult.cs
@@ -1,6 +1,9 @@
using System.Collections.Generic;
namespace LeanCloud.Realtime {
+ ///
+ /// LCIMPartiallySuccessResult is the partially successful result of a conversation operation.
+ ///
public class LCIMPartiallySuccessResult {
public List SuccessfulClientIdList {
get; internal set;
diff --git a/Realtime/Realtime/Public/Signature/ILCIMSignatureFactory.cs b/Realtime/Realtime/Public/Signature/ILCIMSignatureFactory.cs
index 47efa91..3d9e76e 100644
--- a/Realtime/Realtime/Public/Signature/ILCIMSignatureFactory.cs
+++ b/Realtime/Realtime/Public/Signature/ILCIMSignatureFactory.cs
@@ -2,6 +2,9 @@
using System.Threading.Tasks;
namespace LeanCloud.Realtime {
+ ///
+ /// ILCIMSignatureFactory is an interface that creates a LCRealtime signature.
+ ///
public interface ILCIMSignatureFactory {
Task CreateConnectSignature(string clientId);
diff --git a/Realtime/Realtime/Public/Signature/LCIMSignature.cs b/Realtime/Realtime/Public/Signature/LCIMSignature.cs
index 416b86d..1207f52 100644
--- a/Realtime/Realtime/Public/Signature/LCIMSignature.cs
+++ b/Realtime/Realtime/Public/Signature/LCIMSignature.cs
@@ -1,4 +1,7 @@
namespace LeanCloud.Realtime {
+ ///
+ /// LCIMSignature represents a LCRealtime signature.
+ ///
public class LCIMSignature {
public string Signature {
get; set;
diff --git a/Storage/Storage.AOT/Storage.AOT.csproj b/Storage/Storage.AOT/Storage.AOT.csproj
index 88a3764..fc40119 100644
--- a/Storage/Storage.AOT/Storage.AOT.csproj
+++ b/Storage/Storage.AOT/Storage.AOT.csproj
@@ -56,9 +56,6 @@
Storage\Public\LCGeoPoint.cs
-
- Storage\Public\LCStorage.cs
-
Storage\Public\LCUserAuthDataLoginOption.cs
@@ -155,5 +152,8 @@
Storage\Internal\Query\LCCompositionalCondition.cs
+
+ Storage\Internal\LCStorage.cs
+
diff --git a/Storage/Storage.Standard/Public/LCApplication.cs b/Storage/Storage.Standard/Public/LCApplication.cs
index bddc77c..885814b 100644
--- a/Storage/Storage.Standard/Public/LCApplication.cs
+++ b/Storage/Storage.Standard/Public/LCApplication.cs
@@ -1,5 +1,5 @@
using LeanCloud.Common;
-using LeanCloud.Storage;
+using LeanCloud.Storage.Internal;
namespace LeanCloud {
public class LCApplication {
diff --git a/Storage/Storage.Test/LeaderboardTest.cs b/Storage/Storage.Test/LeaderboardTest.cs
index a294ac4..8d258a6 100644
--- a/Storage/Storage.Test/LeaderboardTest.cs
+++ b/Storage/Storage.Test/LeaderboardTest.cs
@@ -14,6 +14,7 @@ namespace Storage.Test {
[SetUp]
public void SetUp() {
+ LCLogger.LogDelegate += Utils.Print;
LCApplication.Initialize(Utils.AppId, Utils.AppKey, Utils.AppServer, Utils.MasterKey);
LCApplication.UseMasterKey = true;
leaderboardName = $"Leaderboard_{DateTimeOffset.Now.DayOfYear}";
diff --git a/Storage/Storage.Unity/Public/LCApplication.cs b/Storage/Storage.Unity/Public/LCApplication.cs
index 56b7287..28b390d 100644
--- a/Storage/Storage.Unity/Public/LCApplication.cs
+++ b/Storage/Storage.Unity/Public/LCApplication.cs
@@ -1,9 +1,17 @@
using LeanCloud.Common;
-using LeanCloud.Storage;
+using LeanCloud.Storage.Internal;
using LeanCloud.Storage.Internal.Persistence;
namespace LeanCloud {
+ ///
+ /// LCApplication contains static functions that handle global configuration
+ /// for LeanCloud services.
+ ///
public class LCApplication {
+ ///
+ /// Uses the master key or not.
+ /// The default is false.
+ ///
public static bool UseMasterKey {
get => LCCore.UseMasterKey;
set {
@@ -11,6 +19,13 @@ namespace LeanCloud {
}
}
+ ///
+ /// Initialize LeanCloud services.
+ ///
+ /// The application id provided in LeanCloud dashboard.
+ /// The application key provided in LeanCloud dashboard.
+ /// The server url, typically consist of your own domain.
+ /// The application master key provided in LeanCloud dashboard.
public static void Initialize(string appId,
string appKey,
string server = null,
diff --git a/Storage/Storage/Public/LCStorage.cs b/Storage/Storage/Internal/LCStorage.cs
similarity index 94%
rename from Storage/Storage/Public/LCStorage.cs
rename to Storage/Storage/Internal/LCStorage.cs
index 9b5635d..3054274 100644
--- a/Storage/Storage/Public/LCStorage.cs
+++ b/Storage/Storage/Internal/LCStorage.cs
@@ -1,7 +1,6 @@
-using System;
-using LeanCloud.Common;
+using LeanCloud.Common;
-namespace LeanCloud.Storage {
+namespace LeanCloud.Storage.Internal {
public class LCStorage {
private const string SessionHeaderKey = "X-LC-Session";
diff --git a/Storage/Storage/Public/LCACL.cs b/Storage/Storage/Public/LCACL.cs
index 3180eae..16646f9 100644
--- a/Storage/Storage/Public/LCACL.cs
+++ b/Storage/Storage/Public/LCACL.cs
@@ -3,21 +3,28 @@ using System.Collections.Generic;
namespace LeanCloud.Storage {
///
- /// LeanCloud Access Control Lists.
+ /// LCACL is used to control which users and roles can access or modify
+ /// a particular object. Each LCObject can have its own LCACL.
///
public class LCACL {
const string PublicKey = "*";
const string RoleKeyPrefix = "role:";
- public Dictionary ReadAccess {
+ internal Dictionary ReadAccess {
get;
} = new Dictionary();
- public Dictionary WriteAccess {
+ internal Dictionary WriteAccess {
get;
} = new Dictionary();
+ ///
+ /// Creates a LCACL that is allowed to read and write this object
+ /// for the user.
+ ///
+ /// The user.
+ ///
public static LCACL CreateWithOwner(LCUser owner) {
if (owner == null) {
throw new ArgumentNullException(nameof(owner));
@@ -28,6 +35,9 @@ namespace LeanCloud.Storage {
return acl;
}
+ ///
+ /// Gets or sets whether everyone is allowed to read this object.
+ ///
public bool PublicReadAccess {
get {
return GetAccess(ReadAccess, PublicKey);
@@ -36,6 +46,9 @@ namespace LeanCloud.Storage {
}
}
+ ///
+ /// Gets or sets whether everyone is allowed to write this object.
+ ///
public bool PublicWriteAccess {
get {
return GetAccess(WriteAccess, PublicKey);
@@ -44,6 +57,14 @@ namespace LeanCloud.Storage {
}
}
+ ///
+ /// Detects whether the given user id is *explicitly* allowed to read this
+ /// object. Even if this returns false, the user may still be able to read
+ /// it if is true or a role that the user
+ /// belongs to has read access.
+ ///
+ /// The user ObjectId to check.
+ ///
public bool GetUserIdReadAccess(string userId) {
if (string.IsNullOrEmpty(userId)) {
throw new ArgumentNullException(nameof(userId));
@@ -51,6 +72,11 @@ namespace LeanCloud.Storage {
return GetAccess(ReadAccess, userId);
}
+ ///
+ /// Set whether the given user id is allowed to read this object.
+ ///
+ /// The ObjectId of the user.
+ /// Whether the user has permission.
public void SetUserIdReadAccess(string userId, bool value) {
if (string.IsNullOrEmpty(userId)) {
throw new ArgumentNullException(nameof(userId));
@@ -58,6 +84,13 @@ namespace LeanCloud.Storage {
SetAccess(ReadAccess, userId, value);
}
+ ///
+ /// Detects whether the given user id is *explicitly* allowed to write this
+ /// object. Even if this returns false, the user may still be able to write
+ /// it if is true or a role that the user
+ /// belongs to has read access.
+ ///
+ /// T
public bool GetUserIdWriteAccess(string userId) {
if (string.IsNullOrEmpty(userId)) {
throw new ArgumentNullException(nameof(userId));
@@ -65,6 +98,11 @@ namespace LeanCloud.Storage {
return GetAccess(WriteAccess, userId);
}
+ ///
+ /// Set whether the given user id is allowed to write this object.
+ ///
+ /// The ObjectId of the user.
+ /// Whether the user has permission.
public void SetUserIdWriteAccess(string userId, bool value) {
if (string.IsNullOrEmpty(userId)) {
throw new ArgumentNullException(nameof(userId));
@@ -72,6 +110,14 @@ namespace LeanCloud.Storage {
SetAccess(WriteAccess, userId, value);
}
+ ///
+ /// Detects whether the given user is *explicitly* allowed to read this
+ /// object. Even if this returns false, the user may still be able to read
+ /// it if is true or a role that the user
+ /// belongs to has read access.
+ ///
+ /// The user to check.
+ ///
public bool GetUserReadAccess(LCUser user) {
if (user == null) {
throw new ArgumentNullException(nameof(user));
@@ -79,6 +125,11 @@ namespace LeanCloud.Storage {
return GetUserIdReadAccess(user.ObjectId);
}
+ ///
+ /// Set whether the given user is allowed to read this object.
+ ///
+ /// The user.
+ /// Whether the user has permission.
public void SetUserReadAccess(LCUser user, bool value) {
if (user == null) {
throw new ArgumentNullException(nameof(user));
@@ -86,6 +137,14 @@ namespace LeanCloud.Storage {
SetUserIdReadAccess(user.ObjectId, value);
}
+ ///
+ /// Detects whether the given user is *explicitly* allowed to write this
+ /// object. Even if this returns false, the user may still be able to write
+ /// it if is true or a role that the user
+ /// belongs to has write access.
+ ///
+ /// The user to check.
+ ///
public bool GetUserWriteAccess(LCUser user) {
if (user == null) {
throw new ArgumentNullException(nameof(user));
@@ -93,6 +152,11 @@ namespace LeanCloud.Storage {
return GetUserIdWriteAccess(user.ObjectId);
}
+ ///
+ /// Set whether the given user is allowed to write this object.
+ ///
+ /// The user.
+ /// Whether the user has permission.
public void SetUserWriteAccess(LCUser user, bool value) {
if (user == null) {
throw new ArgumentNullException(nameof(user));
@@ -100,6 +164,11 @@ namespace LeanCloud.Storage {
SetUserIdWriteAccess(user.ObjectId, value);
}
+ ///
+ /// Detects whether the given role are allowed to read this object.
+ ///
+ /// The role to check.
+ ///
public bool GetRoleReadAccess(LCRole role) {
if (role == null) {
throw new ArgumentNullException(nameof(role));
@@ -108,6 +177,11 @@ namespace LeanCloud.Storage {
return GetAccess(ReadAccess, roleKey);
}
+ ///
+ /// Sets whether the given role are allowed to read this object.
+ ///
+ /// The role.
+ /// Whether the role has access.
public void SetRoleReadAccess(LCRole role, bool value) {
if (role == null) {
throw new ArgumentNullException(nameof(role));
@@ -116,6 +190,11 @@ namespace LeanCloud.Storage {
SetAccess(ReadAccess, roleKey, value);
}
+ ///
+ /// Detects whether the given role are allowed to write this object.
+ ///
+ /// The role to check.
+ ///
public bool GetRoleWriteAccess(LCRole role) {
if (role == null) {
throw new ArgumentNullException(nameof(role));
@@ -124,6 +203,11 @@ namespace LeanCloud.Storage {
return GetAccess(WriteAccess, roleKey);
}
+ ///
+ /// Sets whether the given role are allowed to write this object.
+ ///
+ /// The role.
+ /// Whether the role has access.
public void SetRoleWriteAccess(LCRole role, bool value) {
if (role == null) {
throw new ArgumentNullException(nameof(role));
diff --git a/Storage/Storage/Public/LCCloud.cs b/Storage/Storage/Public/LCCloud.cs
index e957dd4..3fbe1ba 100644
--- a/Storage/Storage/Public/LCCloud.cs
+++ b/Storage/Storage/Public/LCCloud.cs
@@ -6,7 +6,7 @@ using LeanCloud.Storage.Internal.Object;
namespace LeanCloud.Storage {
///
- /// LeanEngine
+ /// LCCloud contains static functions that call LeanEngine cloud functions.
///
public static class LCCloud {
private const string PRODUCTION_KEY = "X-LC-Prod";
@@ -37,6 +37,13 @@ namespace LeanCloud.Storage {
return response;
}
+ ///
+ /// Invokes a cloud function.
+ ///
+ /// The type of return value.
+ /// Cloud function name.
+ /// Parameters of the cloud function.
+ ///
public static async Task Run(string name,
Dictionary parameters = null) {
Dictionary response = await Run(name, parameters);
diff --git a/Storage/Storage/Public/LCFile.cs b/Storage/Storage/Public/LCFile.cs
index d3b356a..69a0875 100644
--- a/Storage/Storage/Public/LCFile.cs
+++ b/Storage/Storage/Public/LCFile.cs
@@ -8,9 +8,15 @@ using LeanCloud.Storage.Internal.Object;
using LeanCloud.Storage.Internal.Codec;
namespace LeanCloud.Storage {
+ ///
+ /// LCFile is a local representation of a LeanCloud file.
+ ///
public class LCFile : LCObject {
public const string CLASS_NAME = "_File";
+ ///
+ /// Gets the name of the file.
+ ///
public string Name {
get {
return this["name"] as string;
@@ -19,6 +25,9 @@ namespace LeanCloud.Storage {
}
}
+ ///
+ /// Gets the MIME type of the file.
+ ///
public string MimeType {
get {
return this["mime_type"] as string;
@@ -27,6 +36,9 @@ namespace LeanCloud.Storage {
}
}
+ ///
+ /// Gets the url of the file.
+ ///
public string Url {
get {
return this["url"] as string;
@@ -35,6 +47,9 @@ namespace LeanCloud.Storage {
}
}
+ ///
+ /// Gets the metadata of the file.
+ ///
public Dictionary MetaData {
get {
return this["metaData"] as Dictionary;
@@ -45,30 +60,59 @@ namespace LeanCloud.Storage {
readonly Stream stream;
+ ///
+ /// Creates a new file.
+ ///
public LCFile() : base(CLASS_NAME) {
MetaData = new Dictionary();
}
+ ///
+ /// Creates a new file from a byte array.
+ ///
+ ///
+ ///
public LCFile(string name, byte[] bytes) : this() {
Name = name;
stream = new MemoryStream(bytes);
}
+ ///
+ /// Creates a new file from a local file.
+ ///
+ ///
+ ///
public LCFile(string name, string path) : this() {
Name = name;
MimeType = LCMimeTypeMap.GetMimeType(path);
stream = new FileStream(path, FileMode.Open);
}
+ ///
+ /// Creates a new external file from an url.
+ /// The file content is saved externally, not copied to LeanCloud.
+ ///
+ ///
+ ///
public LCFile(string name, Uri url) : this() {
Name = name;
Url = url.AbsoluteUri;
}
+ ///
+ /// Adds metadata.
+ ///
+ ///
+ ///
public void AddMetaData(string key, object value) {
MetaData[key] = value;
}
+ ///
+ /// Saves the file to LeanCloud.
+ ///
+ ///
+ ///
public async Task Save(Action onProgress = null) {
if (!string.IsNullOrEmpty(Url)) {
// 外链方式
@@ -109,6 +153,10 @@ namespace LeanCloud.Storage {
return this;
}
+ ///
+ /// Deletes the file from LeanCloud.
+ ///
+ ///
public new async Task Delete() {
if (string.IsNullOrEmpty(ObjectId)) {
return;
@@ -117,6 +165,15 @@ namespace LeanCloud.Storage {
await LCCore.HttpClient.Delete(path);
}
+ ///
+ /// Gets the thumbnail url of an image file.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public string GetThumbnailUrl(int width, int height, int quality = 100, bool scaleToFit = true, string format = "png") {
int mode = scaleToFit ? 2 : 1;
return $"{Url}?imageView/{mode}/w/{width}/h/{height}/q/{quality}/format/{format}";
@@ -135,6 +192,10 @@ namespace LeanCloud.Storage {
return await LCCore.HttpClient.Post>("fileTokens", data: data);
}
+ ///
+ /// Gets LCQuery of LCFile.
+ ///
+ ///
public static LCQuery GetQuery() {
return new LCQuery(CLASS_NAME);
}
diff --git a/Storage/Storage/Public/LCFollowersAndFollowees.cs b/Storage/Storage/Public/LCFollowersAndFollowees.cs
index 3677490..513f627 100644
--- a/Storage/Storage/Public/LCFollowersAndFollowees.cs
+++ b/Storage/Storage/Public/LCFollowersAndFollowees.cs
@@ -1,19 +1,34 @@
using System.Collections.Generic;
namespace LeanCloud.Storage {
+ ///
+ /// LCFollowersAndFollowees contains followers and followees.
+ ///
public class LCFollowersAndFollowees {
+ ///
+ /// The followers.
+ ///
public List Followers {
get; internal set;
}
+ ///
+ /// The followees.
+ ///
public List Followees {
get; internal set;
}
+ ///
+ /// The count of followers.
+ ///
public int FollowersCount {
get; internal set;
}
+ ///
+ /// The count of followees.
+ ///
public int FolloweesCount {
get; internal set;
}
diff --git a/Storage/Storage/Public/LCFriendship.cs b/Storage/Storage/Public/LCFriendship.cs
index d128d84..f876e7a 100644
--- a/Storage/Storage/Public/LCFriendship.cs
+++ b/Storage/Storage/Public/LCFriendship.cs
@@ -5,7 +5,16 @@ using LeanCloud.Common;
using LeanCloud.Storage.Internal.Codec;
namespace LeanCloud.Storage {
+ ///
+ /// LCFriendship contains static functions that handle LCFriendship.
+ ///
public static class LCFriendship {
+ ///
+ /// Requests to add a friend.
+ ///
+ /// The user id to add.
+ /// The additional attributes for the friendship.
+ ///
public static async Task Request(string userId, Dictionary attributes = null) {
LCUser user = await LCUser.GetCurrent();
if (user == null) {
@@ -23,6 +32,12 @@ namespace LeanCloud.Storage {
await LCCore.HttpClient.Post>(path, data: data);
}
+ ///
+ /// Accepts a friend request.
+ ///
+ /// The request.
+ /// The additional attributes for the friendship.
+ ///
public static async Task AcceptRequest(LCFriendshipRequest request, Dictionary attributes = null) {
if (request == null) {
throw new ArgumentNullException(nameof(request));
@@ -37,6 +52,11 @@ namespace LeanCloud.Storage {
await LCCore.HttpClient.Put>(path, data: data);
}
+ ///
+ /// Declines a friend request.
+ ///
+ /// The request.
+ ///
public static async Task DeclineRequest(LCFriendshipRequest request) {
if (request == null) {
throw new ArgumentNullException(nameof(request));
diff --git a/Storage/Storage/Public/LCFriendshipRequest.cs b/Storage/Storage/Public/LCFriendshipRequest.cs
index 6306a62..0dddfc3 100644
--- a/Storage/Storage/Public/LCFriendshipRequest.cs
+++ b/Storage/Storage/Public/LCFriendshipRequest.cs
@@ -1,4 +1,8 @@
namespace LeanCloud.Storage {
+ ///
+ /// LCFriendshipRequest is a local representation of a friend request that
+ /// is saved to LeanCloud.
+ ///
public class LCFriendshipRequest : LCObject {
public const string CLASS_NAME = "_FriendshipRequest";
diff --git a/Storage/Storage/Public/LCGeoPoint.cs b/Storage/Storage/Public/LCGeoPoint.cs
index 1cb3f44..20d7f4e 100644
--- a/Storage/Storage/Public/LCGeoPoint.cs
+++ b/Storage/Storage/Public/LCGeoPoint.cs
@@ -1,26 +1,49 @@
using System;
namespace LeanCloud.Storage {
+ ///
+ /// LCGeoPoint represents a geographic location that may be associated
+ /// with a key in a LCObject or used as a reference point for queries.
+ ///
public class LCGeoPoint {
+ ///
+ /// Gets the latitude of the LCGeoPoint.
+ ///
public double Latitude {
get;
}
+ ///
+ /// Gets the longitude of the LCGeoPoint.
+ ///
public double Longitude {
get;
}
+ ///
+ /// Constructs a LCGeoPoint with the specified latitude and longitude.
+ ///
+ ///
+ ///
public LCGeoPoint(double latitude, double longtitude) {
Latitude = latitude;
Longitude = longtitude;
}
+ ///
+ /// The original LCGeoPoint.
+ ///
public static LCGeoPoint Origin {
get {
return new LCGeoPoint(0, 0);
}
}
+ ///
+ /// Calculate the distance in kilometers between this point and another GeoPoint.
+ ///
+ ///
+ ///
public double KilometersTo(LCGeoPoint point) {
if (point == null) {
throw new ArgumentNullException(nameof(point));
@@ -28,6 +51,11 @@ namespace LeanCloud.Storage {
return RadiansTo(point) * 6371.0;
}
+ ///
+ /// Calculate the distance in miles between this point and another GeoPoint.
+ ///
+ ///
+ ///
public double MilesTo(LCGeoPoint point) {
if (point == null) {
throw new ArgumentNullException(nameof(point));
@@ -35,6 +63,11 @@ namespace LeanCloud.Storage {
return RadiansTo(point) * 3958.8;
}
+ ///
+ /// Calculate the distance in radians between this point and another GeoPoint.
+ ///
+ ///
+ ///
public double RadiansTo(LCGeoPoint point) {
if (point == null) {
throw new ArgumentNullException(nameof(point));
diff --git a/Storage/Storage/Public/LCHookObject.cs b/Storage/Storage/Public/LCHookObject.cs
index afb8568..ea25051 100644
--- a/Storage/Storage/Public/LCHookObject.cs
+++ b/Storage/Storage/Public/LCHookObject.cs
@@ -5,6 +5,9 @@ using System.Linq;
using LeanCloud.Storage.Internal.Operation;
namespace LeanCloud.Storage {
+ ///
+ /// LCClassHook represents the hooks for saving / updating / deleting LCObject.
+ ///
public static class LCClassHook {
public const string BeforeSave = "beforeSave";
public const string AfterSave = "afterSave";
@@ -17,6 +20,9 @@ namespace LeanCloud.Storage {
public partial class LCObject {
internal const string IgnoreHooksKey = "__ignore_hooks";
+ ///
+ /// Disable hooks before saving / updating / deleting LCObject.
+ ///
public void DisableBeforeHook() {
Ignore(
LCClassHook.BeforeSave,
@@ -24,6 +30,9 @@ namespace LeanCloud.Storage {
LCClassHook.BeforeDelete);
}
+ ///
+ /// Disable hooks after saving / updating / deleting LCObject.
+ ///
public void DisableAfterHook() {
Ignore(
LCClassHook.AfterSave,
@@ -31,6 +40,10 @@ namespace LeanCloud.Storage {
LCClassHook.AfterDelete);
}
+ ///
+ /// Ignores the hook for this LCObject.
+ ///
+ ///
public void IgnoreHook(string hookName) {
if (hookName != LCClassHook.BeforeSave && hookName != LCClassHook.AfterSave &&
hookName != LCClassHook.BeforeUpdate && hookName != LCClassHook.AfterUpdate &&
@@ -46,6 +59,10 @@ namespace LeanCloud.Storage {
ApplyOperation(IgnoreHooksKey, op);
}
+ ///
+ /// Gets the updated keys of this LCObject.
+ ///
+ ///
public ReadOnlyCollection GetUpdatedKeys() {
if (this["_updatedKeys"] == null) {
return null;
diff --git a/Storage/Storage/Public/LCObject.cs b/Storage/Storage/Public/LCObject.cs
index 0b2398c..38d5e9c 100644
--- a/Storage/Storage/Public/LCObject.cs
+++ b/Storage/Storage/Public/LCObject.cs
@@ -11,51 +11,60 @@ using LeanCloud.Storage.Internal.Codec;
namespace LeanCloud.Storage {
///
- /// LeanCloud Object
+ /// The LCObject is a local representation of data that can be saved and
+ /// retrieved from the LeanCloud.
///
public partial class LCObject {
- ///
- /// Last synced data.
- ///
internal LCObjectData data;
- ///
- /// Estimated data.
- ///
internal Dictionary estimatedData;
- ///
- /// Operations.
- ///
internal Dictionary operationDict;
static readonly Dictionary subclassTypeDict = new Dictionary();
static readonly Dictionary subclassNameDict = new Dictionary();
+ ///
+ /// Gets the class name for the LCObject.
+ ///
public string ClassName {
get {
return data.ClassName;
}
}
+ ///
+ /// Gets the object id. An object id is assigned as soon as an object is
+ /// saved to the server. The combination of a and
+ /// an uniquely identifies an object in your application.
+ ///
public string ObjectId {
get {
return data.ObjectId;
}
}
+ ///
+ /// Gets the creation time of this object in the cloud.
+ ///
public DateTime CreatedAt {
get {
return data.CreatedAt;
}
}
+ ///
+ /// Gets the latest update time of this object in the cloud.
+ ///
public DateTime UpdatedAt {
get {
return data.UpdatedAt;
}
}
+ ///
+ /// Gets or sets the LCACL governing this object.
+ ///
public LCACL ACL {
get {
return this["ACL"] as LCACL ;
@@ -72,6 +81,12 @@ namespace LeanCloud.Storage {
}
}
+ ///
+ /// Constructs a new LCObject with no data in it. A LCObject constructed
+ /// in this way will not have an ObjectedId and will not persist in the cloud
+ /// until is called.
+ ///
+ /// The className for the LCObject.
public LCObject(string className) {
if (string.IsNullOrEmpty(className)) {
throw new ArgumentNullException(nameof(className));
@@ -84,6 +99,12 @@ namespace LeanCloud.Storage {
isNew = true;
}
+ ///
+ /// Creates a reference to an existing LCObject.
+ ///
+ /// The className for the LCObject.
+ /// The object id for the LCObject.
+ ///
public static LCObject CreateWithoutData(string className, string objectId) {
if (string.IsNullOrEmpty(objectId)) {
throw new ArgumentNullException(nameof(objectId));
@@ -94,6 +115,11 @@ namespace LeanCloud.Storage {
return obj;
}
+ ///
+ /// Creates a new LCObject.
+ ///
+ /// The className for the LCObject.
+ ///
public static LCObject Create(string className) {
if (subclassNameDict.TryGetValue(className, out LCSubclassInfo subclassInfo)) {
return subclassInfo.Constructor.Invoke();
@@ -108,6 +134,12 @@ namespace LeanCloud.Storage {
return null;
}
+ ///
+ /// Gets or sets a value on the object. It is forbidden to name keys
+ /// with a leading underscore ('_').
+ ///
+ /// The name of a key.
+ ///
public object this[string key] {
get {
if (estimatedData.TryGetValue(key, out object value)) {
@@ -148,6 +180,11 @@ namespace LeanCloud.Storage {
}
+ ///
+ /// Creates a value for a key.
+ ///
+ ///
+ ///
public void AddRelation(string key, LCObject value) {
if (string.IsNullOrEmpty(key)) {
throw new ArgumentNullException(nameof(key));
@@ -159,6 +196,11 @@ namespace LeanCloud.Storage {
ApplyOperation(key, op);
}
+ ///
+ /// Removes a value for a key.
+ ///
+ ///
+ ///
public void RemoveRelation(string key, LCObject value) {
if (string.IsNullOrEmpty(key)) {
throw new ArgumentNullException(nameof(key));
@@ -324,6 +366,12 @@ namespace LeanCloud.Storage {
}
}
+ ///
+ /// Saves this object to the cloud.
+ ///
+ /// Whether or not fetch data when saved.
+ /// The condition for saving.
+ ///
public async Task Save(bool fetchWhenSave = false, LCQuery query = null) {
if (LCBatch.HasCircleReference(this, new HashSet())) {
throw new ArgumentException("Found a circle dependency when save.");
@@ -350,6 +398,11 @@ namespace LeanCloud.Storage {
return this;
}
+ ///
+ /// Saves each object in the provided list.
+ ///
+ /// The objects to save.
+ ///
public static async Task> SaveAll(IEnumerable objects) {
if (objects == null) {
throw new ArgumentNullException(nameof(objects));
@@ -364,6 +417,10 @@ namespace LeanCloud.Storage {
return objects.ToList();
}
+ ///
+ /// Deletes this object in the cloud.
+ ///
+ ///
public async Task Delete() {
if (ObjectId == null) {
return;
@@ -372,6 +429,11 @@ namespace LeanCloud.Storage {
await LCCore.HttpClient.Delete(path);
}
+ ///
+ /// Deletes each object in the provided list.
+ ///
+ ///
+ ///
public static async Task DeleteAll(IEnumerable objects) {
if (objects == null || objects.Count() == 0) {
throw new ArgumentNullException(nameof(objects));
@@ -390,6 +452,12 @@ namespace LeanCloud.Storage {
await LCCore.HttpClient.Post>("batch", data: data);
}
+ ///
+ /// Fetches this object from the cloud.
+ ///
+ /// The keys for fetching.
+ /// The include keys for fetching.
+ ///
public async Task Fetch(IEnumerable keys = null, IEnumerable includes = null) {
Dictionary queryParams = new Dictionary();
if (keys != null) {
@@ -405,6 +473,11 @@ namespace LeanCloud.Storage {
return this;
}
+ ///
+ /// Fetches all of the objects in the provided list.
+ ///
+ /// The objects for fetching.
+ ///
public static async Task> FetchAll(IEnumerable objects) {
if (objects == null || objects.Count() == 0) {
throw new ArgumentNullException(nameof(objects));
@@ -442,6 +515,13 @@ namespace LeanCloud.Storage {
return objects;
}
+ ///
+ /// Registers a custom subclass type with LeanCloud SDK, enabling strong-typing
+ /// of those LCObjects whenever they appear.
+ ///
+ /// The LCObject subclass type to register.
+ /// The className on server.
+ /// The constructor for creating an object.
public static void RegisterSubclass(string className, Func constructor) where T : LCObject {
Type classType = typeof(T);
LCSubclassInfo subclassInfo = new LCSubclassInfo(className, classType, constructor);
diff --git a/Storage/Storage/Public/LCQuery.cs b/Storage/Storage/Public/LCQuery.cs
index 5e37364..0bb7935 100644
--- a/Storage/Storage/Public/LCQuery.cs
+++ b/Storage/Storage/Public/LCQuery.cs
@@ -9,7 +9,13 @@ using LeanCloud.Storage.Internal.Query;
using LeanCloud.Storage.Internal.Object;
namespace LeanCloud.Storage {
+ ///
+ /// The LCQuery class defines a query that is used to fetch LCObjects.
+ ///
public class LCQuery {
+ ///
+ /// The classname of this query.
+ ///
public string ClassName {
get; internal set;
}
@@ -18,6 +24,10 @@ namespace LeanCloud.Storage {
get; internal set;
}
+ ///
+ /// Constructs a LCQuery for class.
+ ///
+ ///
public LCQuery(string className) {
ClassName = className;
Condition = new LCCompositionalCondition();
@@ -172,16 +182,35 @@ namespace LeanCloud.Storage {
return this;
}
+ ///
+ /// The value corresponding to key is near the point.
+ ///
+ ///
+ ///
+ ///
public LCQuery WhereNear(string key, LCGeoPoint point) {
Condition.WhereNear(key, point);
return this;
}
+ ///
+ /// The value corresponding to key is in the given rectangular geographic bounding box.
+ ///
+ ///
+ ///
+ ///
+ ///
public LCQuery WhereWithinGeoBox(string key, LCGeoPoint southwest, LCGeoPoint northeast) {
Condition.WhereWithinGeoBox(key, southwest, northeast);
return this;
}
+ ///
+ /// The value corresponding to key is related to the parent.
+ ///
+ ///
+ ///
+ ///
public LCQuery WhereRelatedTo(LCObject parent, string key) {
Condition.WhereRelatedTo(parent, key);
return this;
@@ -255,13 +284,21 @@ namespace LeanCloud.Storage {
return this;
}
-
+ ///
+ /// Sorts the results in ascending order by the given key.
+ ///
+ ///
+ ///
public LCQuery OrderByAscending(string key) {
Condition.OrderByAscending(key);
return this;
}
-
+ ///
+ /// Sorts the results in descending order by the given key.
+ ///
+ ///
+ ///
public LCQuery OrderByDescending(string key) {
Condition.OrderByDescending(key);
return this;
@@ -338,6 +375,10 @@ namespace LeanCloud.Storage {
return this;
}
+ ///
+ /// Counts the number of objects that match this query.
+ ///
+ ///
public async Task Count() {
string path = $"classes/{ClassName}";
Dictionary parameters = BuildParams();
@@ -347,6 +388,12 @@ namespace LeanCloud.Storage {
return (int)ret["count"];
}
+ ///
+ /// Constructs a LCObject whose id is already known by fetching data
+ /// from the cloud.
+ ///
+ ///
+ ///
public async Task Get(string objectId) {
if (string.IsNullOrEmpty(objectId)) {
throw new ArgumentNullException(nameof(objectId));
@@ -363,6 +410,10 @@ namespace LeanCloud.Storage {
return DecodeLCObject(response);
}
+ ///
+ /// Retrieves a list of LCObjects that satisfy the query from Server.
+ ///
+ ///
public async Task> Find() {
string path = $"classes/{ClassName}";
Dictionary parameters = BuildParams();
@@ -376,6 +427,10 @@ namespace LeanCloud.Storage {
return list.AsReadOnly();
}
+ ///
+ /// Retrieves at most one LCObject that satisfies this query.
+ ///
+ ///
public async Task First() {
Limit(1);
ReadOnlyCollection results = await Find();
@@ -385,6 +440,11 @@ namespace LeanCloud.Storage {
return null;
}
+ ///
+ /// Constructs a query that is the and of the given queries.
+ ///
+ ///
+ ///
public static LCQuery And(IEnumerable> queries) {
if (queries == null || queries.Count() < 1) {
throw new ArgumentNullException(nameof(queries));
@@ -402,6 +462,11 @@ namespace LeanCloud.Storage {
return compositionQuery;
}
+ ///
+ /// Constructs a query that is the or of the given queries.
+ ///
+ ///
+ ///
public static LCQuery Or(IEnumerable> queries) {
if (queries == null || queries.Count() < 1) {
throw new ArgumentNullException(nameof(queries));
diff --git a/Storage/Storage/Public/LCRelation.cs b/Storage/Storage/Public/LCRelation.cs
index bc989ef..cfeb47a 100644
--- a/Storage/Storage/Public/LCRelation.cs
+++ b/Storage/Storage/Public/LCRelation.cs
@@ -1,21 +1,40 @@
namespace LeanCloud.Storage {
-
+ ///
+ /// LCRelation provides access to all of the children of a many-to-many
+ /// relationship.
+ ///
+ /// The type of the child objects.
public class LCRelation where T : LCObject {
+ ///
+ /// The key of this LCRelation.
+ ///
public string Key {
get; set;
}
+ ///
+ /// The parent of this LCRelation.
+ ///
public LCObject Parent {
get; set;
}
+ ///
+ /// The className of this LCRelation.
+ ///
public string TargetClass {
get; set;
}
+ ///
+ /// Constructs a LCRelation.
+ ///
public LCRelation() {
}
+ ///
+ /// Gets a query that can be used to query the objects in this relation.
+ ///
public LCQuery Query {
get {
LCQuery query = new LCQuery(TargetClass);
diff --git a/Storage/Storage/Public/LCRole.cs b/Storage/Storage/Public/LCRole.cs
index 49d949c..d28fba4 100644
--- a/Storage/Storage/Public/LCRole.cs
+++ b/Storage/Storage/Public/LCRole.cs
@@ -5,7 +5,9 @@
public class LCRole : LCObject {
public const string CLASS_NAME = "_Role";
-
+ ///
+ /// The name of a LCRole.
+ ///
public string Name {
get {
return this["name"] as string;
@@ -40,9 +42,18 @@
}
}
+ ///
+ /// Constructs a LCRole.
+ ///
public LCRole() : base(CLASS_NAME) {
}
+ ///
+ /// Constructs a LCRole with a name and a LCACL.
+ ///
+ ///
+ ///
+ ///
public static LCRole Create(string name, LCACL acl) {
LCRole role = new LCRole() {
Name = name,
diff --git a/Storage/Storage/Public/LCSMSClient.cs b/Storage/Storage/Public/LCSMSClient.cs
index 8f6e9ca..aa85503 100644
--- a/Storage/Storage/Public/LCSMSClient.cs
+++ b/Storage/Storage/Public/LCSMSClient.cs
@@ -61,6 +61,12 @@ namespace LeanCloud.Storage {
await LCCore.HttpClient.Post>(path, data: data);
}
+ ///
+ /// Verifies the mobile number with the verification code.
+ ///
+ ///
+ ///
+ ///
public static async Task VerifyMobilePhone(string mobile, string code) {
string path = $"verifySmsCode/{code}";
Dictionary data = new Dictionary {
diff --git a/Storage/Storage/Public/LCStatus.cs b/Storage/Storage/Public/LCStatus.cs
index 12f166c..57e1e07 100644
--- a/Storage/Storage/Public/LCStatus.cs
+++ b/Storage/Storage/Public/LCStatus.cs
@@ -7,6 +7,9 @@ using LeanCloud.Storage.Internal.Object;
using LC.Newtonsoft.Json;
namespace LeanCloud.Storage {
+ ///
+ /// LCStatus is a local representation of a status in LeanCloud.
+ ///
public class LCStatus : LCObject {
public const string CLASS_NAME = "_Status";
@@ -22,25 +25,42 @@ namespace LeanCloud.Storage {
public const string OwnerKey = "owner";
public const string MessageIdKey = "messageId";
+ ///
+ /// The id of this status.
+ ///
public int MessageId {
get; internal set;
}
+ ///
+ /// The inboxType of this status.
+ ///
public string InboxType {
get; internal set;
}
private LCQuery query;
+ ///
+ /// The data of this status.
+ ///
public Dictionary Data {
get; set;
}
+ ///
+ /// Constructs a LCStatus.
+ ///
public LCStatus() : base(CLASS_NAME) {
InboxType = InboxTypeDefault;
Data = new Dictionary();
}
+ ///
+ /// Sends the status to the followers of this user.
+ ///
+ ///
+ ///
public static async Task SendToFollowers(LCStatus status) {
if (status == null) {
throw new ArgumentNullException(nameof(status));
@@ -62,6 +82,12 @@ namespace LeanCloud.Storage {
return await status.Send();
}
+ ///
+ /// Sends the status to the user with targetId in private.
+ ///
+ ///
+ ///
+ ///
public static async Task SendPrivately(LCStatus status, string targetId) {
if (status == null) {
throw new ArgumentNullException(nameof(status));
@@ -84,6 +110,10 @@ namespace LeanCloud.Storage {
return await status.Send();
}
+ ///
+ /// Sends this status.
+ ///
+ ///
public async Task Send() {
LCUser user = await LCUser.GetCurrent();
if (user == null) {
@@ -118,6 +148,10 @@ namespace LeanCloud.Storage {
return this;
}
+ ///
+ /// Deletes this status.
+ ///
+ ///
public new async Task Delete() {
LCUser user = await LCUser.GetCurrent();
if (user == null) {
@@ -137,6 +171,11 @@ namespace LeanCloud.Storage {
}
}
+ ///
+ /// Gets the count of the status with inboxType.
+ ///
+ ///
+ ///
public static async Task GetCount(string inboxType) {
LCUser user = await LCUser.GetCurrent();
if (user == null) {
@@ -158,6 +197,11 @@ namespace LeanCloud.Storage {
return statusCount;
}
+ ///
+ /// Resets the count of the status to be zero.
+ ///
+ ///
+ ///
public static async Task ResetUnreadCount(string inboxType = null) {
LCUser user = await LCUser.GetCurrent();
if (user == null) {
diff --git a/Storage/Storage/Public/LCStatusCount.cs b/Storage/Storage/Public/LCStatusCount.cs
index 56ce6b4..763ada3 100644
--- a/Storage/Storage/Public/LCStatusCount.cs
+++ b/Storage/Storage/Public/LCStatusCount.cs
@@ -1,9 +1,18 @@
namespace LeanCloud.Storage {
+ ///
+ /// LCStatusCount is a result that contains the count of status.
+ ///
public class LCStatusCount {
+ ///
+ /// The total count.
+ ///
public int Total {
get; set;
}
+ ///
+ /// The unread count.
+ ///
public int Unread {
get; set;
}
diff --git a/Storage/Storage/Public/LCStatusQuery.cs b/Storage/Storage/Public/LCStatusQuery.cs
index b3de9c5..a6a8e03 100644
--- a/Storage/Storage/Public/LCStatusQuery.cs
+++ b/Storage/Storage/Public/LCStatusQuery.cs
@@ -9,25 +9,45 @@ using LeanCloud.Storage.Internal.Codec;
using LeanCloud.Storage.Internal.Object;
namespace LeanCloud.Storage {
+ ///
+ /// LCStatusQuery is the query of LCStatus.
+ ///
public class LCStatusQuery : LCQuery {
+ ///
+ /// The inbox type for query.
+ ///
public string InboxType {
get; set;
}
+ ///
+ /// The since id for the query.
+ ///
public int SinceId {
get; set;
}
+ ///
+ /// The max id for the query.
+ ///
public int MaxId {
get; set;
}
+ ///
+ /// Constructs a LCStatusQuery with inboxType.
+ ///
+ ///
public LCStatusQuery(string inboxType = LCStatus.InboxTypeDefault) : base("_Status") {
InboxType = inboxType;
SinceId = 0;
MaxId = 0;
}
+ ///
+ /// Retrieves a list of LCStatus that satisfy the query from the cloud.
+ ///
+ ///
public new async Task> Find() {
LCUser user = await LCUser.GetCurrent();
if (user == null) {
diff --git a/Storage/Storage/Public/LCUser.cs b/Storage/Storage/Public/LCUser.cs
index cf03635..c1883b9 100644
--- a/Storage/Storage/Public/LCUser.cs
+++ b/Storage/Storage/Public/LCUser.cs
@@ -6,6 +6,9 @@ using LeanCloud.Common;
using LeanCloud.Storage.Internal.Object;
namespace LeanCloud.Storage {
+ ///
+ /// LCUser represents a user for a LeanCloud application.
+ ///
public class LCUser : LCObject {
public const string CLASS_NAME = "_User";
@@ -79,6 +82,11 @@ namespace LeanCloud.Storage {
static LCUser currentUser;
+ ///
+ /// Gets the currently logged in LCUser with a valid session, from
+ /// memory or disk if necessary.
+ ///
+ ///
public static async Task GetCurrent() {
if (currentUser != null) {
return currentUser;
@@ -700,6 +708,13 @@ namespace LeanCloud.Storage {
.Include("followee");
}
+ ///
+ /// Gets the followers and followees of the currently logged in user.
+ ///
+ ///
+ ///
+ ///
+ ///
public async Task GetFollowersAndFollowees(bool includeFollower = false,
bool includeFollowee = false, bool returnCount = false) {
Dictionary queryParams = new Dictionary();
diff --git a/Storage/Storage/Public/Leaderboard/LCLeaderboard.cs b/Storage/Storage/Public/Leaderboard/LCLeaderboard.cs
index 9cab449..0730081 100644
--- a/Storage/Storage/Public/Leaderboard/LCLeaderboard.cs
+++ b/Storage/Storage/Public/Leaderboard/LCLeaderboard.cs
@@ -26,35 +26,68 @@ namespace LeanCloud.Storage {
Month
}
+ ///
+ /// LCLeaderboard represents LeanCloud leaderboard and contains static functions
+ /// that handle the statistic.
+ ///
public class LCLeaderboard {
+ ///
+ /// The name of statistic.
+ ///
public string StatisticName {
get; private set;
}
+ ///
+ /// The order of this leaderboard.
+ ///
public LCLeaderboardOrder Order {
get; private set;
}
+ ///
+ /// The update strategy of this leaderboard.
+ ///
public LCLeaderboardUpdateStrategy UpdateStrategy {
get; private set;
}
+ ///
+ /// The interval of the version that the leaderboard resets.
+ ///
public LCLeaderboardVersionChangeInterval VersionChangeInterval {
get; private set;
}
+ ///
+ /// The version of this leaderboard.
+ ///
public int Version {
get; private set;
}
+ ///
+ /// The next time that the leaderboard resets.
+ ///
public DateTime NextResetAt {
get; private set;
}
+ ///
+ /// The time that the leaderboard created.
+ ///
public DateTime CreatedAt {
get; private set;
}
+ ///
+ /// Creates a LCLeaderboard with a statistic name.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public static async Task CreateLeaderboard(string statisticName,
LCLeaderboardOrder order = LCLeaderboardOrder.Descending,
LCLeaderboardUpdateStrategy updateStrategy = LCLeaderboardUpdateStrategy.Better,
@@ -90,12 +123,23 @@ namespace LeanCloud.Storage {
};
}
+ ///
+ /// Gets the LCLeaderboard with the given name.
+ ///
+ ///
+ ///
public static Task GetLeaderboard(string statisticName) {
LCLeaderboard leaderboard = CreateWithoutData(statisticName);
return leaderboard.Fetch();
}
-
+ ///
+ /// Updates the statistic of the user.
+ ///
+ ///
+ ///
+ ///
+ ///
public static async Task> UpdateStatistics(LCUser user,
Dictionary statistics,
bool overwrite = false) {
@@ -127,7 +171,12 @@ namespace LeanCloud.Storage {
return null;
}
-
+ ///
+ /// Gets the statistics of the user.
+ ///
+ ///
+ ///
+ ///
public static async Task> GetStatistics(LCUser user,
IEnumerable statisticNames = null) {
if (user == null) {
@@ -151,7 +200,12 @@ namespace LeanCloud.Storage {
return null;
}
-
+ ///
+ /// Deletes the statistics of the user with the given name.
+ ///
+ ///
+ ///
+ ///
public static async Task DeleteStatistics(LCUser user,
IEnumerable statisticNames) {
if (user == null) {
@@ -195,7 +249,15 @@ namespace LeanCloud.Storage {
return null;
}
-
+ ///
+ /// Gets the rankings.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public Task> GetResults(int version = -1,
int skip = 0,
int limit = 10,
@@ -204,7 +266,15 @@ namespace LeanCloud.Storage {
return GetResults(null, version, skip, limit, selectUserKeys, includeStatistics);
}
-
+ ///
+ /// Get the rankings that around the currently logged in user.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public async Task> GetResultsAroundUser(int version = -1,
int skip = 0,
int limit = 10,
@@ -214,6 +284,16 @@ namespace LeanCloud.Storage {
return await GetResults(user, version, skip, limit, selectUserKeys, includeStatistics);
}
+ ///
+ /// Gets the rankings of the user.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
private async Task> GetResults(LCUser user,
int version,
int skip,
@@ -249,7 +329,11 @@ namespace LeanCloud.Storage {
return null;
}
-
+ ///
+ /// Updates the update strategy of this LCLeaderboard.
+ ///
+ ///
+ ///
public async Task UpdateUpdateStrategy(LCLeaderboardUpdateStrategy updateStrategy) {
Dictionary data = new Dictionary {
{ "updateStrategy", updateStrategy.ToString().ToLower() }
@@ -264,7 +348,11 @@ namespace LeanCloud.Storage {
return this;
}
-
+ ///
+ /// Updates the interval of the version that this LCLeaderboard changes.
+ ///
+ ///
+ ///
public async Task UpdateVersionChangeInterval(LCLeaderboardVersionChangeInterval versionChangeInterval) {
Dictionary data = new Dictionary {
{ "versionChangeInterval", versionChangeInterval.ToString().ToLower() }
diff --git a/Storage/Storage/Public/Leaderboard/LCRanking.cs b/Storage/Storage/Public/Leaderboard/LCRanking.cs
index ea3ca9c..1474e2c 100644
--- a/Storage/Storage/Public/Leaderboard/LCRanking.cs
+++ b/Storage/Storage/Public/Leaderboard/LCRanking.cs
@@ -4,19 +4,34 @@ using System.Collections.ObjectModel;
using LeanCloud.Storage.Internal.Object;
namespace LeanCloud.Storage {
+ ///
+ /// LCRanking represents the rankings of LCLeaderboard.
+ ///
public class LCRanking {
+ ///
+ /// The ranking.
+ ///
public int Rank {
get; private set;
}
+ ///
+ /// The user of this LCRanking.
+ ///
public LCUser User {
get; private set;
}
+ ///
+ /// The statistic name of this LCRanking.
+ ///
public string StatisticName {
get; private set;
}
+ ///
+ /// The value of this LCRanking.
+ ///
public double Value {
get; private set;
}
diff --git a/Storage/Storage/Public/Leaderboard/LCStatistic.cs b/Storage/Storage/Public/Leaderboard/LCStatistic.cs
index a9823a5..5f26624 100644
--- a/Storage/Storage/Public/Leaderboard/LCStatistic.cs
+++ b/Storage/Storage/Public/Leaderboard/LCStatistic.cs
@@ -2,15 +2,27 @@
using System.Collections.Generic;
namespace LeanCloud.Storage {
+ ///
+ /// LCStatistic represents the statistic of LeanCloud leaderboard.
+ ///
public class LCStatistic {
+ ///
+ /// The name of this LCStatistic.
+ ///
public string Name {
get; private set;
}
+ ///
+ /// The value of this LCStatistic.
+ ///
public double Value {
get; private set;
}
+ ///
+ /// The version of this LCStatistic.
+ ///
public int Version {
get; internal set;
}