Client APIs

You can use Comapi 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();

📘

APIs

Depending on the client you initialised ComapiClient or RxComapiClient you will have access to callbacks or reactive APIs. Reactive version returns Observables you need to subscribe to. For callback version pass callback as the last parameter and the request will be performed in the background delivering result in UI thread.

All service calls will return ComapiResult objects that give access to

// 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 logs data a good alternative is to copy them to a provided file from which they can be read gradually or e.g. send 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 GlobalState class.