pierceboggan
pierceboggan

Reputation: 317

Using Parse Cloud Code in Conjunction with .NET SDK

Objective:

Can either of these be easily achieved without jumping through some major hoops? I'm completely unfamiliar with Cloud Code, though I tried to read through some of the documentation. Cloud Code looks like it has the potential to perform this task, but I haven't seen any examples of doing something like I would like to do.

Does anyone have concrete examples of using Parse Cloud Code in conjunction with the .NET SDK and table updates?

Upvotes: 3

Views: 537

Answers (1)

latonz
latonz

Reputation: 1750

Parse has a nice Documentation: Parse CloudCode

This is an example Code, which sends a push every time a user is created

//instead of Parse.User you can use any custom parse class too, but write them inside quotes
Parse.Cloud.afterSave(Parse.User, function(request) {
    if(!request.object.existed()){//existed() returns false if the object was just created
        var query = new Parse.Query(Parse.Installation);
        query.equalTo("User", request.object);
        Parse.Push.send({
            where: query,
            data: {
                badge: "Increment",
                alert: "Welcome " + request.object.get("username"),
                sound: "beep.caf"
            }
        }, {
            success: function(){
                //succeed
            },
            error: function(err){
                console.error("Got an error " + error.code + " : " + error.message);
            }
        });
    }
});

There are also other hooks available:

Inside these hooks you can send push notifications, create new objects, manipulate objects, do nearly whatever you want.

In Parse CloudCode you can take advantage of the Parse JavaScript API.

Upvotes: 3

Related Questions