diff --git a/Storage/Storage-Unity/Storage-Unity.csproj b/Storage/Storage-Unity/Storage-Unity.csproj index 7f8ff6f..368a7a3 100644 --- a/Storage/Storage-Unity/Storage-Unity.csproj +++ b/Storage/Storage-Unity/Storage-Unity.csproj @@ -99,9 +99,6 @@ Internal\Http\LCHttpClient.cs - - Internal\Http\LCJsonConverter.cs - Internal\Query\LCEqualCondition.cs diff --git a/Storage/Storage/Internal/Object/LCObjectData.cs b/Storage/Storage/Internal/Object/LCObjectData.cs index d941068..152c445 100644 --- a/Storage/Storage/Internal/Object/LCObjectData.cs +++ b/Storage/Storage/Internal/Object/LCObjectData.cs @@ -4,30 +4,30 @@ using System.Collections.Generic; using LeanCloud.Storage.Internal.Codec; namespace LeanCloud.Storage.Internal.Object { - internal class LCObjectData { - internal string ClassName { + public class LCObjectData { + public string ClassName { get; set; } - internal string ObjectId { + public string ObjectId { get; set; } - internal DateTime CreatedAt { + public DateTime CreatedAt { get; set; } - internal DateTime UpdatedAt { + public DateTime UpdatedAt { get; set; } - internal Dictionary CustomPropertyDict; + public Dictionary CustomPropertyDict; - internal LCObjectData() { + public LCObjectData() { CustomPropertyDict = new Dictionary(); } - internal static LCObjectData Decode(IDictionary dict) { + public static LCObjectData Decode(IDictionary dict) { if (dict == null) { return null; } @@ -50,7 +50,7 @@ namespace LeanCloud.Storage.Internal.Object { return objectData; } - internal static Dictionary Encode(LCObjectData objectData) { + public static Dictionary Encode(LCObjectData objectData) { if (objectData == null) { return null; } diff --git a/Storage/Storage/Internal/Query/LCCompositionalCondition.cs b/Storage/Storage/Internal/Query/LCCompositionalCondition.cs index 54098e3..426a904 100644 --- a/Storage/Storage/Internal/Query/LCCompositionalCondition.cs +++ b/Storage/Storage/Internal/Query/LCCompositionalCondition.cs @@ -118,7 +118,7 @@ namespace LeanCloud.Storage.Internal.Query { public void WhereMatchesQuery(string key, LCQuery query) where K : LCObject { Dictionary inQuery = new Dictionary { - { "where", query.condition }, + { "where", query.Condition }, { "className", query.ClassName } }; AddOperation(key, "$inQuery", inQuery); @@ -126,7 +126,7 @@ namespace LeanCloud.Storage.Internal.Query { public void WhereDoesNotMatchQuery(string key, LCQuery query) where K : LCObject { Dictionary inQuery = new Dictionary { - { "where", query.condition }, + { "where", query.Condition }, { "className", query.ClassName } }; AddOperation(key, "$notInQuery", inQuery); diff --git a/Storage/Storage/LCObject.cs b/Storage/Storage/LCObject.cs index 84ad22b..aacc54f 100644 --- a/Storage/Storage/LCObject.cs +++ b/Storage/Storage/LCObject.cs @@ -93,7 +93,7 @@ namespace LeanCloud.Storage { return obj; } - internal static LCObject Create(string className) { + public static LCObject Create(string className) { if (subclassNameDict.TryGetValue(className, out LCSubclassInfo subclassInfo)) { return subclassInfo.Constructor.Invoke(); } @@ -494,7 +494,7 @@ namespace LeanCloud.Storage { } } - internal void Merge(LCObjectData objectData) { + public void Merge(LCObjectData objectData) { data.ClassName = objectData.ClassName ?? data.ClassName; data.ObjectId = objectData.ObjectId ?? data.ObjectId; data.CreatedAt = objectData.CreatedAt != null ? objectData.CreatedAt : data.CreatedAt; diff --git a/Storage/Storage/LCQuery.cs b/Storage/Storage/LCQuery.cs index f86d203..6b2fd44 100644 --- a/Storage/Storage/LCQuery.cs +++ b/Storage/Storage/LCQuery.cs @@ -17,11 +17,13 @@ namespace LeanCloud.Storage { get; private set; } - internal LCCompositionalCondition condition; + public LCCompositionalCondition Condition { + get; internal set; + } public LCQuery(string className) { ClassName = className; - condition = new LCCompositionalCondition(); + Condition = new LCCompositionalCondition(); } /// @@ -31,7 +33,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereEqualTo(string key, object value) { - condition.WhereEqualTo(key, value); + Condition.WhereEqualTo(key, value); return this; } @@ -42,7 +44,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereNotEqualTo(string key, object value) { - condition.WhereNotEqualTo(key, value); + Condition.WhereNotEqualTo(key, value); return this; } @@ -53,7 +55,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereContainedIn(string key, IEnumerable values) { - condition.WhereContainedIn(key, values); + Condition.WhereContainedIn(key, values); return this; } @@ -64,7 +66,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereNotContainedIn(string key, IEnumerable values) { - condition.WhereNotContainedIn(key, values); + Condition.WhereNotContainedIn(key, values); return this; } @@ -75,7 +77,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereContainsAll(string key, IEnumerable values) { - condition.WhereContainsAll(key, values); + Condition.WhereContainsAll(key, values); return this; } @@ -85,7 +87,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereExists(string key) { - condition.WhereExists(key); + Condition.WhereExists(key); return this; } @@ -95,7 +97,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereDoesNotExist(string key) { - condition.WhereDoesNotExist(key); + Condition.WhereDoesNotExist(key); return this; } @@ -106,7 +108,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereSizeEqualTo(string key, int size) { - condition.WhereSizeEqualTo(key, size); + Condition.WhereSizeEqualTo(key, size); return this; } @@ -117,7 +119,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereGreaterThan(string key, object value) { - condition.WhereGreaterThan(key, value); + Condition.WhereGreaterThan(key, value); return this; } @@ -128,7 +130,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereGreaterThanOrEqualTo(string key, object value) { - condition.WhereGreaterThanOrEqualTo(key, value); + Condition.WhereGreaterThanOrEqualTo(key, value); return this; } @@ -139,7 +141,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereLessThan(string key, object value) { - condition.WhereLessThan(key, value); + Condition.WhereLessThan(key, value); return this; } @@ -150,7 +152,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereLessThanOrEqualTo(string key, object value) { - condition.WhereLessThanOrEqualTo(key, value); + Condition.WhereLessThanOrEqualTo(key, value); return this; } @@ -161,7 +163,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereNear(string key, LCGeoPoint point) { - condition.WhereNear(key, point); + Condition.WhereNear(key, point); return this; } @@ -173,7 +175,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereWithinGeoBox(string key, LCGeoPoint southwest, LCGeoPoint northeast) { - condition.WhereWithinGeoBox(key, southwest, northeast); + Condition.WhereWithinGeoBox(key, southwest, northeast); return this; } @@ -184,7 +186,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereRelatedTo(LCObject parent, string key) { - condition.WhereRelatedTo(parent, key); + Condition.WhereRelatedTo(parent, key); return this; } @@ -195,7 +197,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereStartsWith(string key, string prefix) { - condition.WhereStartsWith(key, prefix); + Condition.WhereStartsWith(key, prefix); return this; } @@ -206,7 +208,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereEndsWith(string key, string suffix) { - condition.WhereEndsWith(key, suffix); + Condition.WhereEndsWith(key, suffix); return this; } @@ -217,7 +219,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereContains(string key, string subString) { - condition.WhereContains(key, subString); + Condition.WhereContains(key, subString); return this; } @@ -229,7 +231,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereMatches(string key, string regex, string modifiers = null) { - condition.WhereMatches(key, regex, modifiers); + Condition.WhereMatches(key, regex, modifiers); return this; } @@ -240,7 +242,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereMatchesQuery(string key, LCQuery query) where K : LCObject { - condition.WhereMatchesQuery(key, query); + Condition.WhereMatchesQuery(key, query); return this; } @@ -252,7 +254,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery WhereDoesNotMatchQuery(string key, LCQuery query) where K : LCObject { - condition.WhereDoesNotMatchQuery(key, query); + Condition.WhereDoesNotMatchQuery(key, query); return this; } @@ -262,7 +264,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery OrderByAscending(string key) { - condition.OrderByAscending(key); + Condition.OrderByAscending(key); return this; } @@ -272,7 +274,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery OrderByDescending(string key) { - condition.OrderByDescending(key); + Condition.OrderByDescending(key); return this; } @@ -282,7 +284,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery AddAscendingOrder(string key) { - condition.AddAscendingOrder(key); + Condition.AddAscendingOrder(key); return this; } @@ -292,7 +294,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery AddDescendingOrder(string key) { - condition.AddDescendingOrder(key); + Condition.AddDescendingOrder(key); return this; } @@ -302,7 +304,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery Include(string key) { - condition.Include(key); + Condition.Include(key); return this; } @@ -312,7 +314,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery Select(string key) { - condition.Select(key); + Condition.Select(key); return this; } @@ -322,7 +324,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery Skip(int value) { - condition.Skip = value; + Condition.Skip = value; return this; } @@ -332,7 +334,7 @@ namespace LeanCloud.Storage { /// /// public LCQuery Limit(int value) { - condition.Limit = value; + Condition.Limit = value; return this; } @@ -396,7 +398,7 @@ namespace LeanCloud.Storage { throw new Exception("All of the queries in an or query must be on the same class."); } className = query.ClassName; - compositionQuery.condition.Add(query.condition); + compositionQuery.Condition.Add(query.Condition); } compositionQuery.ClassName = className; return compositionQuery; @@ -407,25 +409,25 @@ namespace LeanCloud.Storage { throw new ArgumentNullException(nameof(queries)); } LCQuery compositionQuery = new LCQuery(null); - compositionQuery.condition = new LCCompositionalCondition(LCCompositionalCondition.Or); + compositionQuery.Condition = new LCCompositionalCondition(LCCompositionalCondition.Or); string className = null; foreach (LCQuery query in queries) { if (className != null && className != query.ClassName) { throw new Exception("All of the queries in an or query must be on the same class."); } className = query.ClassName; - compositionQuery.condition.Add(query.condition); + compositionQuery.Condition.Add(query.Condition); } compositionQuery.ClassName = className; return compositionQuery; } Dictionary BuildParams() { - return condition.BuildParams(); + return Condition.BuildParams(); } internal string BuildWhere() { - return condition.BuildWhere(); + return Condition.BuildWhere(); } } }