Interface ServiceCall<T>

  • Type Parameters:
    T - the generic type

    public interface ServiceCall<T>
    Service Call.
    • Method Detail

      • addHeader

        ServiceCall<T> addHeader​(java.lang.String name,
                                 java.lang.String value)
        Add a header to the request before executing.
        Parameters:
        name - the name of the header
        value - the value of the header
        Returns:
        the ServiceCall with updated headers
      • execute

        Response<T> execute()
                     throws java.lang.RuntimeException
        Synchronous request.
        Returns:
        a Response object with the generic response model and various HTTP information fields
        Throws:
        java.lang.RuntimeException - the exception from HTTP request
      • enqueue

        void enqueue​(ServiceCallback<T> callback)
        Asynchronous request with added HTTP information. In this case, you receive a callback when the data has been received.
        Parameters:
        callback - the callback
      • reactiveRequest

        io.reactivex.Single<Response<T>> reactiveRequest()
        Reactive request using the RxJava 2 library. See https://github.com/ReactiveX/RxJava. In addition, the wrapped service call will contain added HTTP information.
        Returns:
        a Single object containing the service call to be observed/subscribed to
      • cancel

        void cancel()
        Cancel the current request if possible.