Package io.vantiq.client
Interface ResponseHandler
- All Known Implementing Classes:
BaseResponseHandler
public interface ResponseHandler
Interface to handle the response from the Vantiq server.
-
Method Summary
Modifier and TypeMethodDescriptionvoidonError(List<VantiqError> errors, okhttp3.Response response) Called if a server error is returned (e.g.voidCalled if a client side exception occurs during the request or response processing.voidThis is called when a successful HTTP response is returned from the server.
-
Method Details
-
onSuccess
This is called when a successful HTTP response is returned from the server. The type of the body is determined by the Content-Type of the response. For JSON responses, the body will be a Gson JsonElement. Otherwise, a string is returned.- Parameters:
body- The parsed response from the server. The type of the response is determined by SDK method being called.response- The raw response from the server. This provides access to the HTTP status code, headers, and raw body.
-
onError
Called if a server error is returned (e.g. HTTP 4xx or 5xx status codes), then the status code is returned along with the errors that were found.- Parameters:
errors- The errors returned by the Vantiq server.response- The raw response from the server. This provides access to the HTTP status code, headers, and raw body.
-
onFailure
Called if a client side exception occurs during the request or response processing.- Parameters:
t- The exception thrown during the client-side processing.
-