Package com.datastax.astra.internal.api
Class ApiResponse
java.lang.Object
com.datastax.astra.internal.api.ApiResponse
- 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> 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
-
ApiResponse
public ApiResponse()Default constructor forApiResponse
. 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.
-