Package io.vantiq.client
Class VantiqResponse
java.lang.Object
io.vantiq.client.VantiqResponse
This class represents the response from Vantiq from a single operation.
-
Constructor Summary
ConstructorsConstructorDescriptionVantiqResponse(Object body, okhttp3.Response response) VantiqResponse(Throwable exception) VantiqResponse(List<VantiqError> errors, okhttp3.Response response) -
Method Summary
Modifier and TypeMethodDescriptionstatic VantiqResponsecreateFromResponse(okhttp3.Response response, boolean isStreamingResponse) static ObjectextractBody(okhttp3.Response response, boolean isStreamingResponse) static List<VantiqError>extractErrors(okhttp3.Response response) getBody()Returns the response body.Returns the content type from the "Content-Type" HTTP response header.intgetCount()Returns the count from the "X-Total-Count" header.Returns the errors ifhasErrors()returned trueReturns the exception ifhasException()returned trueokhttp3.ResponseReturns the underlying response objectintReturns the HTTP status code returned from the responsebooleanReturns true if at least one error was returned from the serverbooleanReturns true if an exception occurred during the client processingbooleanReturns true if the call was successfully, meaning there were no errors or exceptionsprotected voidtoString()
-
Constructor Details
-
VantiqResponse
-
VantiqResponse
-
VantiqResponse
-
-
Method Details
-
createFromResponse
public static VantiqResponse createFromResponse(okhttp3.Response response, boolean isStreamingResponse) -
setBody
-
extractBody
public static Object extractBody(okhttp3.Response response, boolean isStreamingResponse) throws IOException - Throws:
IOException
-
extractErrors
- Throws:
IOException
-
getResponse
public okhttp3.Response getResponse()Returns the underlying response object- Returns:
- The raw response from the Vantiq server
-
isSuccess
public boolean isSuccess()Returns true if the call was successfully, meaning there were no errors or exceptions- Returns:
- Boolean indicating if the call was successful.
-
hasErrors
public boolean hasErrors()Returns true if at least one error was returned from the server- Returns:
- true if at least one error exists
-
hasException
public boolean hasException()Returns true if an exception occurred during the client processing- Returns:
- true if an exception was thrown
-
getException
Returns the exception ifhasException()returned true- Returns:
- The exception that was thrown or null
-
getErrors
Returns the errors ifhasErrors()returned true- Returns:
- The errors returned from the Vantiq server or null
-
getCount
public int getCount()Returns the count from the "X-Total-Count" header. If the header wasn't present, then the count returns -1.- Returns:
- The returned count or -1 if no count header was present.
-
getContentType
Returns the content type from the "Content-Type" HTTP response header.- Returns:
- The content type of the response
-
getStatusCode
public int getStatusCode()Returns the HTTP status code returned from the response- Returns:
- The HTTP status code for the response
-
getBody
Returns the response body. If there was an exception or error, then no body will exist.- Returns:
- The parsed response body
-
toString
-