Class ResponseItems<T>

  • All Implemented Interfaces:
    Serializable

    public abstract class ResponseItems<T>
    extends Object
    implements Serializable
    This class represents a collection of response items from a Cognite API request.
    See Also:
    Serialized Form
    • Constructor Detail

      • ResponseItems

        public ResponseItems()
    • Method Detail

      • getResponseBinary

        public abstract ResponseBinary getResponseBinary()
      • withDuplicateResponseParser

        public ResponseItems<T> withDuplicateResponseParser​(ResponseParser<String> parser)
        Specifies the parser for extracting duplicate items from the response payload. The default parser looks in the *duplicated* object of the response json.
        Parameters:
        parser -
        Returns:
      • withMissingResponseParser

        public ResponseItems<T> withMissingResponseParser​(ResponseParser<String> parser)
        Specifies the parser for extracting missing items from the response payload. The default parser looks in the *missing* object of the response json.
        Parameters:
        parser -
        Returns:
      • withErrorMessageResponseParser

        public ResponseItems<T> withErrorMessageResponseParser​(ResponseParser<String> parser)
        Specifies the parser for extracting the error message from the response payload. The default parser looks in the *message* attribute of the response json.
        Parameters:
        parser -
        Returns:
      • withStatusResponseParser

        public ResponseItems<T> withStatusResponseParser​(ResponseParser<String> parser)
        Specifies the parser for extracting the error code (http status code) from the response payload. The default parser looks in the *code* attribute of the response json.
        Parameters:
        parser -
        Returns:
      • withResultsItemsList

        public ResponseItems<T> withResultsItemsList​(com.google.common.collect.ImmutableList<T> itemsList)
        Specifies a results items list. By setting this list you will override the default behavior which is to parse the results items from the response body (bytes). That is, if a results items list is specified, the parser will not attempt to parse the response body.
        Parameters:
        itemsList -
        Returns:
      • getResultsItems

        public com.google.common.collect.ImmutableList<T> getResultsItems()
                                                                   throws Exception
        Returns the main result items.
        Returns:
        A list of result items.
        Throws:
        Exception
      • getDuplicateItems

        public com.google.common.collect.ImmutableList<String> getDuplicateItems()
                                                                          throws Exception
        Returns a list of duplicate items.
        Returns:
        A list of duplicate items.
        Throws:
        Exception
      • getMissingItems

        public com.google.common.collect.ImmutableList<String> getMissingItems()
                                                                        throws Exception
        Throws:
        Exception
      • getErrorMessage

        public com.google.common.collect.ImmutableList<String> getErrorMessage()
                                                                        throws Exception
        Throws:
        Exception
      • getResponseBodyAsString

        public String getResponseBodyAsString()
      • isSuccessful

        public boolean isSuccessful()