class RestImpl {

    void signin(String username, String password, final LoginCallback loginCallback) {
        checkNotNull(username, "username == null");
        checkNotNull(password, "password == null");
        checkNotNull(loginCallback, "loginCallback == null");

        RequestBody body = new FormBody.Builder()
                .add("username", username)
                .add("password", password)
                .build();

        HttpUrl url = requestUrl(baseUrl, "login")
                .build();

        Request request = new Request.Builder()
                .url(url)
                .post(body)
                .build();

        Type type = Types.newParameterizedType(RestResult.class, RestToken.class);
        handleSimpleRestCall(request, type, new ValueCallback<RestResult<RestToken>>() {
            @Override
            public void onValue(RestResult<RestToken> data) {
                RestToken restToken = data.result();
                Token token = Token.create(restToken.userId(), restToken.authToken());
                if (tokenProvider != null) {
                    tokenProvider.saveToken(token);
                }
                loginCallback.onLoginSuccess(token);
            }
        }, ERROR_HANDLER(loginCallback));
    }

      RestImpl(OkHttpClient client, Moshi moshi, HttpUrl baseUrl, TokenProvider tokenProvider, Logger logger);

}