Interface TerraApiResponse<T>

  • Type Parameters:
    T - the type of the response body data

    public interface TerraApiResponse<T>
    Interface for any response from Terra's API, containing the returned data from the query (if available) as well as the raw, unparsed body as a JsonNode.
    • Method Detail

      • getResponseCode

        int getResponseCode()
        The HTTP response code that Terra returned from the request.
        Returns:
        the response code
      • isSuccessful

        boolean isSuccessful()
        Whether the request to Terra returned a successful HTTP response code.
        Returns:
        whether the response was successful
      • getType

        @Nullable
        @Nullable String getType()
        The value of the type key in the returned response body. This can be used to check whether this response contains parsed data, or if a special case occurred, such as the request being chunked due to being for more than 30 days of data.
        This will only be null if the request was unsuccessful, i.e. returned a non 2xx status code (accessible through getResponseCode() or isSuccessful()).
        Returns:
        the type of the response payload
      • getMessage

        @Nullable
        @Nullable String getMessage()
        The value of the message key in the returned response body. This is a human-readable value denoting what occurred, however it may not always be provided.
        Returns:
        the message sent with the response payload
      • getRawBody

        com.fasterxml.jackson.databind.JsonNode getRawBody()
        The raw, unparsed JSON body returned with the response.
        Returns:
        the response body
      • getParsedData

        @Nullable
        @Nullable List<T> getParsedData()
        The data parsed from the response body as a list of Java objects.
        Returns:
        the parsed data
      • getUser

        @Nullable
        @Nullable User getUser()
        The user that the request fetched data for.
        Returns:
        the request's user