You can make API calls using the built-in asynchronous object APIs included in the SDK. Not all objects are available from the client-side libraries.
Payload.all(pl.Customer.select(), new Payload.Callback<List<pl.Customer>>() {
public void then(List<pl.Customer> custs) {
}
});
Payload.all(Payload.Customer.select(), {(obj: Any) in
let custs = obj as? [Payload.Customer]
/* Do something with response */
})
[Payload all: [Customer select] :^(id obj) {
NSArray *custs = obj;
Customer *cust = [custs firstObject];
/* Do something with response */
}];
Payload.create(pl.Customer(){{
set("email", "[email protected]");
set("name", "Test Account");
}}, new Payload.Callback<pl.Customer>() {
public void then(pl.Customer cust) {}
});
Payload.create(Payload.Customer([
"email": "[email protected]",
"name": "Test Account"
]), {(obj: Any) in
let cust = obj as? Payload.Customer
/* Do something with response */
})
[Payload create: [[Customer alloc] init:@{
@"email": @"[email protected]",
@"name": @"Test Account"
}] :^(id obj) {
Customer *cust = obj;
}];
Payload.update(cust.set("email", "[email protected]"),
new Payload.Callback<pl.Customer>() {
public void then(pl.Customer cust) {}
});
cust.update([
"email": "[email protected]"
], {(obj: Any) in
let cust = obj as? Payload.Customer
/* Do something with response */
})
[cust update:@{
@"email": @"[email protected]"
} :^(id obj) {
Customer *cust = obj;
/* Do something with response */
}];
Payload.delete(cust, new Payload.Callback<pl.Customer>() {
public void then(pl.Customer cust) {}
});
cust.delete({(obj: Any) in
/* Do something with response */
})
[cust delete:^(id obj) {
/* Do something with response */
}];