Skip to content

Commit

Permalink
Merge pull request #1 from fireblocks/fireblocks-api-spec/generated/9729
Browse files Browse the repository at this point in the history
Added Idempotency & NCW headers support #6
  • Loading branch information
SCFireblocks authored Nov 8, 2023
2 parents 59c4921 + 9c67da0 commit dd6bca4
Show file tree
Hide file tree
Showing 31 changed files with 2,472 additions and 457 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Fireblocks Java SDK (Beta)

[//]: # ([![Maven version](https://badge.fury.io/java/fireblocks.svg)](https://badge.fury.io/java/fireblocks))
<!--[![Maven version](https://badge.fury.io/java/fireblocks.svg)](https://badge.fury.io/java/fireblocks)-->
> **Warning**
> This package is currently in a beta stage and should be used at your own risk.
> The provided interfaces might go through backwards-incompatibale changes.

For detailed API documentation please refer to the [Fireblocks API Reference](https://developers.fireblocks.com/reference/).

Building the API client library requires:
Expand Down Expand Up @@ -421,6 +419,7 @@ Class | Method | HTTP request | Description
- [InstructionAmount](docs/InstructionAmount.md)
- [ListOwnedCollections200Response](docs/ListOwnedCollections200Response.md)
- [MediaEntityResponse](docs/MediaEntityResponse.md)
- [Ncw](docs/Ncw.md)
- [NetworkChannel](docs/NetworkChannel.md)
- [NetworkConnection](docs/NetworkConnection.md)
- [NetworkConnectionResponse](docs/NetworkConnectionResponse.md)
Expand Down Expand Up @@ -486,6 +485,7 @@ Class | Method | HTTP request | Description
- [PublishResult](docs/PublishResult.md)
- [RedeemFundsToLinkedDDARequest](docs/RedeemFundsToLinkedDDARequest.md)
- [RemoveCollateralRequestBody](docs/RemoveCollateralRequestBody.md)
- [RequestOptions](docs/RequestOptions.md)
- [ResendWebhooksForTransactionRequest](docs/ResendWebhooksForTransactionRequest.md)
- [ResendWebhooksResponse](docs/ResendWebhooksResponse.md)
- [RespondToConnectionRequest](docs/RespondToConnectionRequest.md)
Expand Down
13 changes: 13 additions & 0 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3829,6 +3829,7 @@ paths:
summary: Create a new transaction
tags:
- Transactions
x-ncw-supported: true
x-readme:
code-samples:
- language: python
Expand Down Expand Up @@ -12579,6 +12580,18 @@ components:
- index
- status
type: object
RequestOptions:
properties:
idempotencyKey:
type: string
ncw:
$ref: '#/components/schemas/Ncw'
type: object
Ncw:
properties:
walletId:
type: string
type: object
PolicyRuleError:
description: Rule validation result error
example:
Expand Down
13 changes: 13 additions & 0 deletions docs/Ncw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@


# Ncw


## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**walletId** | **String** | | [optional] |



14 changes: 14 additions & 0 deletions docs/RequestOptions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@


# RequestOptions


## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**idempotencyKey** | **String** | | [optional] |
|**ncw** | [**Ncw**](Ncw.md) | | [optional] |



5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
This SDK empowers developers to build robust applications that can interact with the Fireblocks platform's features, including creating and managing vault accounts, initiating secure transactions, managing assets, and more. It abstracts complex interactions with the Fireblocks API, making it easier for developers to leverage the platform's capabilities while adhering to best practices in security and efficiency.

Whether you're working on a cryptocurrency exchange, wallet application, or any other financial platform involving digital assets, the Fireblocks Official SDK simplifies the integration process and allows you to harness the power of Fireblocks' secure infrastructure. Stay ahead in the world of digital assets with this powerful SDK at your fingertips.</description>

<distributionManagement>


<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
Expand Down
23 changes: 18 additions & 5 deletions src/main/java/com/fireblocks/sdk/AuditLogsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import com.fireblocks.sdk.ApiClient;
import com.fireblocks.sdk.ApiResponse;
import com.fireblocks.sdk.Configuration;
import com.fireblocks.sdk.model.Ncw;
import com.fireblocks.sdk.model.RequestOptions;
import com.fireblocks.sdk.Pair;

import java.util.Optional;
import javax.ws.rs.core.GenericType;

import java.util.UUID;
import com.fireblocks.sdk.model.Error;

import java.util.ArrayList;
Expand Down Expand Up @@ -40,8 +42,12 @@ public AuditLogsApi(Configuration config) {
<tr><td> 0 </td><td> Error Response </td><td> * X-Request-ID - <br> </td></tr>
</table>
*/
public void getAudits(String timePeriod, RequestOptions requestOptions) throws ApiException {
getAuditsWithHttpInfo(timePeriod, requestOptions);
}

public void getAudits(String timePeriod) throws ApiException {
getAuditsWithHttpInfo(timePeriod);
getAuditsWithHttpInfo(timePeriod, null);
}

/**
Expand All @@ -57,7 +63,7 @@ public void getAudits(String timePeriod) throws ApiException {
<tr><td> 0 </td><td> Error Response </td><td> * X-Request-ID - <br> </td></tr>
</table>
*/
public ApiResponse<Void> getAuditsWithHttpInfo(String timePeriod) throws ApiException {
public ApiResponse<Void> getAuditsWithHttpInfo(String timePeriod, RequestOptions requestOptions) throws ApiException {
// Check required parameters
if (timePeriod == null) {
throw new ApiException(400, "Missing the required parameter 'timePeriod' when calling getAudits");
Expand All @@ -68,10 +74,17 @@ public ApiResponse<Void> getAuditsWithHttpInfo(String timePeriod) throws ApiExce
apiClient.parameterToPairs("", "timePeriod", timePeriod)
);

Map<String, String> localVarHeaderParams = new LinkedHashMap<>();
// Extract and set Idempotency-Key header
Optional.ofNullable(requestOptions.getIdempotencyKey()).map(Object::toString).ifPresent(idempotencyKey -> localVarHeaderParams.put("Idempotency-Key", idempotencyKey));

// Extract and set X-End-User-Wallet-Id header
Optional.ofNullable(requestOptions.getNcw()).map(ncw -> ncw.getWalletId()).map(Object::toString).ifPresent(ncwWalletId -> localVarHeaderParams.put("X-End-User-Wallet-Id", ncwWalletId));

String localVarAccept = apiClient.selectHeaderAccept("application/json");
String localVarContentType = apiClient.selectHeaderContentType();
return apiClient.invokeAPI("AuditLogsApi.getAudits", "/audits", "GET", localVarQueryParams, null,
new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType,
localVarHeaderParams, new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType,
null, null, false);
}
}
23 changes: 18 additions & 5 deletions src/main/java/com/fireblocks/sdk/BlockchainsAssetsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import com.fireblocks.sdk.ApiClient;
import com.fireblocks.sdk.ApiResponse;
import com.fireblocks.sdk.Configuration;
import com.fireblocks.sdk.model.Ncw;
import com.fireblocks.sdk.model.RequestOptions;
import com.fireblocks.sdk.Pair;

import java.util.Optional;
import javax.ws.rs.core.GenericType;

import java.util.UUID;
import com.fireblocks.sdk.model.AssetTypeResponse;
import com.fireblocks.sdk.model.Error;

Expand Down Expand Up @@ -41,8 +43,12 @@ public BlockchainsAssetsApi(Configuration config) {
<tr><td> 0 </td><td> Error Response </td><td> * X-Request-ID - <br> </td></tr>
</table>
*/
public List<AssetTypeResponse> getSupportedAssets( RequestOptions requestOptions) throws ApiException {
return getSupportedAssetsWithHttpInfo( requestOptions).getData();
}

public List<AssetTypeResponse> getSupportedAssets() throws ApiException {
return getSupportedAssetsWithHttpInfo().getData();
return getSupportedAssetsWithHttpInfo( null).getData();
}

/**
Expand All @@ -57,12 +63,19 @@ public List<AssetTypeResponse> getSupportedAssets() throws ApiException {
<tr><td> 0 </td><td> Error Response </td><td> * X-Request-ID - <br> </td></tr>
</table>
*/
public ApiResponse<List<AssetTypeResponse>> getSupportedAssetsWithHttpInfo() throws ApiException {
public ApiResponse<List<AssetTypeResponse>> getSupportedAssetsWithHttpInfo( RequestOptions requestOptions) throws ApiException {
Map<String, String> localVarHeaderParams = new LinkedHashMap<>();
// Extract and set Idempotency-Key header
Optional.ofNullable(requestOptions.getIdempotencyKey()).map(Object::toString).ifPresent(idempotencyKey -> localVarHeaderParams.put("Idempotency-Key", idempotencyKey));

// Extract and set X-End-User-Wallet-Id header
Optional.ofNullable(requestOptions.getNcw()).map(ncw -> ncw.getWalletId()).map(Object::toString).ifPresent(ncwWalletId -> localVarHeaderParams.put("X-End-User-Wallet-Id", ncwWalletId));

String localVarAccept = apiClient.selectHeaderAccept("*/*", "application/json");
String localVarContentType = apiClient.selectHeaderContentType();
GenericType<List<AssetTypeResponse>> localVarReturnType = new GenericType<List<AssetTypeResponse>>() {};
return apiClient.invokeAPI("BlockchainsAssetsApi.getSupportedAssets", "/supported_assets", "GET", new ArrayList<>(), null,
new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType,
localVarHeaderParams, new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType,
null, localVarReturnType, false);
}
}
Loading

0 comments on commit dd6bca4

Please sign in to comment.