re
response.statusCode(), message, response.headers(), response.body());
}
+ /**
+ * Normalizes any failure raised while performing the call into the single failure type callers
+ * are told to expect. Transport-level errors surfaced by {@code HttpClient.sendAsync} -
+ * connection refused, DNS failures, TLS errors, timeouts - would otherwise reach the caller as
+ * a raw {@link java.io.IOException}, which makes the documented {@code (ApiException)
+ * e.getCause()} throw {@link ClassCastException}.
+ *
+ * {@link CancellationException} is passed through unchanged: a cancelled call is not an API
+ * failure.
+ */
+ private static Throwable toApiFailure(Throwable throwable) {
+ Throwable cause = throwable;
+ while ((cause instanceof CompletionException || cause instanceof ExecutionException)
+ && cause.getCause() != null) {
+ cause = cause.getCause();
+ }
+ if (cause instanceof ApiException || cause instanceof CancellationException) {
+ return cause;
+ }
+ return new ApiException(cause);
+ }
+
private String formatExceptionMessage(String operationId, int statusCode, String body) {
if (body == null || body.isEmpty()) {
body = "[no body]";
@@ -81,11 +106,11 @@ private String formatExceptionMessage(String operationId, int statusCode, String
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<Void>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<Void>>, which completes exceptionally with
+ * an {@link ApiException} if the API call fails
*/
public CompletableFuture> createApiUser(
- CreateAPIUser createAPIUser, String idempotencyKey) throws ApiException {
+ CreateAPIUser createAPIUser, String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
createApiUserRequestBuilder(createAPIUser, idempotencyKey);
@@ -105,7 +130,14 @@ public CompletableFuture> createApiUser(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
null));
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture.>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -146,10 +178,10 @@ private HttpRequest.Builder createApiUserRequestBuilder(
* available only for API keys with Admin/Non Signing Admin permissions. Endpoint Permission:
* Admin, Non-Signing Admin.
*
- * @return CompletableFuture<ApiResponse<GetAPIUsersResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<GetAPIUsersResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
- public CompletableFuture> getApiUsers() throws ApiException {
+ public CompletableFuture> getApiUsers() {
try {
HttpRequest.Builder localVarRequestBuilder = getApiUsersRequestBuilder();
return memberVarHttpClient
@@ -178,7 +210,15 @@ public CompletableFuture> getApiUsers() throws
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -214,11 +254,11 @@ private HttpRequest.Builder getApiUsersRequestBuilder() throws ApiException {
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<IssueApiUserPairingTokenResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<IssueApiUserPairingTokenResponse>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
- issueApiUserPairingToken(String userId, String idempotencyKey) throws ApiException {
+ issueApiUserPairingToken(String userId, String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
issueApiUserPairingTokenRequestBuilder(userId, idempotencyKey);
@@ -249,7 +289,17 @@ private HttpRequest.Builder getApiUsersRequestBuilder() throws ApiException {
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
diff --git a/src/main/java/com/fireblocks/sdk/api/AuditLogsApi.java b/src/main/java/com/fireblocks/sdk/api/AuditLogsApi.java
index b162af49..06fa1dcc 100644
--- a/src/main/java/com/fireblocks/sdk/api/AuditLogsApi.java
+++ b/src/main/java/com/fireblocks/sdk/api/AuditLogsApi.java
@@ -30,7 +30,10 @@
import java.util.ArrayList;
import java.util.List;
import java.util.StringJoiner;
+import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
@jakarta.annotation.Generated(
@@ -66,6 +69,28 @@ private ApiException getApiException(String operationId, HttpResponse re
response.statusCode(), message, response.headers(), response.body());
}
+ /**
+ * Normalizes any failure raised while performing the call into the single failure type callers
+ * are told to expect. Transport-level errors surfaced by {@code HttpClient.sendAsync} -
+ * connection refused, DNS failures, TLS errors, timeouts - would otherwise reach the caller as
+ * a raw {@link java.io.IOException}, which makes the documented {@code (ApiException)
+ * e.getCause()} throw {@link ClassCastException}.
+ *
+ * {@link CancellationException} is passed through unchanged: a cancelled call is not an API
+ * failure.
+ */
+ private static Throwable toApiFailure(Throwable throwable) {
+ Throwable cause = throwable;
+ while ((cause instanceof CompletionException || cause instanceof ExecutionException)
+ && cause.getCause() != null) {
+ cause = cause.getCause();
+ }
+ if (cause instanceof ApiException || cause instanceof CancellationException) {
+ return cause;
+ }
+ return new ApiException(cause);
+ }
+
private String formatExceptionMessage(String operationId, int statusCode, String body) {
if (body == null || body.isEmpty()) {
body = "[no body]";
@@ -101,8 +126,8 @@ private String formatExceptionMessage(String operationId, int statusCode, String
* @param pageCursor Cursor returned from the previous response to fetch the next page.
* (optional)
* @param cursor Deprecated. Use pageCursor instead. (optional)
- * @return CompletableFuture<ApiResponse<GetAuditLogsResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<GetAuditLogsResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> getAuditLogs(
Integer startTime,
@@ -116,8 +141,7 @@ public CompletableFuture> getAuditLogs(
String order,
Integer pageSize,
String pageCursor,
- String cursor)
- throws ApiException {
+ String cursor) {
try {
HttpRequest.Builder localVarRequestBuilder =
getAuditLogsRequestBuilder(
@@ -159,7 +183,17 @@ public CompletableFuture> getAuditLogs(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
diff --git a/src/main/java/com/fireblocks/sdk/api/BlockchainLinkBetaApi.java b/src/main/java/com/fireblocks/sdk/api/BlockchainLinkBetaApi.java
index 819ac2a0..21c9fd8a 100644
--- a/src/main/java/com/fireblocks/sdk/api/BlockchainLinkBetaApi.java
+++ b/src/main/java/com/fireblocks/sdk/api/BlockchainLinkBetaApi.java
@@ -45,7 +45,10 @@
import java.util.List;
import java.util.StringJoiner;
import java.util.UUID;
+import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
@jakarta.annotation.Generated(
@@ -81,6 +84,28 @@ private ApiException getApiException(String operationId, HttpResponse re
response.statusCode(), message, response.headers(), response.body());
}
+ /**
+ * Normalizes any failure raised while performing the call into the single failure type callers
+ * are told to expect. Transport-level errors surfaced by {@code HttpClient.sendAsync} -
+ * connection refused, DNS failures, TLS errors, timeouts - would otherwise reach the caller as
+ * a raw {@link java.io.IOException}, which makes the documented {@code (ApiException)
+ * e.getCause()} throw {@link ClassCastException}.
+ *
+ * {@link CancellationException} is passed through unchanged: a cancelled call is not an API
+ * failure.
+ */
+ private static Throwable toApiFailure(Throwable throwable) {
+ Throwable cause = throwable;
+ while ((cause instanceof CompletionException || cause instanceof ExecutionException)
+ && cause.getCause() != null) {
+ cause = cause.getCause();
+ }
+ if (cause instanceof ApiException || cause instanceof CancellationException) {
+ return cause;
+ }
+ return new ApiException(cause);
+ }
+
private String formatExceptionMessage(String operationId, int statusCode, String body) {
if (body == null || body.isEmpty()) {
body = "[no body]";
@@ -97,11 +122,11 @@ private String formatExceptionMessage(String operationId, int statusCode, String
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<ActivateBlockchainResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ActivateBlockchainResponse>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> activateBlockchainLinkChain(
- String blockchainId, String idempotencyKey) throws ApiException {
+ String blockchainId, String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
activateBlockchainLinkChainRequestBuilder(blockchainId, idempotencyKey);
@@ -133,7 +158,17 @@ public CompletableFuture> activateBlockc
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -175,12 +210,11 @@ private HttpRequest.Builder activateBlockchainLinkChainRequestBuilder(
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<CreateBlockchainResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<CreateBlockchainResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> createBlockchainLinkChain(
- CreateBlockchainRequest createBlockchainRequest, String idempotencyKey)
- throws ApiException {
+ CreateBlockchainRequest createBlockchainRequest, String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
createBlockchainLinkChainRequestBuilder(
@@ -212,7 +246,17 @@ public CompletableFuture> createBlockchain
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -257,11 +301,10 @@ private HttpRequest.Builder createBlockchainLinkChainRequestBuilder(
* must not be in an active lifecycle state.
*
* @param blockchainId tenant_id is extracted from JWT token context (required)
- * @return CompletableFuture<ApiResponse<Void>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<Void>>, which completes exceptionally with
+ * an {@link ApiException} if the API call fails
*/
- public CompletableFuture> deleteBlockchainLinkChain(String blockchainId)
- throws ApiException {
+ public CompletableFuture> deleteBlockchainLinkChain(String blockchainId) {
try {
HttpRequest.Builder localVarRequestBuilder =
deleteBlockchainLinkChainRequestBuilder(blockchainId);
@@ -282,7 +325,14 @@ public CompletableFuture> deleteBlockchainLinkChain(String blo
localVarResponse.statusCode(),
localVarResponse.headers().map(),
null));
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture.>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -316,11 +366,10 @@ private HttpRequest.Builder deleteBlockchainLinkChainRequestBuilder(String block
* Get tenant billing info Returns the tenant's blockchain activation limit and current
* usage. tenant_id is derived from the JWT token context.
*
- * @return CompletableFuture<ApiResponse<GetBillingInfoResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<GetBillingInfoResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
- public CompletableFuture> getBlockchainLinkBillingInfo()
- throws ApiException {
+ public CompletableFuture> getBlockchainLinkBillingInfo() {
try {
HttpRequest.Builder localVarRequestBuilder =
getBlockchainLinkBillingInfoRequestBuilder();
@@ -352,7 +401,17 @@ public CompletableFuture> getBlockchainLinkB
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -382,11 +441,11 @@ private HttpRequest.Builder getBlockchainLinkBillingInfoRequestBuilder() throws
*
* @param blockchainId ID of the blockchain to retrieve (supplied as a path parameter).
* (required)
- * @return CompletableFuture<ApiResponse<GetBlockchainByIdResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<GetBlockchainByIdResponse>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> getBlockchainLinkChain(
- String blockchainId) throws ApiException {
+ String blockchainId) {
try {
HttpRequest.Builder localVarRequestBuilder =
getBlockchainLinkChainRequestBuilder(blockchainId);
@@ -417,7 +476,17 @@ public CompletableFuture> getBlockchainLi
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -452,11 +521,11 @@ private HttpRequest.Builder getBlockchainLinkChainRequestBuilder(String blockcha
* wallet private key, used by the UI for test transfers. tenant_id is derived from the JWT
* token context.
*
- * @return CompletableFuture<ApiResponse<GetTestWalletAddressResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<GetTestWalletAddressResponse>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
- getBlockchainLinkTestWalletAddress() throws ApiException {
+ getBlockchainLinkTestWalletAddress() {
try {
HttpRequest.Builder localVarRequestBuilder =
getBlockchainLinkTestWalletAddressRequestBuilder();
@@ -488,7 +557,17 @@ private HttpRequest.Builder getBlockchainLinkChainRequestBuilder(String blockcha
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -531,8 +610,8 @@ private HttpRequest.Builder getBlockchainLinkTestWalletAddressRequestBuilder()
* @param sortBy Sort field. Default: createdAt. (optional)
* @param order Sort order. Default: DESC. (optional, default to DESC)
* @param statusExclude Exclude filter (repeated query params). (optional
- * @return CompletableFuture<ApiResponse<ListBlockchainsResponse2>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ListBlockchainsResponse2>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> listBlockchainLinkChains(
String pageCursor,
@@ -542,8 +621,7 @@ public CompletableFuture> listBlockchainLi
BlockchainEnvironment blockchainEnv,
BlockchainSortField sortBy,
String order,
- List statusExclude)
- throws ApiException {
+ List statusExclude) {
try {
HttpRequest.Builder localVarRequestBuilder =
listBlockchainLinkChainsRequestBuilder(
@@ -582,7 +660,17 @@ public CompletableFuture> listBlockchainLi
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -655,12 +743,11 @@ private HttpRequest.Builder listBlockchainLinkChainsRequestBuilder(
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<TriggerValidationFlowResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<TriggerValidationFlowResponse>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
- triggerBlockchainLinkValidation(UUID blockchainId, String idempotencyKey)
- throws ApiException {
+ triggerBlockchainLinkValidation(UUID blockchainId, String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
triggerBlockchainLinkValidationRequestBuilder(blockchainId, idempotencyKey);
@@ -692,7 +779,17 @@ private HttpRequest.Builder listBlockchainLinkChainsRequestBuilder(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -734,14 +831,13 @@ private HttpRequest.Builder triggerBlockchainLinkValidationRequestBuilder(
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<UpdateBlockchainResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<UpdateBlockchainResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> updateBlockchainLinkChain(
BlockchainDeclaredProperties blockchainDeclaredProperties,
String blockchainId,
- String idempotencyKey)
- throws ApiException {
+ String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
updateBlockchainLinkChainRequestBuilder(
@@ -773,7 +869,17 @@ public CompletableFuture> updateBlockchain
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
diff --git a/src/main/java/com/fireblocks/sdk/api/BlockchainsAssetsApi.java b/src/main/java/com/fireblocks/sdk/api/BlockchainsAssetsApi.java
index 347d4e75..19345fcc 100644
--- a/src/main/java/com/fireblocks/sdk/api/BlockchainsAssetsApi.java
+++ b/src/main/java/com/fireblocks/sdk/api/BlockchainsAssetsApi.java
@@ -43,7 +43,10 @@
import java.util.ArrayList;
import java.util.List;
import java.util.StringJoiner;
+import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
@jakarta.annotation.Generated(
@@ -79,6 +82,28 @@ private ApiException getApiException(String operationId, HttpResponse re
response.statusCode(), message, response.headers(), response.body());
}
+ /**
+ * Normalizes any failure raised while performing the call into the single failure type callers
+ * are told to expect. Transport-level errors surfaced by {@code HttpClient.sendAsync} -
+ * connection refused, DNS failures, TLS errors, timeouts - would otherwise reach the caller as
+ * a raw {@link java.io.IOException}, which makes the documented {@code (ApiException)
+ * e.getCause()} throw {@link ClassCastException}.
+ *
+ * {@link CancellationException} is passed through unchanged: a cancelled call is not an API
+ * failure.
+ */
+ private static Throwable toApiFailure(Throwable throwable) {
+ Throwable cause = throwable;
+ while ((cause instanceof CompletionException || cause instanceof ExecutionException)
+ && cause.getCause() != null) {
+ cause = cause.getCause();
+ }
+ if (cause instanceof ApiException || cause instanceof CancellationException) {
+ return cause;
+ }
+ return new ApiException(cause);
+ }
+
private String formatExceptionMessage(String operationId, int statusCode, String body) {
if (body == null || body.isEmpty()) {
body = "[no body]";
@@ -95,11 +120,10 @@ private String formatExceptionMessage(String operationId, int statusCode, String
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<Asset>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<Asset>>, which completes exceptionally with
+ * an {@link ApiException} if the API call fails
*/
- public CompletableFuture> getAsset(String id, String idempotencyKey)
- throws ApiException {
+ public CompletableFuture> getAsset(String id, String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder = getAssetRequestBuilder(id, idempotencyKey);
return memberVarHttpClient
@@ -128,7 +152,14 @@ public CompletableFuture> getAsset(String id, String idempote
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture.>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -162,11 +193,10 @@ private HttpRequest.Builder getAssetRequestBuilder(String id, String idempotency
* Get a Blockchain by ID Returns a blockchain by ID or legacyID.
*
* @param id The ID or legacyId of the blockchain (required)
- * @return CompletableFuture<ApiResponse<BlockchainResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<BlockchainResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
- public CompletableFuture> getBlockchain(String id)
- throws ApiException {
+ public CompletableFuture> getBlockchain(String id) {
try {
HttpRequest.Builder localVarRequestBuilder = getBlockchainRequestBuilder(id);
return memberVarHttpClient
@@ -195,7 +225,15 @@ public CompletableFuture> getBlockchain(String i
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -230,11 +268,10 @@ private HttpRequest.Builder getBlockchainRequestBuilder(String id) throws ApiExc
* by Fireblocks in your workspace. **Endpoint Permissions:** Admin, Non-Signing Admin, Signer,
* Approver, Editor.
*
- * @return CompletableFuture<ApiResponse<List<AssetTypeResponse>>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<List<AssetTypeResponse>>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
- public CompletableFuture>> getSupportedAssets()
- throws ApiException {
+ public CompletableFuture>> getSupportedAssets() {
try {
HttpRequest.Builder localVarRequestBuilder = getSupportedAssetsRequestBuilder();
return memberVarHttpClient
@@ -265,7 +302,17 @@ public CompletableFuture>> getSupportedAsset
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -307,8 +354,8 @@ private HttpRequest.Builder getSupportedAssetsRequestBuilder() throws ApiExcepti
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<ListAssetsResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ListAssetsResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> listAssets(
String blockchainId,
@@ -319,8 +366,7 @@ public CompletableFuture> listAssets(
List ids,
String pageCursor,
BigDecimal pageSize,
- String idempotencyKey)
- throws ApiException {
+ String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
listAssetsRequestBuilder(
@@ -359,7 +405,15 @@ public CompletableFuture> listAssets(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -436,8 +490,8 @@ private HttpRequest.Builder listAssetsRequestBuilder(
* @param ids A list of blockchain IDs (max 100) (optional
* @param pageCursor Page cursor to fetch (optional)
* @param pageSize Items per page (max 500) (optional, default to 500)
- * @return CompletableFuture<ApiResponse<ListBlockchainsResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ListBlockchainsResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> listBlockchains(
String protocol,
@@ -445,8 +499,7 @@ public CompletableFuture> listBlockchains(
Boolean test,
List ids,
String pageCursor,
- BigDecimal pageSize)
- throws ApiException {
+ BigDecimal pageSize) {
try {
HttpRequest.Builder localVarRequestBuilder =
listBlockchainsRequestBuilder(
@@ -477,7 +530,17 @@ public CompletableFuture> listBlockchains(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -544,12 +607,11 @@ private HttpRequest.Builder listBlockchainsRequestBuilder(
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<AssetResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<AssetResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> registerNewAsset(
- RegisterNewAssetRequest registerNewAssetRequest, String idempotencyKey)
- throws ApiException {
+ RegisterNewAssetRequest registerNewAssetRequest, String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
registerNewAssetRequestBuilder(registerNewAssetRequest, idempotencyKey);
@@ -579,7 +641,15 @@ public CompletableFuture> registerNewAsset(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -625,12 +695,11 @@ private HttpRequest.Builder registerNewAssetRequestBuilder(
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<AssetPriceResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<AssetPriceResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> setAssetPrice(
- String id, SetAssetPriceRequest setAssetPriceRequest, String idempotencyKey)
- throws ApiException {
+ String id, SetAssetPriceRequest setAssetPriceRequest, String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
setAssetPriceRequestBuilder(id, setAssetPriceRequest, idempotencyKey);
@@ -660,7 +729,15 @@ public CompletableFuture> setAssetPrice(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -708,14 +785,13 @@ private HttpRequest.Builder setAssetPriceRequestBuilder(
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<Asset>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<Asset>>, which completes exceptionally with
+ * an {@link ApiException} if the API call fails
*/
public CompletableFuture> updateAssetUserMetadata(
String id,
UpdateAssetUserMetadataRequest updateAssetUserMetadataRequest,
- String idempotencyKey)
- throws ApiException {
+ String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
updateAssetUserMetadataRequestBuilder(
@@ -747,7 +823,14 @@ public CompletableFuture> updateAssetUserMetadata(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture.>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
diff --git a/src/main/java/com/fireblocks/sdk/api/ComplianceApi.java b/src/main/java/com/fireblocks/sdk/api/ComplianceApi.java
index 3ed43f73..79d9efe9 100644
--- a/src/main/java/com/fireblocks/sdk/api/ComplianceApi.java
+++ b/src/main/java/com/fireblocks/sdk/api/ComplianceApi.java
@@ -67,7 +67,10 @@
import java.util.List;
import java.util.StringJoiner;
import java.util.UUID;
+import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
@jakarta.annotation.Generated(
@@ -103,6 +106,28 @@ private ApiException getApiException(String operationId, HttpResponse re
response.statusCode(), message, response.headers(), response.body());
}
+ /**
+ * Normalizes any failure raised while performing the call into the single failure type callers
+ * are told to expect. Transport-level errors surfaced by {@code HttpClient.sendAsync} -
+ * connection refused, DNS failures, TLS errors, timeouts - would otherwise reach the caller as
+ * a raw {@link java.io.IOException}, which makes the documented {@code (ApiException)
+ * e.getCause()} throw {@link ClassCastException}.
+ *
+ * {@link CancellationException} is passed through unchanged: a cancelled call is not an API
+ * failure.
+ */
+ private static Throwable toApiFailure(Throwable throwable) {
+ Throwable cause = throwable;
+ while ((cause instanceof CompletionException || cause instanceof ExecutionException)
+ && cause.getCause() != null) {
+ cause = cause.getCause();
+ }
+ if (cause instanceof ApiException || cause instanceof CancellationException) {
+ return cause;
+ }
+ return new ApiException(cause);
+ }
+
private String formatExceptionMessage(String operationId, int statusCode, String body) {
if (body == null || body.isEmpty()) {
body = "[no body]";
@@ -118,11 +143,11 @@ private String formatExceptionMessage(String operationId, int statusCode, String
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<ArsConfigResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ArsConfigResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> activateArsConfig(
- String idempotencyKey) throws ApiException {
+ String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
activateArsConfigRequestBuilder(idempotencyKey);
@@ -152,7 +177,15 @@ public CompletableFuture> activateArsConfig(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -189,11 +222,11 @@ private HttpRequest.Builder activateArsConfigRequestBuilder(String idempotencyKe
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<ByorkConfigResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ByorkConfigResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> activateByorkConfig(
- String idempotencyKey) throws ApiException {
+ String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
activateByorkConfigRequestBuilder(idempotencyKey);
@@ -224,7 +257,15 @@ public CompletableFuture> activateByorkConfig(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -261,14 +302,13 @@ private HttpRequest.Builder activateByorkConfigRequestBuilder(String idempotency
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<AddressRegistryAddVaultOptOutsResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<AddressRegistryAddVaultOptOutsResponse>>,
+ * which completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
addAddressRegistryVaultOptOuts(
AddressRegistryAddVaultOptOutsRequest addressRegistryAddVaultOptOutsRequest,
- String idempotencyKey)
- throws ApiException {
+ String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
addAddressRegistryVaultOptOutsRequestBuilder(
@@ -301,7 +341,18 @@ private HttpRequest.Builder activateByorkConfigRequestBuilder(String idempotency
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -354,15 +405,14 @@ private HttpRequest.Builder addAddressRegistryVaultOptOutsRequestBuilder(
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<AssignVaultsToLegalEntityResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<AssignVaultsToLegalEntityResponse>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
assignVaultsToLegalEntity(
AssignVaultsToLegalEntityRequest assignVaultsToLegalEntityRequest,
UUID legalEntityId,
- String idempotencyKey)
- throws ApiException {
+ String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
assignVaultsToLegalEntityRequestBuilder(
@@ -394,7 +444,18 @@ private HttpRequest.Builder addAddressRegistryVaultOptOutsRequestBuilder(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -450,12 +511,11 @@ private HttpRequest.Builder assignVaultsToLegalEntityRequestBuilder(
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<CounterpartyGroup>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<CounterpartyGroup>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> createCounterpartyGroup(
- CreateCounterpartyGroupRequest createCounterpartyGroupRequest, String idempotencyKey)
- throws ApiException {
+ CreateCounterpartyGroupRequest createCounterpartyGroupRequest, String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
createCounterpartyGroupRequestBuilder(
@@ -487,7 +547,15 @@ public CompletableFuture> createCounterpartyGroup
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -537,11 +605,11 @@ private HttpRequest.Builder createCounterpartyGroupRequestBuilder(
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<ArsConfigResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ArsConfigResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> deactivateArsConfig(
- String idempotencyKey) throws ApiException {
+ String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
deactivateArsConfigRequestBuilder(idempotencyKey);
@@ -572,7 +640,15 @@ public CompletableFuture> deactivateArsConfig(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -609,11 +685,11 @@ private HttpRequest.Builder deactivateArsConfigRequestBuilder(String idempotency
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<ByorkConfigResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ByorkConfigResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> deactivateByorkConfig(
- String idempotencyKey) throws ApiException {
+ String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
deactivateByorkConfigRequestBuilder(idempotencyKey);
@@ -644,7 +720,15 @@ public CompletableFuture> deactivateByorkConfig
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -678,11 +762,10 @@ private HttpRequest.Builder deactivateByorkConfigRequestBuilder(String idempoten
* Permissions:** Admin, Non-Signing Admin.
*
* @param groupId The unique identifier of the counterparty group (required)
- * @return CompletableFuture<ApiResponse<Void>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<Void>>, which completes exceptionally with
+ * an {@link ApiException} if the API call fails
*/
- public CompletableFuture> deleteCounterpartyGroup(UUID groupId)
- throws ApiException {
+ public CompletableFuture> deleteCounterpartyGroup(UUID groupId) {
try {
HttpRequest.Builder localVarRequestBuilder =
deleteCounterpartyGroupRequestBuilder(groupId);
@@ -703,7 +786,14 @@ public CompletableFuture> deleteCounterpartyGroup(UUID groupId
localVarResponse.statusCode(),
localVarResponse.headers().map(),
null));
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture.>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -738,11 +828,10 @@ private HttpRequest.Builder deleteCounterpartyGroupRequestBuilder(UUID groupId)
* registration to REVOKED. Endpoint Permission: Admin, Non-Signing Admin.
*
* @param legalEntityId The unique ID of the legal entity registration to delete (required)
- * @return CompletableFuture<ApiResponse<Void>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<Void>>, which completes exceptionally with
+ * an {@link ApiException} if the API call fails
*/
- public CompletableFuture> deleteLegalEntity(UUID legalEntityId)
- throws ApiException {
+ public CompletableFuture> deleteLegalEntity(UUID legalEntityId) {
try {
HttpRequest.Builder localVarRequestBuilder =
deleteLegalEntityRequestBuilder(legalEntityId);
@@ -762,7 +851,14 @@ public CompletableFuture> deleteLegalEntity(UUID legalEntityId
localVarResponse.statusCode(),
localVarResponse.headers().map(),
null));
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture.>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -796,11 +892,11 @@ private HttpRequest.Builder deleteLegalEntityRequestBuilder(UUID legalEntityId)
* Get address registry participation status for the authenticated workspace Returns whether the
* workspace is `OPTED_IN` or `OPTED_OUT` of the address registry.
*
- * @return CompletableFuture<ApiResponse<AddressRegistryTenantRegistryResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<AddressRegistryTenantRegistryResponse>>,
+ * which completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
- getAddressRegistryTenantParticipationStatus() throws ApiException {
+ getAddressRegistryTenantParticipationStatus() {
try {
HttpRequest.Builder localVarRequestBuilder =
getAddressRegistryTenantParticipationStatusRequestBuilder();
@@ -832,7 +928,18 @@ private HttpRequest.Builder deleteLegalEntityRequestBuilder(UUID legalEntityId)
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -865,11 +972,11 @@ private HttpRequest.Builder getAddressRegistryTenantParticipationStatusRequestBu
* removes one vault.
*
* @param vaultAccountId Vault account id (non-negative integer). (required)
- * @return CompletableFuture<ApiResponse<AddressRegistryGetVaultOptOutResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<AddressRegistryGetVaultOptOutResponse>>,
+ * which completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
- getAddressRegistryVaultOptOut(Integer vaultAccountId) throws ApiException {
+ getAddressRegistryVaultOptOut(Integer vaultAccountId) {
try {
HttpRequest.Builder localVarRequestBuilder =
getAddressRegistryVaultOptOutRequestBuilder(vaultAccountId);
@@ -901,7 +1008,18 @@ private HttpRequest.Builder getAddressRegistryTenantParticipationStatusRequestBu
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -935,11 +1053,10 @@ private HttpRequest.Builder getAddressRegistryVaultOptOutRequestBuilder(Integer
/**
* AML - View Post-Screening Policy Get the post-screening policy for AML.
*
- * @return CompletableFuture<ApiResponse<ScreeningPolicyResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ScreeningPolicyResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
- public CompletableFuture> getAmlPostScreeningPolicy()
- throws ApiException {
+ public CompletableFuture> getAmlPostScreeningPolicy() {
try {
HttpRequest.Builder localVarRequestBuilder = getAmlPostScreeningPolicyRequestBuilder();
return memberVarHttpClient
@@ -969,7 +1086,17 @@ public CompletableFuture> getAmlPostScreeni
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -998,11 +1125,11 @@ private HttpRequest.Builder getAmlPostScreeningPolicyRequestBuilder() throws Api
* AML - View Screening Policy Get the screening policy for AML.
*
* @return
- * CompletableFuture<ApiResponse<ScreeningProviderRulesConfigurationResponse>>
- * @throws ApiException if fails to make API call
+ * CompletableFuture<ApiResponse<ScreeningProviderRulesConfigurationResponse>>,
+ * which completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
- getAmlScreeningPolicy() throws ApiException {
+ getAmlScreeningPolicy() {
try {
HttpRequest.Builder localVarRequestBuilder = getAmlScreeningPolicyRequestBuilder();
return memberVarHttpClient
@@ -1033,7 +1160,18 @@ private HttpRequest.Builder getAmlPostScreeningPolicyRequestBuilder() throws Api
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -1063,11 +1201,10 @@ private HttpRequest.Builder getAmlScreeningPolicyRequestBuilder() throws ApiExce
* tenant (timeouts, active flag, allowed timeout ranges). Returns default config when none
* exists. Requires BYORK Light to be enabled for the tenant.
*
- * @return CompletableFuture<ApiResponse<ByorkConfigResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ByorkConfigResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
- public CompletableFuture> getByorkConfig()
- throws ApiException {
+ public CompletableFuture> getByorkConfig() {
try {
HttpRequest.Builder localVarRequestBuilder = getByorkConfigRequestBuilder();
return memberVarHttpClient
@@ -1096,7 +1233,15 @@ public CompletableFuture> getByorkConfig()
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -1128,11 +1273,10 @@ private HttpRequest.Builder getByorkConfigRequestBuilder() throws ApiException {
* BYORK verdict is found for the transaction.
*
* @param txId Transaction ID (required)
- * @return CompletableFuture<ApiResponse<GetByorkVerdictResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<GetByorkVerdictResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
- public CompletableFuture> getByorkVerdict(String txId)
- throws ApiException {
+ public CompletableFuture> getByorkVerdict(String txId) {
try {
HttpRequest.Builder localVarRequestBuilder = getByorkVerdictRequestBuilder(txId);
return memberVarHttpClient
@@ -1161,7 +1305,17 @@ public CompletableFuture> getByorkVerdict(S
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -1208,11 +1362,10 @@ private HttpRequest.Builder getByorkVerdictRequestBuilder(String txId) throws Ap
* Permissions:** Admin, Non-Signing Admin, Viewer.
*
* @param groupId The unique identifier of the counterparty group (required)
- * @return CompletableFuture<ApiResponse<CounterpartyGroup>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<CounterpartyGroup>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
- public CompletableFuture> getCounterpartyGroup(UUID groupId)
- throws ApiException {
+ public CompletableFuture> getCounterpartyGroup(UUID groupId) {
try {
HttpRequest.Builder localVarRequestBuilder =
getCounterpartyGroupRequestBuilder(groupId);
@@ -1243,7 +1396,15 @@ public CompletableFuture> getCounterpartyGroup(UU
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -1279,11 +1440,11 @@ private HttpRequest.Builder getCounterpartyGroupRequestBuilder(UUID groupId)
* Viewer.
*
* @param legalEntityId The unique ID of the legal entity registration (required)
- * @return CompletableFuture<ApiResponse<LegalEntityRegistration>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<LegalEntityRegistration>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> getLegalEntity(
- UUID legalEntityId) throws ApiException {
+ UUID legalEntityId) {
try {
HttpRequest.Builder localVarRequestBuilder =
getLegalEntityRequestBuilder(legalEntityId);
@@ -1313,7 +1474,17 @@ public CompletableFuture> getLegalEntity(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -1350,11 +1521,11 @@ private HttpRequest.Builder getLegalEntityRequestBuilder(UUID legalEntityId)
* required.
*
* @param address Blockchain address to look up (required)
- * @return CompletableFuture<ApiResponse<AddressRegistryLegalEntity>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<AddressRegistryLegalEntity>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> getLegalEntityForAddress(
- String address) throws ApiException {
+ String address) {
try {
HttpRequest.Builder localVarRequestBuilder =
getLegalEntityForAddressRequestBuilder(address);
@@ -1385,7 +1556,17 @@ public CompletableFuture> getLegalEntity
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -1418,11 +1599,10 @@ private HttpRequest.Builder getLegalEntityForAddressRequestBuilder(String addres
/**
* Travel Rule - View Post-Screening Policy Get the post-screening policy for Travel Rule.
*
- * @return CompletableFuture<ApiResponse<ScreeningPolicyResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ScreeningPolicyResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
- public CompletableFuture> getPostScreeningPolicy()
- throws ApiException {
+ public CompletableFuture> getPostScreeningPolicy() {
try {
HttpRequest.Builder localVarRequestBuilder = getPostScreeningPolicyRequestBuilder();
return memberVarHttpClient
@@ -1452,7 +1632,17 @@ public CompletableFuture> getPostScreeningP
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -1482,11 +1672,11 @@ private HttpRequest.Builder getPostScreeningPolicyRequestBuilder() throws ApiExc
* compliance details for the given screened transaction.
*
* @param txId Fireblocks transaction ID of the screened transaction (required)
- * @return CompletableFuture<ApiResponse<ComplianceResultFullPayload>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ComplianceResultFullPayload>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> getScreeningFullDetails(
- String txId) throws ApiException {
+ String txId) {
try {
HttpRequest.Builder localVarRequestBuilder =
getScreeningFullDetailsRequestBuilder(txId);
@@ -1517,7 +1707,17 @@ public CompletableFuture> getScreeningF
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -1550,11 +1750,11 @@ private HttpRequest.Builder getScreeningFullDetailsRequestBuilder(String txId)
* Travel Rule - View Screening Policy Get the screening policy for Travel Rule.
*
* @return
- * CompletableFuture<ApiResponse<ScreeningProviderRulesConfigurationResponse>>
- * @throws ApiException if fails to make API call
+ * CompletableFuture<ApiResponse<ScreeningProviderRulesConfigurationResponse>>,
+ * which completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
- getScreeningPolicy() throws ApiException {
+ getScreeningPolicy() {
try {
HttpRequest.Builder localVarRequestBuilder = getScreeningPolicyRequestBuilder();
return memberVarHttpClient
@@ -1585,7 +1785,18 @@ private HttpRequest.Builder getScreeningFullDetailsRequestBuilder(String txId)
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -1622,13 +1833,12 @@ private HttpRequest.Builder getScreeningPolicyRequestBuilder() throws ApiExcepti
* (optional, default to 50)
* @param order Sort direction by vault account id. Omit for ascending; use the enum value for
* descending. (optional, default to VAULT_OPT_OUT_LIST_ORDER_ASC)
- * @return CompletableFuture<ApiResponse<AddressRegistryListVaultOptOutsResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<AddressRegistryListVaultOptOutsResponse>>,
+ * which completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
listAddressRegistryVaultOptOuts(
- String pageCursor, Integer pageSize, AddressRegistryVaultListOrder order)
- throws ApiException {
+ String pageCursor, Integer pageSize, AddressRegistryVaultListOrder order) {
try {
HttpRequest.Builder localVarRequestBuilder =
listAddressRegistryVaultOptOutsRequestBuilder(pageCursor, pageSize, order);
@@ -1661,7 +1871,18 @@ private HttpRequest.Builder getScreeningPolicyRequestBuilder() throws ApiExcepti
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -1714,11 +1935,11 @@ private HttpRequest.Builder listAddressRegistryVaultOptOutsRequestBuilder(
*
* @param pageCursor Cursor of the required page (optional)
* @param pageSize Maximum number of items in the page (optional, default to 50)
- * @return CompletableFuture<ApiResponse<CounterpartyGroupsPaginatedResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<CounterpartyGroupsPaginatedResponse>>,
+ * which completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
- listCounterpartyGroups(String pageCursor, Integer pageSize) throws ApiException {
+ listCounterpartyGroups(String pageCursor, Integer pageSize) {
try {
HttpRequest.Builder localVarRequestBuilder =
listCounterpartyGroupsRequestBuilder(pageCursor, pageSize);
@@ -1749,7 +1970,18 @@ private HttpRequest.Builder listAddressRegistryVaultOptOutsRequestBuilder(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -1807,11 +2039,11 @@ private HttpRequest.Builder listCounterpartyGroupsRequestBuilder(
* previous response. Ignored when `vaultAccountId` is provided. (optional)
* @param pageSize Maximum number of registrations to return. Ignored when
* `vaultAccountId` is provided. (optional, default to 50)
- * @return CompletableFuture<ApiResponse<ListLegalEntitiesResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ListLegalEntitiesResponse>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> listLegalEntities(
- String vaultAccountId, String pageCursor, Integer pageSize) throws ApiException {
+ String vaultAccountId, String pageCursor, Integer pageSize) {
try {
HttpRequest.Builder localVarRequestBuilder =
listLegalEntitiesRequestBuilder(vaultAccountId, pageCursor, pageSize);
@@ -1841,7 +2073,17 @@ public CompletableFuture> listLegalEntiti
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -1896,12 +2138,11 @@ private HttpRequest.Builder listLegalEntitiesRequestBuilder(
* @param pageCursor Cursor string returned in `next` or `prev` of a
* previous response (optional)
* @param pageSize Maximum number of registrations to return (optional, default to 50)
- * @return CompletableFuture<ApiResponse<ListVaultsForRegistrationResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ListVaultsForRegistrationResponse>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
- listVaultsForLegalEntity(UUID legalEntityId, String pageCursor, Integer pageSize)
- throws ApiException {
+ listVaultsForLegalEntity(UUID legalEntityId, String pageCursor, Integer pageSize) {
try {
HttpRequest.Builder localVarRequestBuilder =
listVaultsForLegalEntityRequestBuilder(legalEntityId, pageCursor, pageSize);
@@ -1932,7 +2173,18 @@ private HttpRequest.Builder listLegalEntitiesRequestBuilder(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -1987,11 +2239,11 @@ private HttpRequest.Builder listVaultsForLegalEntityRequestBuilder(
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<AddressRegistryTenantRegistryResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<AddressRegistryTenantRegistryResponse>>,
+ * which completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
- optInAddressRegistryTenant(String idempotencyKey) throws ApiException {
+ optInAddressRegistryTenant(String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
optInAddressRegistryTenantRequestBuilder(idempotencyKey);
@@ -2023,7 +2275,18 @@ private HttpRequest.Builder listVaultsForLegalEntityRequestBuilder(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -2056,11 +2319,11 @@ private HttpRequest.Builder optInAddressRegistryTenantRequestBuilder(String idem
* Opt the workspace out of the address registry Opts the workspace out. No request body.
* Response uses the same JSON shape as GET; status is OPTED_OUT.
*
- * @return CompletableFuture<ApiResponse<AddressRegistryTenantRegistryResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<AddressRegistryTenantRegistryResponse>>,
+ * which completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
- optOutAddressRegistryTenant() throws ApiException {
+ optOutAddressRegistryTenant() {
try {
HttpRequest.Builder localVarRequestBuilder =
optOutAddressRegistryTenantRequestBuilder();
@@ -2092,7 +2355,18 @@ private HttpRequest.Builder optInAddressRegistryTenantRequestBuilder(String idem
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -2127,12 +2401,11 @@ private HttpRequest.Builder optOutAddressRegistryTenantRequestBuilder() throws A
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<LegalEntityRegistration>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<LegalEntityRegistration>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> registerLegalEntity(
- RegisterLegalEntityRequest registerLegalEntityRequest, String idempotencyKey)
- throws ApiException {
+ RegisterLegalEntityRequest registerLegalEntityRequest, String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
registerLegalEntityRequestBuilder(registerLegalEntityRequest, idempotencyKey);
@@ -2163,7 +2436,17 @@ public CompletableFuture> registerLegalEnti
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -2210,11 +2493,11 @@ private HttpRequest.Builder registerLegalEntityRequestBuilder(
* success). To clear the whole list, use `DELETE /v1/address_registry/vaults`.
*
* @param vaultAccountId Vault account id (non-negative integer). (required)
- * @return CompletableFuture<ApiResponse<AddressRegistryRemoveVaultOptOutResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<AddressRegistryRemoveVaultOptOutResponse>>,
+ * which completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
- removeAddressRegistryVaultOptOut(Integer vaultAccountId) throws ApiException {
+ removeAddressRegistryVaultOptOut(Integer vaultAccountId) {
try {
HttpRequest.Builder localVarRequestBuilder =
removeAddressRegistryVaultOptOutRequestBuilder(vaultAccountId);
@@ -2247,7 +2530,18 @@ private HttpRequest.Builder registerLegalEntityRequestBuilder(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -2283,11 +2577,11 @@ private HttpRequest.Builder removeAddressRegistryVaultOptOutRequestBuilder(
* from the workspace opt-out list.
*
* @return
- * CompletableFuture<ApiResponse<AddressRegistryRemoveAllVaultOptOutsResponse>>
- * @throws ApiException if fails to make API call
+ * CompletableFuture<ApiResponse<AddressRegistryRemoveAllVaultOptOutsResponse>>,
+ * which completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
- removeAllAddressRegistryVaultOptOuts() throws ApiException {
+ removeAllAddressRegistryVaultOptOuts() {
try {
HttpRequest.Builder localVarRequestBuilder =
removeAllAddressRegistryVaultOptOutsRequestBuilder();
@@ -2320,7 +2614,18 @@ private HttpRequest.Builder removeAddressRegistryVaultOptOutRequestBuilder(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -2357,14 +2662,13 @@ private HttpRequest.Builder removeAllAddressRegistryVaultOptOutsRequestBuilder()
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<RescreenTransactionResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<RescreenTransactionResponse>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> rescreenRejectedTransaction(
String txId,
RescreenTransactionRequest rescreenTransactionRequest,
- String idempotencyKey)
- throws ApiException {
+ String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
rescreenRejectedTransactionRequestBuilder(
@@ -2397,7 +2701,17 @@ public CompletableFuture> rescreenRejec
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -2449,12 +2763,11 @@ private HttpRequest.Builder rescreenRejectedTransactionRequestBuilder(
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<CreateTransactionResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<CreateTransactionResponse>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
- retryRejectedTransactionBypassScreeningChecks(String txId, String idempotencyKey)
- throws ApiException {
+ retryRejectedTransactionBypassScreeningChecks(String txId, String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
retryRejectedTransactionBypassScreeningChecksRequestBuilder(
@@ -2487,7 +2800,17 @@ private HttpRequest.Builder rescreenRejectedTransactionRequestBuilder(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -2530,12 +2853,11 @@ private HttpRequest.Builder retryRejectedTransactionBypassScreeningChecksRequest
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<AmlVerdictManualResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<AmlVerdictManualResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> setAmlVerdict(
- AmlVerdictManualRequest amlVerdictManualRequest, String idempotencyKey)
- throws ApiException {
+ AmlVerdictManualRequest amlVerdictManualRequest, String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
setAmlVerdictRequestBuilder(amlVerdictManualRequest, idempotencyKey);
@@ -2565,7 +2887,17 @@ public CompletableFuture> setAmlVerdict(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -2616,12 +2948,11 @@ private HttpRequest.Builder setAmlVerdictRequestBuilder(
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<ByorkConfigResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ByorkConfigResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> setByorkTimeouts(
- ByorkSetTimeoutsRequest byorkSetTimeoutsRequest, String idempotencyKey)
- throws ApiException {
+ ByorkSetTimeoutsRequest byorkSetTimeoutsRequest, String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
setByorkTimeoutsRequestBuilder(byorkSetTimeoutsRequest, idempotencyKey);
@@ -2651,7 +2982,15 @@ public CompletableFuture> setByorkTimeouts(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -2702,11 +3041,11 @@ private HttpRequest.Builder setByorkTimeoutsRequestBuilder(
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<ByorkVerdictResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ByorkVerdictResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> setByorkVerdict(
- ByorkVerdictRequest byorkVerdictRequest, String idempotencyKey) throws ApiException {
+ ByorkVerdictRequest byorkVerdictRequest, String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
setByorkVerdictRequestBuilder(byorkVerdictRequest, idempotencyKey);
@@ -2736,7 +3075,17 @@ public CompletableFuture> setByorkVerdict(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -2781,11 +3130,11 @@ private HttpRequest.Builder setByorkVerdictRequestBuilder(
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<ScreeningConfigurationsRequest>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ScreeningConfigurationsRequest>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
- updateAmlScreeningConfiguration(String idempotencyKey) throws ApiException {
+ updateAmlScreeningConfiguration(String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
updateAmlScreeningConfigurationRequestBuilder(idempotencyKey);
@@ -2817,7 +3166,17 @@ private HttpRequest.Builder setByorkVerdictRequestBuilder(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -2855,14 +3214,13 @@ private HttpRequest.Builder updateAmlScreeningConfigurationRequestBuilder(String
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<CounterpartyGroup>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<CounterpartyGroup>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> updateCounterpartyGroup(
UpdateCounterpartyGroupRequest updateCounterpartyGroupRequest,
UUID groupId,
- String idempotencyKey)
- throws ApiException {
+ String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
updateCounterpartyGroupRequestBuilder(
@@ -2894,7 +3252,15 @@ public CompletableFuture> updateCounterpartyGroup
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -2952,14 +3318,13 @@ private HttpRequest.Builder updateCounterpartyGroupRequestBuilder(
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<LegalEntityRegistration>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<LegalEntityRegistration>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> updateLegalEntity(
UpdateLegalEntityRequest updateLegalEntityRequest,
UUID legalEntityId,
- String idempotencyKey)
- throws ApiException {
+ String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
updateLegalEntityRequestBuilder(
@@ -2990,7 +3355,17 @@ public CompletableFuture> updateLegalEntity
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -3043,14 +3418,13 @@ private HttpRequest.Builder updateLegalEntityRequestBuilder(
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<ScreeningUpdateConfigurations>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ScreeningUpdateConfigurations>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
updateScreeningConfiguration(
ScreeningUpdateConfigurations screeningUpdateConfigurations,
- String idempotencyKey)
- throws ApiException {
+ String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
updateScreeningConfigurationRequestBuilder(
@@ -3083,7 +3457,17 @@ private HttpRequest.Builder updateLegalEntityRequestBuilder(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -3132,11 +3516,11 @@ private HttpRequest.Builder updateScreeningConfigurationRequestBuilder(
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<ScreeningConfigurationsRequest>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ScreeningConfigurationsRequest>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> updateTravelRuleConfig(
- String idempotencyKey) throws ApiException {
+ String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
updateTravelRuleConfigRequestBuilder(idempotencyKey);
@@ -3167,7 +3551,17 @@ public CompletableFuture> updateTrav
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
diff --git a/src/main/java/com/fireblocks/sdk/api/ComplianceScreeningConfigurationApi.java b/src/main/java/com/fireblocks/sdk/api/ComplianceScreeningConfigurationApi.java
index 528e896c..03653868 100644
--- a/src/main/java/com/fireblocks/sdk/api/ComplianceScreeningConfigurationApi.java
+++ b/src/main/java/com/fireblocks/sdk/api/ComplianceScreeningConfigurationApi.java
@@ -26,7 +26,10 @@
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
+import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
@jakarta.annotation.Generated(
@@ -62,6 +65,28 @@ private ApiException getApiException(String operationId, HttpResponse re
response.statusCode(), message, response.headers(), response.body());
}
+ /**
+ * Normalizes any failure raised while performing the call into the single failure type callers
+ * are told to expect. Transport-level errors surfaced by {@code HttpClient.sendAsync} -
+ * connection refused, DNS failures, TLS errors, timeouts - would otherwise reach the caller as
+ * a raw {@link java.io.IOException}, which makes the documented {@code (ApiException)
+ * e.getCause()} throw {@link ClassCastException}.
+ *
+ * {@link CancellationException} is passed through unchanged: a cancelled call is not an API
+ * failure.
+ */
+ private static Throwable toApiFailure(Throwable throwable) {
+ Throwable cause = throwable;
+ while ((cause instanceof CompletionException || cause instanceof ExecutionException)
+ && cause.getCause() != null) {
+ cause = cause.getCause();
+ }
+ if (cause instanceof ApiException || cause instanceof CancellationException) {
+ return cause;
+ }
+ return new ApiException(cause);
+ }
+
private String formatExceptionMessage(String operationId, int statusCode, String body) {
if (body == null || body.isEmpty()) {
body = "[no body]";
@@ -73,11 +98,11 @@ private String formatExceptionMessage(String operationId, int statusCode, String
* Get AML Screening Policy Configuration Retrieves the configuration for Travel Rule screening
* policy.
*
- * @return CompletableFuture<ApiResponse<ScreeningConfigurationsRequest>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ScreeningConfigurationsRequest>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
- getAmlScreeningConfiguration() throws ApiException {
+ getAmlScreeningConfiguration() {
try {
HttpRequest.Builder localVarRequestBuilder =
getAmlScreeningConfigurationRequestBuilder();
@@ -109,7 +134,17 @@ private String formatExceptionMessage(String operationId, int statusCode, String
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -138,11 +173,11 @@ private HttpRequest.Builder getAmlScreeningConfigurationRequestBuilder() throws
* Get Travel Rule Screening Policy Configuration Retrieves the configuration for Travel Rule
* screening policy.
*
- * @return CompletableFuture<ApiResponse<ScreeningConfigurationsRequest>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ScreeningConfigurationsRequest>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
- getScreeningConfiguration() throws ApiException {
+ getScreeningConfiguration() {
try {
HttpRequest.Builder localVarRequestBuilder = getScreeningConfigurationRequestBuilder();
return memberVarHttpClient
@@ -172,7 +207,17 @@ private HttpRequest.Builder getAmlScreeningConfigurationRequestBuilder() throws
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
diff --git a/src/main/java/com/fireblocks/sdk/api/ConnectedAccountsBetaApi.java b/src/main/java/com/fireblocks/sdk/api/ConnectedAccountsBetaApi.java
index b59bb90f..122010d9 100644
--- a/src/main/java/com/fireblocks/sdk/api/ConnectedAccountsBetaApi.java
+++ b/src/main/java/com/fireblocks/sdk/api/ConnectedAccountsBetaApi.java
@@ -43,7 +43,10 @@
import java.util.ArrayList;
import java.util.List;
import java.util.StringJoiner;
+import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
@jakarta.annotation.Generated(
@@ -79,6 +82,28 @@ private ApiException getApiException(String operationId, HttpResponse re
response.statusCode(), message, response.headers(), response.body());
}
+ /**
+ * Normalizes any failure raised while performing the call into the single failure type callers
+ * are told to expect. Transport-level errors surfaced by {@code HttpClient.sendAsync} -
+ * connection refused, DNS failures, TLS errors, timeouts - would otherwise reach the caller as
+ * a raw {@link java.io.IOException}, which makes the documented {@code (ApiException)
+ * e.getCause()} throw {@link ClassCastException}.
+ *
+ * {@link CancellationException} is passed through unchanged: a cancelled call is not an API
+ * failure.
+ */
+ private static Throwable toApiFailure(Throwable throwable) {
+ Throwable cause = throwable;
+ while ((cause instanceof CompletionException || cause instanceof ExecutionException)
+ && cause.getCause() != null) {
+ cause = cause.getCause();
+ }
+ if (cause instanceof ApiException || cause instanceof CancellationException) {
+ return cause;
+ }
+ return new ApiException(cause);
+ }
+
private String formatExceptionMessage(String operationId, int statusCode, String body) {
if (body == null || body.isEmpty()) {
body = "[no body]";
@@ -98,12 +123,11 @@ private String formatExceptionMessage(String operationId, int statusCode, String
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<AddConnectedAccountResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<AddConnectedAccountResponse>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> addConnectedAccount(
- AddConnectedAccountRequest addConnectedAccountRequest, String idempotencyKey)
- throws ApiException {
+ AddConnectedAccountRequest addConnectedAccountRequest, String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
addConnectedAccountRequestBuilder(addConnectedAccountRequest, idempotencyKey);
@@ -134,7 +158,17 @@ public CompletableFuture> addConnectedA
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -179,11 +213,10 @@ private HttpRequest.Builder addConnectedAccountRequestBuilder(
* is currently in beta and might be subject to changes.
*
* @param accountId The ID of the account to disconnect. (required)
- * @return CompletableFuture<ApiResponse<Void>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<Void>>, which completes exceptionally with
+ * an {@link ApiException} if the API call fails
*/
- public CompletableFuture> disconnectConnectedAccount(String accountId)
- throws ApiException {
+ public CompletableFuture> disconnectConnectedAccount(String accountId) {
try {
HttpRequest.Builder localVarRequestBuilder =
disconnectConnectedAccountRequestBuilder(accountId);
@@ -205,7 +238,14 @@ public CompletableFuture> disconnectConnectedAccount(String ac
localVarResponse.statusCode(),
localVarResponse.headers().map(),
null));
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture.>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -240,11 +280,11 @@ private HttpRequest.Builder disconnectConnectedAccountRequestBuilder(String acco
* **Note:** This endpoint is currently in beta and might be subject to changes.
*
* @param accountId The ID of the account to fetch. (required)
- * @return CompletableFuture<ApiResponse<ConnectedSingleAccountResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ConnectedSingleAccountResponse>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> getConnectedAccount(
- String accountId) throws ApiException {
+ String accountId) {
try {
HttpRequest.Builder localVarRequestBuilder =
getConnectedAccountRequestBuilder(accountId);
@@ -275,7 +315,17 @@ public CompletableFuture> getConnect
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -321,8 +371,8 @@ private HttpRequest.Builder getConnectedAccountRequestBuilder(String accountId)
* @param pageCursor Pagination cursor for next page (optional)
* @param pageSize Maximum number of entries to return (optional)
* @param order Sort order (ASC or DESC). (optional, default to DESC)
- * @return CompletableFuture<ApiResponse<AllowlistResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<AllowlistResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> getConnectedAccountAllowlist(
String accountId,
@@ -332,8 +382,7 @@ public CompletableFuture> getConnectedAccountAllo
String address,
String pageCursor,
Integer pageSize,
- String order)
- throws ApiException {
+ String order) {
try {
HttpRequest.Builder localVarRequestBuilder =
getConnectedAccountAllowlistRequestBuilder(
@@ -373,7 +422,15 @@ public CompletableFuture> getConnectedAccountAllo
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -447,11 +504,11 @@ private HttpRequest.Builder getConnectedAccountAllowlistRequestBuilder(
*
* @param accountId The connected account identifier (required)
* @param allowlistId The Fireblocks allowlist entry identifier (required)
- * @return CompletableFuture<ApiResponse<AllowlistEntryResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<AllowlistEntryResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> getConnectedAccountAllowlistEntry(
- String accountId, String allowlistId) throws ApiException {
+ String accountId, String allowlistId) {
try {
HttpRequest.Builder localVarRequestBuilder =
getConnectedAccountAllowlistEntryRequestBuilder(accountId, allowlistId);
@@ -483,7 +540,17 @@ public CompletableFuture> getConnectedAccoun
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -524,12 +591,11 @@ private HttpRequest.Builder getConnectedAccountAllowlistEntryRequestBuilder(
* @param accountId The ID of the account to fetch balances for. (required)
* @param pageSize Page size for pagination. (optional)
* @param pageCursor Page cursor for pagination. (optional)
- * @return CompletableFuture<ApiResponse<ConnectedAccountBalancesResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ConnectedAccountBalancesResponse>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
- getConnectedAccountBalances(String accountId, Integer pageSize, String pageCursor)
- throws ApiException {
+ getConnectedAccountBalances(String accountId, Integer pageSize, String pageCursor) {
try {
HttpRequest.Builder localVarRequestBuilder =
getConnectedAccountBalancesRequestBuilder(accountId, pageSize, pageCursor);
@@ -561,7 +627,17 @@ private HttpRequest.Builder getConnectedAccountAllowlistEntryRequestBuilder(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -617,11 +693,11 @@ private HttpRequest.Builder getConnectedAccountBalancesRequestBuilder(
* @param accountId The ID of the account to fetch rates for. (required)
* @param baseAssetId The ID of the asset to fetch rates for. (required)
* @param quoteAssetId The ID of the asset to get the rates nominally. (required)
- * @return CompletableFuture<ApiResponse<ConnectedAccountRateResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ConnectedAccountRateResponse>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> getConnectedAccountRates(
- String accountId, String baseAssetId, String quoteAssetId) throws ApiException {
+ String accountId, String baseAssetId, String quoteAssetId) {
try {
HttpRequest.Builder localVarRequestBuilder =
getConnectedAccountRatesRequestBuilder(accountId, baseAssetId, quoteAssetId);
@@ -652,7 +728,17 @@ public CompletableFuture> getConnected
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -713,12 +799,11 @@ private HttpRequest.Builder getConnectedAccountRatesRequestBuilder(
* @param accountId The ID of the account to fetch supported pairs for. (required)
* @param pageSize Page size for pagination. (optional, default to 100)
* @param pageCursor Page cursor for pagination. (optional)
- * @return CompletableFuture<ApiResponse<ConnectedAccountTradingPairsResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ConnectedAccountTradingPairsResponse>>,
+ * which completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
- getConnectedAccountTradingPairs(String accountId, Integer pageSize, String pageCursor)
- throws ApiException {
+ getConnectedAccountTradingPairs(String accountId, Integer pageSize, String pageCursor) {
try {
HttpRequest.Builder localVarRequestBuilder =
getConnectedAccountTradingPairsRequestBuilder(accountId, pageSize, pageCursor);
@@ -750,7 +835,18 @@ private HttpRequest.Builder getConnectedAccountRatesRequestBuilder(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -806,11 +902,11 @@ private HttpRequest.Builder getConnectedAccountTradingPairsRequestBuilder(
* to false)
* @param pageSize Page size for pagination. (optional)
* @param pageCursor Page cursor for pagination. (optional)
- * @return CompletableFuture<ApiResponse<ConnectedAccountsResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<ConnectedAccountsResponse>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> getConnectedAccounts(
- Boolean mainAccounts, Integer pageSize, String pageCursor) throws ApiException {
+ Boolean mainAccounts, Integer pageSize, String pageCursor) {
try {
HttpRequest.Builder localVarRequestBuilder =
getConnectedAccountsRequestBuilder(mainAccounts, pageSize, pageCursor);
@@ -841,7 +937,17 @@ public CompletableFuture> getConnectedAcc
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -895,11 +1001,11 @@ private HttpRequest.Builder getConnectedAccountsRequestBuilder(
* changes.
*
* @return
- * CompletableFuture<ApiResponse<GetConnectedAccountsCredentialsPublicKeyResponse>>
- * @throws ApiException if fails to make API call
+ * CompletableFuture<ApiResponse<GetConnectedAccountsCredentialsPublicKeyResponse>>,
+ * which completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture>
- getConnectedAccountsCredentialsPublicKey() throws ApiException {
+ getConnectedAccountsCredentialsPublicKey() {
try {
HttpRequest.Builder localVarRequestBuilder =
getConnectedAccountsCredentialsPublicKeyRequestBuilder();
@@ -932,7 +1038,18 @@ private HttpRequest.Builder getConnectedAccountsRequestBuilder(
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -967,14 +1084,13 @@ private HttpRequest.Builder getConnectedAccountsCredentialsPublicKeyRequestBuild
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<RenameConnectedAccountResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<RenameConnectedAccountResponse>>, which
+ * completes exceptionally with an {@link ApiException} if the API call fails
*/
public CompletableFuture> renameConnectedAccount(
RenameConnectedAccountRequest renameConnectedAccountRequest,
String accountId,
- String idempotencyKey)
- throws ApiException {
+ String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
renameConnectedAccountRequestBuilder(
@@ -1006,7 +1122,17 @@ public CompletableFuture> renameConn
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture
+ .>
+ failedFuture(
+ toApiFailure(
+ localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -1064,11 +1190,11 @@ private HttpRequest.Builder renameConnectedAccountRequestBuilder(
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<Void>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<Void>>, which completes exceptionally with
+ * an {@link ApiException} if the API call fails
*/
public CompletableFuture> syncConnectedAccountAllowlist(
- String accountId, String idempotencyKey) throws ApiException {
+ String accountId, String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
syncConnectedAccountAllowlistRequestBuilder(accountId, idempotencyKey);
@@ -1090,7 +1216,14 @@ public CompletableFuture> syncConnectedAccountAllowlist(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
null));
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture.>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
diff --git a/src/main/java/com/fireblocks/sdk/api/ConsoleUserApi.java b/src/main/java/com/fireblocks/sdk/api/ConsoleUserApi.java
index 28e5bb3f..45e0918d 100644
--- a/src/main/java/com/fireblocks/sdk/api/ConsoleUserApi.java
+++ b/src/main/java/com/fireblocks/sdk/api/ConsoleUserApi.java
@@ -27,7 +27,10 @@
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
+import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
@jakarta.annotation.Generated(
@@ -63,6 +66,28 @@ private ApiException getApiException(String operationId, HttpResponse re
response.statusCode(), message, response.headers(), response.body());
}
+ /**
+ * Normalizes any failure raised while performing the call into the single failure type callers
+ * are told to expect. Transport-level errors surfaced by {@code HttpClient.sendAsync} -
+ * connection refused, DNS failures, TLS errors, timeouts - would otherwise reach the caller as
+ * a raw {@link java.io.IOException}, which makes the documented {@code (ApiException)
+ * e.getCause()} throw {@link ClassCastException}.
+ *
+ * {@link CancellationException} is passed through unchanged: a cancelled call is not an API
+ * failure.
+ */
+ private static Throwable toApiFailure(Throwable throwable) {
+ Throwable cause = throwable;
+ while ((cause instanceof CompletionException || cause instanceof ExecutionException)
+ && cause.getCause() != null) {
+ cause = cause.getCause();
+ }
+ if (cause instanceof ApiException || cause instanceof CancellationException) {
+ return cause;
+ }
+ return new ApiException(cause);
+ }
+
private String formatExceptionMessage(String operationId, int statusCode, String body) {
if (body == null || body.isEmpty()) {
body = "[no body]";
@@ -81,11 +106,11 @@ private String formatExceptionMessage(String operationId, int statusCode, String
* @param idempotencyKey A unique identifier for the request. If the request is sent multiple
* times with the same idempotency key, the server will return the same response as the
* first request. The idempotency key is valid for 24 hours. (optional)
- * @return CompletableFuture<ApiResponse<Void>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<Void>>, which completes exceptionally with
+ * an {@link ApiException} if the API call fails
*/
public CompletableFuture> createConsoleUser(
- CreateConsoleUser createConsoleUser, String idempotencyKey) throws ApiException {
+ CreateConsoleUser createConsoleUser, String idempotencyKey) {
try {
HttpRequest.Builder localVarRequestBuilder =
createConsoleUserRequestBuilder(createConsoleUser, idempotencyKey);
@@ -105,7 +130,14 @@ public CompletableFuture> createConsoleUser(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
null));
- });
+ })
+ .handle(
+ (localVarApiResponse, localVarThrowable) ->
+ localVarThrowable == null
+ ? CompletableFuture.completedFuture(localVarApiResponse)
+ : CompletableFuture.>failedFuture(
+ toApiFailure(localVarThrowable)))
+ .thenCompose(localVarNormalized -> localVarNormalized);
} catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
@@ -146,11 +178,10 @@ private HttpRequest.Builder createConsoleUserRequestBuilder(
* available only for API keys with Admin/Non Signing Admin permissions. Endpoint Permission:
* Admin, Non-Signing Admin.
*
- * @return CompletableFuture<ApiResponse<GetConsoleUsersResponse>>
- * @throws ApiException if fails to make API call
+ * @return CompletableFuture<ApiResponse<GetConsoleUsersResponse>>, which completes
+ * exceptionally with an {@link ApiException} if the API call fails
*/
- public CompletableFuture> getConsoleUsers()
- throws ApiException {
+ public CompletableFuture