Last active
November 20, 2020 01:42
-
-
Save tyfkda/ec5c55f775d5203b92e4 to your computer and use it in GitHub Desktop.
C#からParse.comのCloudFunctionを呼び出して結果を受け取る ref: http://qiita.com/tyfkda/items/be2858031203921bb505
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Parse.Cloud.define('getFoobars', function(request, response) { | |
| var query = new Parse.Query('Foobars'); | |
| query.containedIn('foobarId', request.params.foobarIds); | |
| query.find({ | |
| success: function(results) { | |
| response.success(results); | |
| }, | |
| error: function() { | |
| response.error('find failed'); | |
| } | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Parse; | |
| ... | |
| public void RequestFoobars(List<string> foobarIds) { | |
| Dictionary<string, object> data = new Dictionary<string, object>(); | |
| data.Add("foobarIds", foobarIds); | |
| ParseCloud.CallFunctionAsync<List<object>>("getFoobars", data).ContinueWith(t => { | |
| if (t.IsFaulted || t.IsCanceled || !t.IsCompleted || t.Result == null) { | |
| Debug.Log(t.Exception.GetBaseException().Message); | |
| return; | |
| } | |
| foreach (object obj in t.Result) { | |
| if (obj is ParseObject) { | |
| ParseObject pobj = obj as ParseObject; | |
| string foobarId = pobj.Get<string>("foobarId"); | |
| DateTime? updatedAt = pobj.UpdatedAt; | |
| ... | |
| } | |
| } | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment