Package io.stargate.sdk.data.utils
Class DataApiUtils
java.lang.Object
io.stargate.sdk.data.utils.DataApiUtils
Utilities for the Json Client
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildRequestBody(String function) Body with no payload.static StringbuildRequestBody(String function, Object content) Build request Body as expect by the api { 'operation': { 'content': 'content' } }static ApiResponseexecuteOperation(@NonNull LoadBalancedHttpClient stargateHttpClient, @NonNull Function<ServiceHttp, String> rootResource, @NonNull String operation, Object body) Wrapper to execute Http POST request.static voidvalidate(@NonNull ApiResponse response) Parse Errors in the output body if present.
-
Method Details
-
executeOperation
public static ApiResponse executeOperation(@NonNull @NonNull LoadBalancedHttpClient stargateHttpClient, @NonNull @NonNull Function<ServiceHttp, String> rootResource, @NonNull @NonNull String operation, Object body) Wrapper to execute Http POST request.- Parameters:
stargateHttpClient- http clientrootResource- rest resourceoperation- operation namebody- body to send- Returns:
- json Api response
-
buildRequestBody
Build request Body as expect by the api { 'operation': { 'content': 'content' } }- Parameters:
function- the function to callcontent- Object to serialize as json- Returns:
- request body
-
buildRequestBody
Body with no payload.- Parameters:
function- current function- Returns:
- request
-
validate
Parse Errors in the output body if present.- Parameters:
response- returned by the Api. body to parse
-