From 86cf1eada2bf7db677f44be37eb1ab68ecc0db41 Mon Sep 17 00:00:00 2001 From: oneRain Date: Thu, 21 May 2020 10:41:58 +0800 Subject: [PATCH 1/9] =?UTF-8?q?chore:=20=E5=B0=86=20LCException=20?= =?UTF-8?q?=E6=8F=90=E5=88=B0=20LeanCloud=20=E5=91=BD=E5=90=8D=E7=A9=BA?= =?UTF-8?q?=E9=97=B4=E4=B8=8B=EF=BC=8C=E5=B9=B6=E5=A2=9E=E5=8A=A0=20ToStri?= =?UTF-8?q?ng()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Common/Common-Unity/Common-Unity.csproj | 3 +++ Common/Common/Common.csproj | 1 + .../Common/Exception}/LCException.cs | 15 ++++++++++++++- Storage/Storage-Unity/Storage-Unity.csproj | 3 --- Storage/Storage.Test/ExceptionTest.cs | 2 +- 5 files changed, 19 insertions(+), 5 deletions(-) rename {Storage/Storage => Common/Common/Exception}/LCException.cs (50%) diff --git a/Common/Common-Unity/Common-Unity.csproj b/Common/Common-Unity/Common-Unity.csproj index 4bb9263..9ab3475 100644 --- a/Common/Common-Unity/Common-Unity.csproj +++ b/Common/Common-Unity/Common-Unity.csproj @@ -30,6 +30,9 @@ Json\LCJsonConverter.cs + + Exception\LCException.cs + diff --git a/Common/Common/Common.csproj b/Common/Common/Common.csproj index 8157b01..669c947 100644 --- a/Common/Common/Common.csproj +++ b/Common/Common/Common.csproj @@ -13,5 +13,6 @@ + diff --git a/Storage/Storage/LCException.cs b/Common/Common/Exception/LCException.cs similarity index 50% rename from Storage/Storage/LCException.cs rename to Common/Common/Exception/LCException.cs index acf2249..1daebab 100644 --- a/Storage/Storage/LCException.cs +++ b/Common/Common/Exception/LCException.cs @@ -1,11 +1,20 @@ using System; -namespace LeanCloud.Storage { +namespace LeanCloud { + /// + /// LeanCloud 异常 + /// public class LCException : Exception { + /// + /// 错误码 + /// public int Code { get; set; } + /// + /// 错误信息 + /// public new string Message { get; set; } @@ -14,5 +23,9 @@ namespace LeanCloud.Storage { Code = code; Message = message; } + + public override string ToString() { + return $"{Code} - {Message}"; + } } } diff --git a/Storage/Storage-Unity/Storage-Unity.csproj b/Storage/Storage-Unity/Storage-Unity.csproj index 7ea411a..42d8e68 100644 --- a/Storage/Storage-Unity/Storage-Unity.csproj +++ b/Storage/Storage-Unity/Storage-Unity.csproj @@ -15,9 +15,6 @@ LCCloud.cs - - LCException.cs - LCFile.cs diff --git a/Storage/Storage.Test/ExceptionTest.cs b/Storage/Storage.Test/ExceptionTest.cs index 83f70b3..bcd80c0 100644 --- a/Storage/Storage.Test/ExceptionTest.cs +++ b/Storage/Storage.Test/ExceptionTest.cs @@ -1,5 +1,5 @@ using NUnit.Framework; -using LeanCloud.Storage; +using LeanCloud; namespace Storage.Test { public class ExceptionTest { From 2723b6213beafd7659fcafd8327f21d6c98b2895 Mon Sep 17 00:00:00 2001 From: oneRain Date: Tue, 26 May 2020 12:14:34 +0800 Subject: [PATCH 2/9] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20createdAt,=20up?= =?UTF-8?q?datedAt=20=E6=97=B6=E9=97=B4=E6=A0=BC=E5=BC=8F=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Storage/Storage/Internal/Object/LCObjectData.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Storage/Storage/Internal/Object/LCObjectData.cs b/Storage/Storage/Internal/Object/LCObjectData.cs index 152c445..eb8c09a 100644 --- a/Storage/Storage/Internal/Object/LCObjectData.cs +++ b/Storage/Storage/Internal/Object/LCObjectData.cs @@ -40,9 +40,9 @@ namespace LeanCloud.Storage.Internal.Object { } else if (key == "objectId") { objectData.ObjectId = value.ToString(); } else if (key == "createdAt" && DateTime.TryParse(value.ToString(), out DateTime createdAt)) { - objectData.CreatedAt = createdAt; + objectData.CreatedAt = createdAt.ToLocalTime(); } else if (key == "updatedAt" && DateTime.TryParse(value.ToString(), out DateTime updatedAt)) { - objectData.UpdatedAt = updatedAt; + objectData.UpdatedAt = updatedAt.ToLocalTime(); } else { objectData.CustomPropertyDict[key] = LCDecoder.Decode(value); } @@ -61,10 +61,10 @@ namespace LeanCloud.Storage.Internal.Object { dict["objectId"] = objectData.ObjectId; } if (objectData.CreatedAt != null) { - dict["createdAt"] = objectData.CreatedAt; + dict["createdAt"] = objectData.CreatedAt.ToUniversalTime(); } if (objectData.UpdatedAt != null) { - dict["updatedAt"] = objectData.UpdatedAt; + dict["updatedAt"] = objectData.UpdatedAt.ToUniversalTime(); } if (objectData.CustomPropertyDict != null) { foreach (KeyValuePair kv in objectData.CustomPropertyDict) { From 8fd9a9f377f5c4939845f1f38dc0b9b816e4e943 Mon Sep 17 00:00:00 2001 From: oneRain Date: Wed, 27 May 2020 12:43:06 +0800 Subject: [PATCH 3/9] =?UTF-8?q?chore:=20=E4=BF=AE=E5=A4=8D=20LCObject=20To?= =?UTF-8?q?String()=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Storage/Storage/LCObject.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Storage/Storage/LCObject.cs b/Storage/Storage/LCObject.cs index aacc54f..4b832d2 100644 --- a/Storage/Storage/LCObject.cs +++ b/Storage/Storage/LCObject.cs @@ -462,7 +462,10 @@ namespace LeanCloud.Storage { /// /// public override string ToString() { - return JsonConvert.SerializeObject(LCObjectData.Encode(data)); + Dictionary originalData = LCObjectData.Encode(data); + Dictionary currentData = estimatedData.Union(originalData.Where(kv => !estimatedData.ContainsKey(kv.Key))) + .ToDictionary(k => k.Key, v => v.Value); + return JsonConvert.SerializeObject(currentData); } /// From 5609509e347683d31f99a3f72f3b5c7ffc4ff3c1 Mon Sep 17 00:00:00 2001 From: oneRain Date: Wed, 27 May 2020 12:46:01 +0800 Subject: [PATCH 4/9] =?UTF-8?q?chore:=20=E5=AE=8C=E5=96=84=20Dictionary=20?= =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Realtime/Internal/Controller/LCIMConversationController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Realtime/Realtime/Internal/Controller/LCIMConversationController.cs b/Realtime/Realtime/Internal/Controller/LCIMConversationController.cs index 1f23ead..68798b0 100644 --- a/Realtime/Realtime/Internal/Controller/LCIMConversationController.cs +++ b/Realtime/Realtime/Internal/Controller/LCIMConversationController.cs @@ -52,7 +52,7 @@ namespace LeanCloud.Realtime.Internal.Controller { attrs["name"] = name; } if (properties != null) { - attrs = properties.Union(attrs) + attrs = properties.Union(attrs.Where(kv => !properties.ContainsKey(kv.Key))) .ToDictionary(k => k.Key, v => v.Value); } conv.Attr = new JsonObjectMessage { From 66e07a204128221385082f10e9b63647119813a2 Mon Sep 17 00:00:00 2001 From: oneRain Date: Wed, 27 May 2020 14:33:55 +0800 Subject: [PATCH 5/9] =?UTF-8?q?chore:=20=E9=81=BF=E5=85=8D=E5=BC=BA?= =?UTF-8?q?=E8=BD=AC=E7=A9=BA=E6=8C=87=E9=92=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Storage/Storage.Test/ACLTest.cs | 12 ++++++++++++ .../Internal/Query/LCCompositionalCondition.cs | 7 +++++++ Storage/Storage/LCQuery.cs | 11 +++++++++++ Storage/Storage/LCUser.cs | 4 ++-- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Storage/Storage.Test/ACLTest.cs b/Storage/Storage.Test/ACLTest.cs index 967da0c..11fa5df 100644 --- a/Storage/Storage.Test/ACLTest.cs +++ b/Storage/Storage.Test/ACLTest.cs @@ -1,5 +1,6 @@ using NUnit.Framework; using System.Threading.Tasks; +using System.Collections.ObjectModel; using LeanCloud; using LeanCloud.Storage; @@ -74,5 +75,16 @@ namespace Storage.Test { TestContext.WriteLine(account.ObjectId); Assert.NotNull(account.ObjectId); } + + [Test] + public async Task Serialization() { + LCQuery query = new LCQuery("Account") { + IncludeACL = true + }; + ReadOnlyCollection accounts = await query.Find(); + foreach (LCObject account in accounts) { + TestContext.WriteLine(account); + } + } } } diff --git a/Storage/Storage/Internal/Query/LCCompositionalCondition.cs b/Storage/Storage/Internal/Query/LCCompositionalCondition.cs index 426a904..7217927 100644 --- a/Storage/Storage/Internal/Query/LCCompositionalCondition.cs +++ b/Storage/Storage/Internal/Query/LCCompositionalCondition.cs @@ -24,6 +24,10 @@ namespace LeanCloud.Storage.Internal.Query { get; set; } + public bool IncludeACL { + get; set; + } + public LCCompositionalCondition(string composition = And) { this.composition = composition; Skip = 0; @@ -217,6 +221,9 @@ namespace LeanCloud.Storage.Internal.Query { if (selectedKeys != null && selectedKeys.Count > 0) { dict["keys"] = string.Join(",", selectedKeys); } + if (IncludeACL) { + dict["returnACL"] = "true"; + } return dict; } diff --git a/Storage/Storage/LCQuery.cs b/Storage/Storage/LCQuery.cs index 7d391d9..586a91d 100644 --- a/Storage/Storage/LCQuery.cs +++ b/Storage/Storage/LCQuery.cs @@ -333,6 +333,17 @@ namespace LeanCloud.Storage { return this; } + /// + /// 是否包含 ACL + /// + public bool IncludeACL { + get { + return Condition.IncludeACL; + } set { + Condition.IncludeACL = value; + } + } + /// /// 跳过 /// diff --git a/Storage/Storage/LCUser.cs b/Storage/Storage/LCUser.cs index 7a9cc6c..b86001b 100644 --- a/Storage/Storage/LCUser.cs +++ b/Storage/Storage/LCUser.cs @@ -49,13 +49,13 @@ namespace LeanCloud.Storage { public bool EmailVerified { get { - return (bool)this["emailVerified"]; + return Convert.ToBoolean(this["emailVerified"]); } } public bool MobileVerified { get { - return (bool)this["mobilePhoneVerified"]; + return Convert.ToBoolean(this["mobilePhoneVerified"]); } } From 464712888856d312120970e616277f6a459be764 Mon Sep 17 00:00:00 2001 From: oneRain Date: Wed, 27 May 2020 15:29:55 +0800 Subject: [PATCH 6/9] * ACLTest.cs: * LCDecoder.cs: * LCEncoder.cs: * LCObjectData.cs: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * LCACL.cs: chore: 调整 ACL 逻辑;支持 ACL 反序列化 --- Storage/Storage.Test/ACLTest.cs | 5 +- Storage/Storage/Internal/Codec/LCDecoder.cs | 20 +++++- Storage/Storage/Internal/Codec/LCEncoder.cs | 29 ++++---- .../Storage/Internal/Object/LCObjectData.cs | 7 +- Storage/Storage/LCACL.cs | 66 ++++++++----------- 5 files changed, 75 insertions(+), 52 deletions(-) diff --git a/Storage/Storage.Test/ACLTest.cs b/Storage/Storage.Test/ACLTest.cs index 11fa5df..733cd02 100644 --- a/Storage/Storage.Test/ACLTest.cs +++ b/Storage/Storage.Test/ACLTest.cs @@ -78,12 +78,15 @@ namespace Storage.Test { [Test] public async Task Serialization() { + await LCUser.Login("hello", "world"); LCQuery query = new LCQuery("Account") { IncludeACL = true }; + query.OrderByDescending("createdAt"); ReadOnlyCollection accounts = await query.Find(); foreach (LCObject account in accounts) { - TestContext.WriteLine(account); + TestContext.WriteLine($"public read access: {account.ACL.PublicReadAccess}"); + TestContext.WriteLine($"public write access: {account.ACL.PublicWriteAccess}"); } } } diff --git a/Storage/Storage/Internal/Codec/LCDecoder.cs b/Storage/Storage/Internal/Codec/LCDecoder.cs index f9dd00a..ae920a0 100644 --- a/Storage/Storage/Internal/Codec/LCDecoder.cs +++ b/Storage/Storage/Internal/Codec/LCDecoder.cs @@ -68,10 +68,26 @@ namespace LeanCloud.Storage.Internal.Codec { } public static LCGeoPoint DecodeGeoPoint(IDictionary data) { - double latitude = double.Parse(data["latitude"].ToString()); - double longitude = double.Parse(data["longitude"].ToString()); + double latitude = Convert.ToDouble(data["latitude"]); + double longitude = Convert.ToDouble(data["longitude"]); LCGeoPoint geoPoint = new LCGeoPoint(latitude, longitude); return geoPoint; } + + public static LCACL DecodeACL(Dictionary dict) { + Console.WriteLine($"count: {dict.Count}"); + LCACL acl = new LCACL(); + foreach (KeyValuePair kv in dict) { + string key = kv.Key; + Dictionary access = kv.Value as Dictionary; + if (access.TryGetValue("read", out object ra)) { + acl.readAccess[key] = Convert.ToBoolean(ra); + } + if (access.TryGetValue("write", out object wa)) { + acl.writeAccess[key] = Convert.ToBoolean(wa); + } + } + return acl; + } } } diff --git a/Storage/Storage/Internal/Codec/LCEncoder.cs b/Storage/Storage/Internal/Codec/LCEncoder.cs index 383247b..a216200 100644 --- a/Storage/Storage/Internal/Codec/LCEncoder.cs +++ b/Storage/Storage/Internal/Codec/LCEncoder.cs @@ -83,18 +83,25 @@ namespace LeanCloud.Storage.Internal.Codec { } public static object EncodeACL(LCACL acl) { - HashSet readers = acl.readers; - HashSet writers = acl.writers; - HashSet union = new HashSet(readers); - union.UnionWith(writers); - Dictionary dict = new Dictionary(); - foreach (string k in union) { - dict[k] = new Dictionary { - { "read", readers.Contains(k) }, - { "write", writers.Contains(k) } - }; + HashSet keys = new HashSet(); + if (acl.readAccess.Count > 0) { + keys.UnionWith(acl.readAccess.Keys); } - return dict; + if (acl.writeAccess.Count > 0) { + keys.UnionWith(acl.writeAccess.Keys); + } + Dictionary result = new Dictionary(); + foreach (string key in keys) { + Dictionary access = new Dictionary(); + if (acl.readAccess.TryGetValue(key, out bool ra)) { + access["read"] = ra; + } + if (acl.writeAccess.TryGetValue(key, out bool wa)) { + access["write"] = wa; + } + result[key] = access; + } + return result; } public static object EncodeRelation(LCRelation relation) { diff --git a/Storage/Storage/Internal/Object/LCObjectData.cs b/Storage/Storage/Internal/Object/LCObjectData.cs index eb8c09a..bc5e90d 100644 --- a/Storage/Storage/Internal/Object/LCObjectData.cs +++ b/Storage/Storage/Internal/Object/LCObjectData.cs @@ -44,7 +44,12 @@ namespace LeanCloud.Storage.Internal.Object { } else if (key == "updatedAt" && DateTime.TryParse(value.ToString(), out DateTime updatedAt)) { objectData.UpdatedAt = updatedAt.ToLocalTime(); } else { - objectData.CustomPropertyDict[key] = LCDecoder.Decode(value); + if (key == "ACL" && + value is Dictionary dic) { + objectData.CustomPropertyDict[key] = LCDecoder.DecodeACL(dic); + } else { + objectData.CustomPropertyDict[key] = LCDecoder.Decode(value); + } } } return objectData; diff --git a/Storage/Storage/LCACL.cs b/Storage/Storage/LCACL.cs index b7b6664..024c48f 100644 --- a/Storage/Storage/LCACL.cs +++ b/Storage/Storage/LCACL.cs @@ -10,22 +10,32 @@ namespace LeanCloud.Storage { const string RoleKeyPrefix = "role:"; - internal HashSet readers; - internal HashSet writers; + internal Dictionary readAccess = new Dictionary(); + internal Dictionary writeAccess = new Dictionary(); + + public static LCACL CreateWithOwner(LCUser owner) { + if (owner == null) { + throw new ArgumentNullException(nameof(owner)); + } + LCACL acl = new LCACL(); + acl.SetUserReadAccess(owner, true); + acl.SetUserWriteAccess(owner, true); + return acl; + } public bool PublicReadAccess { get { - return GetAccess(readers, PublicKey); + return GetAccess(readAccess, PublicKey); } set { - SetAccess(readers, PublicKey, value); + SetAccess(readAccess, PublicKey, value); } } public bool PublicWriteAccess { get { - return GetAccess(writers, PublicKey); + return GetAccess(writeAccess, PublicKey); } set { - SetAccess(writers, PublicKey, value); + SetAccess(writeAccess, PublicKey, value); } } @@ -33,28 +43,28 @@ namespace LeanCloud.Storage { if (string.IsNullOrEmpty(userId)) { throw new ArgumentNullException(nameof(userId)); } - return GetAccess(readers, userId); + return GetAccess(readAccess, userId); } public void SetUserIdReadAccess(string userId, bool value) { if (string.IsNullOrEmpty(userId)) { throw new ArgumentNullException(nameof(userId)); } - SetAccess(readers, userId, value); + SetAccess(readAccess, userId, value); } public bool GetUserIdWriteAccess(string userId) { if (string.IsNullOrEmpty(userId)) { throw new ArgumentNullException(nameof(userId)); } - return GetAccess(writers, userId); + return GetAccess(writeAccess, userId); } public void SetUserIdWriteAccess(string userId, bool value) { if (string.IsNullOrEmpty(userId)) { throw new ArgumentNullException(nameof(userId)); } - SetAccess(writers, userId, value); + SetAccess(writeAccess, userId, value); } public bool GetUserReadAccess(LCUser user) { @@ -90,7 +100,7 @@ namespace LeanCloud.Storage { throw new ArgumentNullException(nameof(role)); } string roleKey = $"{RoleKeyPrefix}{role.ObjectId}"; - return GetAccess(readers, roleKey); + return GetAccess(readAccess, roleKey); } public void SetRoleReadAccess(LCRole role, bool value) { @@ -98,7 +108,7 @@ namespace LeanCloud.Storage { throw new ArgumentNullException(nameof(role)); } string roleKey = $"{RoleKeyPrefix}{role.ObjectId}"; - SetAccess(readers, roleKey, value); + SetAccess(readAccess, roleKey, value); } public bool GetRoleWriteAccess(LCRole role) { @@ -106,7 +116,7 @@ namespace LeanCloud.Storage { throw new ArgumentNullException(nameof(role)); } string roleKey = $"{RoleKeyPrefix}{role.ObjectId}"; - return GetAccess(writers, roleKey); + return GetAccess(writeAccess, roleKey); } public void SetRoleWriteAccess(LCRole role, bool value) { @@ -114,34 +124,16 @@ namespace LeanCloud.Storage { throw new ArgumentNullException(nameof(role)); } string roleKey = $"{RoleKeyPrefix}{role.ObjectId}"; - SetAccess(writers, roleKey, value); + SetAccess(writeAccess, roleKey, value); } - public LCACL() { - readers = new HashSet(); - writers = new HashSet(); + bool GetAccess(Dictionary access, string key) { + return access.ContainsKey(key) ? + access[key] : false; } - public static LCACL CreateWithOwner(LCUser owner) { - if (owner == null) { - throw new ArgumentNullException(nameof(owner)); - } - LCACL acl = new LCACL(); - acl.SetUserReadAccess(owner, true); - acl.SetUserWriteAccess(owner, true); - return acl; - } - - bool GetAccess(HashSet set, string key) { - return set.Contains(key); - } - - void SetAccess(HashSet set, string key, bool value) { - if (value) { - set.Add(key); - } else { - set.Remove(key); - } + void SetAccess(Dictionary access, string key, bool value) { + access[key] = value; } } } From ba79cd677f09800579bbfd69491e035d884f692a Mon Sep 17 00:00:00 2001 From: oneRain Date: Wed, 27 May 2020 15:38:00 +0800 Subject: [PATCH 7/9] chore --- Storage/Storage/Internal/Codec/LCDecoder.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Storage/Storage/Internal/Codec/LCDecoder.cs b/Storage/Storage/Internal/Codec/LCDecoder.cs index ae920a0..b4b9770 100644 --- a/Storage/Storage/Internal/Codec/LCDecoder.cs +++ b/Storage/Storage/Internal/Codec/LCDecoder.cs @@ -75,7 +75,6 @@ namespace LeanCloud.Storage.Internal.Codec { } public static LCACL DecodeACL(Dictionary dict) { - Console.WriteLine($"count: {dict.Count}"); LCACL acl = new LCACL(); foreach (KeyValuePair kv in dict) { string key = kv.Key; From 973d58959a9f764251359f115a21b8fc29e34ab1 Mon Sep 17 00:00:00 2001 From: oneRain Date: Thu, 28 May 2020 11:15:50 +0800 Subject: [PATCH 8/9] =?UTF-8?q?chore:=20=E5=BA=8F=E5=88=97=E5=8C=96?= =?UTF-8?q?=E4=BA=91=E5=87=BD=E6=95=B0=E7=9A=84=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Storage/Storage/LCCloud.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Storage/Storage/LCCloud.cs b/Storage/Storage/LCCloud.cs index 830c8e0..8080aab 100644 --- a/Storage/Storage/LCCloud.cs +++ b/Storage/Storage/LCCloud.cs @@ -13,15 +13,20 @@ namespace LeanCloud.Storage { /// /// /// - public static async Task> Run(string name, Dictionary parameters = null) { + public static async Task> Run(string name, + Dictionary parameters = null) { string path = $"functions/{name}"; - Dictionary response = await LCApplication.HttpClient.Post>(path, data: parameters); + object encodeParams = LCEncoder.Encode(parameters); + Dictionary response = await LCApplication.HttpClient.Post>(path, + data: encodeParams); return response; } - public static async Task RPC(string name, Dictionary parameters = null) { + public static async Task RPC(string name, object parameters = null) { string path = $"call/{name}"; - Dictionary response = await LCApplication.HttpClient.Post>(path, data: parameters); + object encodeParams = LCEncoder.Encode(parameters); + Dictionary response = await LCApplication.HttpClient.Post>(path, + data: encodeParams); return LCDecoder.Decode(response["result"]); } } From 4f7d3f8c3086ab806924a972aa48b64221412272 Mon Sep 17 00:00:00 2001 From: oneRain Date: Thu, 28 May 2020 11:18:52 +0800 Subject: [PATCH 9/9] =?UTF-8?q?chore:=20=E4=BA=91=E5=87=BD=E6=95=B0=20API?= =?UTF-8?q?=20doc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Storage/Storage/LCCloud.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Storage/Storage/LCCloud.cs b/Storage/Storage/LCCloud.cs index 8080aab..01066c7 100644 --- a/Storage/Storage/LCCloud.cs +++ b/Storage/Storage/LCCloud.cs @@ -8,11 +8,11 @@ namespace LeanCloud.Storage { /// public static class LCCloud { /// - /// 调用云函数,结果为 Dictionary 类型 + /// 调用云函数 /// /// /// - /// + /// 返回类型为 Dictionary public static async Task> Run(string name, Dictionary parameters = null) { string path = $"functions/{name}"; @@ -22,6 +22,12 @@ namespace LeanCloud.Storage { return response; } + /// + /// 调用 RPC 云函数 + /// + /// + /// + /// 返回类型为 LCObject 容器类型 public static async Task RPC(string name, object parameters = null) { string path = $"call/{name}"; object encodeParams = LCEncoder.Encode(parameters);