Package com.datastax.astra.internal.api
Class DataAPIResponse
java.lang.Object
com.datastax.astra.internal.api.DataAPIResponse
- All Implemented Interfaces:
Serializable
Represents the generic response structure for API calls. This class encapsulates different segments of the response,
such as status information, error details, and data returned by 'find' operations. It provides flexibility to handle
various types of responses within a unified framework.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T> T
Retrieves a single object from the 'status' map based on the provided key, casting it to the specified class.<T> List
<T> getStatusKeyAsList
(@NonNull String key, Class<T> targetClass) Retrieves a list of objects from the 'status' map based on the provided key, casting them to the specified class.getStatusKeyAsMap
(@NonNull String key, Class<T> targetClass) Retrieves a list of objects from the 'status' map based on the provided key, casting them to the specified class.getStatusKeyAsStringStream
(@NonNull String key) Retrieves a stream ofString
values from the 'status' map based on the provided key.
-
Constructor Details
-
DataAPIResponse
public DataAPIResponse()Default constructor forDataAPIResponse
. Initializes a new instance of the class without setting any properties.
-
-
Method Details
-
getStatusKeyAsStringStream
Retrieves a stream ofString
values from the 'status' map based on the provided key. This method is useful for processing multiple values associated with a single key in the status information. -
getStatusKeyAsList
Retrieves a list of objects from the 'status' map based on the provided key, casting them to the specified class. This method is suitable for cases where the status information contains lists of objects under a single key.- Type Parameters:
T
- The type of the objects in the list to be returned.- Parameters:
key
- The key for which to retrieve the list.targetClass
- The class to which the objects in the list should be cast.- Returns:
- The list of objects associated with the specified key, cast to the specified class;
null
if the key does not exist.
-
getStatusKeyAsMap
Retrieves a list of objects from the 'status' map based on the provided key, casting them to the specified class. This method is suitable for cases where the status information contains lists of objects under a single key.- Type Parameters:
T
- The type of the objects in the list to be returned.- Parameters:
key
- The key for which to retrieve the list.targetClass
- The class to which the objects in the list should be cast.- Returns:
- The list of objects associated with the specified key, cast to the specified class;
null
if the key does not exist.
-
getStatus
Retrieves a single object from the 'status' map based on the provided key, casting it to the specified class. This method is suitable for cases where the status information contains a single object under a specific key.- Type Parameters:
T
- The type of the object to be returned.- Parameters:
targetClass
- The class to which the object should be cast.- Returns:
- The object associated with the specified key, cast to the specified class;
null
if the key does not exist.
-