Public interfaces
IDataApiCall
IDataApiCall is a public interface used to execute requests with parameterized objects.
Java:
public interface IDataApiCall<T> {
/**
* It is recommended to call the {@link #cancel()} method before next execution.
*
* @param onSuccessListener callback with response
* @param onFailureListener callback with Throwable instance
*/
void execute(@NonNull DataActionListener<T> onSuccessListener, @NonNull DataActionListener<ApiError> onFailureListener);
/**
* Cancels the API request, therefore no response will be provided nor callback fired. <br>
* It is recommended to call this method when an activity/fragment is being stopped.
*/
void cancel();
/**
* Specify a reactive Scheduler for your request. <br>
* By default, all internal methods use the {@link Schedulers#io()} scheduler.
* See {@link io.reactivex.schedulers.Schedulers} factory for more info.
*
* @param scheduler reactive scheduler.
*/
BasicDataApiCall<T> subscribeOn(Scheduler scheduler);
/**
* Specify your action when the request is being subscribed. This action will be fired just before calling the API.
*
* @param onSubscribeListener callback
*/
BasicDataApiCall<T> onSubscribe(ActionListener onSubscribeListener);
/**
* Specify your action when the request succeeds, fails, or is cancelled.
*
* @param doFinallyListener callback
*/
BasicDataApiCall<T> doFinally(ActionListener doFinallyListener);
/**
* Get the original reactive observable to chain your requests.<br>
* Note that some of the SDK methods not only wrap observables in IDataApiCall,
* but also add some extra logic, which shouldn't be skipped.<br>
*
* @return original reactive observable.
*/
Observable<T> getObservable();
}
IApiCall
IApiCall is a public interface used to execute requests.
Java:
public interface IApiCall<T> {
/**
* It is recommended to call the {@link #cancel()} method before next execution.
*
* @param onSuccessListener successful callback with no response
* @param onFailureListener callback with Throwable instance
*/
void execute(@NonNull ActionListener onSuccessListener, @NonNull DataActionListener<ApiError> onFailureListener);
/**
* Cancels the API request, therefore no response will be provided nor callback fired. <br>
* It is recommended to call this method when an activity/fragment is being stopped.
*/
void cancel();
/**
* Specify a reactive Scheduler for your request. <br>
* By default, all internal methods use the {@link Schedulers#io()} scheduler.
* See {@link io.reactivex.schedulers.Schedulers} factory for more info.
*
* @param scheduler reactive scheduler.
*/
BasicApiCall<T> subscribeOn(Scheduler scheduler);
/**
* Specify your action when the request is being subscribed. This action will be fired just before calling API.
*
* @param onSubscribeListener callback.
*/
BasicApiCall<T> onSubscribe(ActionListener onSubscribeListener);
/**
* Specify your action when the request succeeds, fails, or is cancelled.
*
* @param doFinallyListener callback.
*/
BasicApiCall<T> doFinally(ActionListener doFinallyListener);
/**
* Get the original reactive observable to chain your requests.<br>
* Note that some of SDK methods not only wrap observables in IApiCall,
* but also add some extra logic, which shouldn't be skipped.<br>
*
* @return original reactive observable.
*/
Observable<T> getObservable();
}