Class VantiqResponse

java.lang.Object
io.vantiq.client.VantiqResponse

public class VantiqResponse extends Object
This class represents the response from Vantiq from a single operation.
  • Constructor Details

    • VantiqResponse

      public VantiqResponse(Object body, okhttp3.Response response)
    • VantiqResponse

      public VantiqResponse(List<VantiqError> errors, okhttp3.Response response)
    • VantiqResponse

      public VantiqResponse(Throwable exception)
  • Method Details

    • createFromResponse

      public static VantiqResponse createFromResponse(okhttp3.Response response, boolean isStreamingResponse)
    • setBody

      protected void setBody(Object body)
    • extractBody

      public static Object extractBody(okhttp3.Response response, boolean isStreamingResponse) throws IOException
      Throws:
      IOException
    • extractErrors

      public static List<VantiqError> extractErrors(okhttp3.Response response) throws IOException
      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

      public Throwable getException()
      Returns the exception if hasException() returned true
      Returns:
      The exception that was thrown or null
    • getErrors

      public List<VantiqError> getErrors()
      Returns the errors if hasErrors() 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

      public String 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

      public Object getBody()
      Returns the response body. If there was an exception or error, then no body will exist.
      Returns:
      The parsed response body
    • toString

      public String toString()
      Overrides:
      toString in class Object