Skip to content

Instantly share code, notes, and snippets.

@ChrisRisner
Last active December 20, 2015 03:49
Show Gist options
  • Select an option

  • Save ChrisRisner/6066607 to your computer and use it in GitHub Desktop.

Select an option

Save ChrisRisner/6066607 to your computer and use it in GitHub Desktop.
ScriptsStuff
NSString *stringData = [[NSString alloc] initWithData:result encoding:NSUTF8StringEncoding];
exports.post = function(request, response) {
// Use "request.service" to access features of your mobile service, e.g.:
// var tables = request.service.tables;
// var push = request.service.push;
response.send(statusCodes.OK, { message : 'Hello World!' });
};
exports.get = function(request, response) {
response.send(statusCodes.OK, { message : 'Hello World!' });
};
[self.client invokeAPI:@"MyCustomAPI" data:nil HTTPMethod:@"POST" parameters:nil
headers:nil completion:^(NSData *result, NSHTTPURLResponse *response, NSError *error) {
NSLog(@"Result: %@", result);
NSLog(@"URLResponse: %@", response);
}];
[self.client invokeAPI:@"MyCustomAPI" body:nil HTTPMethod:@"GET" parameters:nil
headers:nil completion:^(id result, NSHTTPURLResponse *response, NSError *error) {
NSLog(@"Result: %@", result);
NSLog(@"URLResponse: %@", response);
}];
mClient.invokeApi("MyCustomAPI",
new ApiJsonOperationCallback() {
@Override
public void onCompleted(JsonElement jsonData, Exception error,
ServiceFilterResponse response) {
Log.i("JsonData", jsonData.getAsJsonObject().get("message").getAsString());
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment