You can use the client instance obtained in Initialisation to access SDK APIs.
Session
client.getSession().getProfileId();client.getSession().isSuccessfullyCreated();Services
// Messaging related service calls
client.service().messaging();
// User profile related service calls
client.service().profile();
APIsDepending on the client you initialised,
ComapiClientorRxComapiClient, you have access to callbacks or reactive APIs. The reactive version returns Observables you need to subscribe to. For the callback version passcallbackas the last parameter and the request is performed in the background, delivering results in the UI thread.
All service calls return ComapiResult objects that give access to ComapiResult from service calls:
// True if {@link #getCode()} ()} is in the range [200..300).
result.isSuccessful()
// Response data
result.getResult()
// HTTP status message
result.getMessage()
// service call error details
result.getErrorBody()
// HTTP status code.
result.getCode()
// ETag describing version of the data.
result.getETag()
// list of validation failures in request
result.getValidationFailures();Logs
client.getLogs().subscribe(new Action1<String>() {
@Override
public void call(String logs) {
//Internal logs
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable t) {
//Error
}
});For large log data a good alternative is to copy them to a provided file from which they can be read gradually or, for example, sent for inspection.
client.copyLogs(file).subscribe(new Action1<File>() {
@Override
public void call(File logs) {
//Internal logs
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable t) {
//Error
}
});SDK state
client.getState();You can find the list of codes in the
GlobalStateclass.
