//both sync and async processing are supported by calling "sync" on any FutureDate object
// Usage u = datasift.usage().sync();
// System.out.println(u);
//all response objects extend DataSiftResult which present these utility methods
DataSiftResult result = datasift.compile(csdl).sync();
//is successful returns true if a response hasn't explicitly been marked as failed,
//there is a valid response, no exceptions are set and the response status is between 200 - 399
if (!result.isSuccessful()) {
//if true an exception may have caused the request to fail, inspect the cause if available
if (result.failureCause() != null) { //may not be an exception
result.failureCause().printStackTrace();
}
return;
}
//is true if isSuccessful() == true and the response status is not 401
result.isAuthorizationSuccesful();
//allows access to the response object which you can list the request and JSON string response from
result.getResponse();
//gets the rate limit DataSift returned with the response, use it to keep track of usage
result.rateLimit();
//returns the cost of executing the request which produced this result
result.rateLimitCost();
//what's left of your rate limit quota
result.rateLimitRemaining();
Usage usage = datasift.usage().sync();
Stream stream = Stream.fromString("13e9347e7da32f19fcdb08e297019d2e");
Dpu dpu = datasift.dpu(stream).sync();