Package com.cognite.client.servicesV1
Class ResponseItems<T>
- java.lang.Object
-
- com.cognite.client.servicesV1.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 Summary
Constructors Constructor Description ResponseItems()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description com.google.common.collect.ImmutableList<String>getDuplicateItems()Returns a list of duplicate items.com.google.common.collect.ImmutableList<String>getErrorMessage()com.google.common.collect.ImmutableList<String>getMissingItems()abstract ResponseBinarygetResponseBinary()StringgetResponseBodyAsString()com.google.common.collect.ImmutableList<T>getResultsItems()Returns the main result items.com.google.common.collect.ImmutableList<String>getStatus()booleanisSuccessful()static <T> ResponseItems<T>of(ResponseParser<T> responseParser, ResponseBinary response)ResponseItems<T>withDuplicateResponseParser(ResponseParser<String> parser)Specifies the parser for extracting duplicate items from the response payload.ResponseItems<T>withErrorMessageResponseParser(ResponseParser<String> parser)Specifies the parser for extracting the error message from the response payload.ResponseItems<T>withMissingResponseParser(ResponseParser<String> parser)Specifies the parser for extracting missing items from the response payload.ResponseItems<T>withResultsItemsList(com.google.common.collect.ImmutableList<T> itemsList)Specifies a results items list.ResponseItems<T>withStatusResponseParser(ResponseParser<String> parser)Specifies the parser for extracting the error code (http status code) from the response payload.
-
-
-
Method Detail
-
of
public static <T> ResponseItems<T> of(ResponseParser<T> responseParser, ResponseBinary response)
-
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
-
getStatus
public com.google.common.collect.ImmutableList<String> getStatus() 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()
-
-