forked from parse-community/parse-php-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
43 lines (42 loc) · 1.17 KB
/
Copy pathmain.js
File metadata and controls
43 lines (42 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Parse.Cloud.define("bar", function(request, response) {
if (request.params.key2 === "value1") {
response.success('Foo');
} else {
response.error("bad stuff happened");
}
});
Parse.Cloud.define("foo", function(request, response) {
var key1 = request.params.key1;
var key2 = request.params.key2;
if (key1 === "value1" && key2
&& key2.length === 3 && key2[0] === 1
&& key2[1] === 2 && key2[2] === 3) {
result = {
object: {
__type: 'Object',
className: 'Foo',
objectId: '1',
x: 2,
relation: {
__type: 'Object',
className: 'Bar',
objectId: '2',
x: 3
}
},
array:[
{
__type: 'Object',
className: 'Bar',
objectId: '10',
x: 2
}
]
};
response.success(result);
} else if (key1 === "value1") {
response.success({a: 2});
} else {
response.error('invalid!');
}
});