Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated SDK #7984 #62

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ src/main/java/com/fireblocks/sdk/ServerConfiguration.java
src/main/java/com/fireblocks/sdk/ServerVariable.java
src/main/java/com/fireblocks/sdk/SystemWrapper.java
src/main/java/com/fireblocks/sdk/UserAgentUtil.java
src/main/java/com/fireblocks/sdk/ValidationUtils.java
src/main/java/com/fireblocks/sdk/api/ApiUserApi.java
src/main/java/com/fireblocks/sdk/api/AssetsApi.java
src/main/java/com/fireblocks/sdk/api/AuditLogsApi.java
Expand Down Expand Up @@ -986,6 +987,7 @@ src/test/java/com/fireblocks/sdk/ConfigurationOptionsTest.java
src/test/java/com/fireblocks/sdk/DummyTestKey.txt
src/test/java/com/fireblocks/sdk/FireblocksTest.java
src/test/java/com/fireblocks/sdk/UserAgentUtilTest.java
src/test/java/com/fireblocks/sdk/ValidationUtilsTest.java
src/test/java/com/fireblocks/sdk/api/ApiUserApiTest.java
src/test/java/com/fireblocks/sdk/api/AssetsApiTest.java
src/test/java/com/fireblocks/sdk/api/AuditLogsApiTest.java
Expand Down
39 changes: 39 additions & 0 deletions src/main/java/com/fireblocks/sdk/ValidationUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Fireblocks API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.6.2
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

package com.fireblocks.sdk;

public class ValidationUtils {

public static void assertParamExistsAndNotEmpty(
String functionName, String paramName, String paramValue) throws ApiException {
ValidationUtils.assertParamExists(functionName, paramName, paramValue);
if (paramValue.isEmpty()) {
throw new ApiException(
400,
String.format(
"The required parameter '%s' was empty when calling '%s'",
paramName, functionName));
}
}

public static void assertParamExists(String functionName, String paramName, Object paramValue)
throws ApiException {
if (paramValue == null) {
throw new ApiException(
400,
String.format(
"The required parameter '%s' is missing from call to '%s'",
paramName, functionName));
}
}
}
10 changes: 3 additions & 7 deletions src/main/java/com/fireblocks/sdk/api/AssetsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.fireblocks.sdk.ApiClient;
import com.fireblocks.sdk.ApiException;
import com.fireblocks.sdk.ApiResponse;
import com.fireblocks.sdk.ValidationUtils;
import com.fireblocks.sdk.model.CreateAssetsBulkRequest;
import com.fireblocks.sdk.model.JobCreated;
import java.io.IOException;
Expand Down Expand Up @@ -122,13 +123,8 @@ public CompletableFuture<ApiResponse<JobCreated>> createAssetsBulk(
private HttpRequest.Builder createAssetsBulkRequestBuilder(
CreateAssetsBulkRequest createAssetsBulkRequest, String idempotencyKey)
throws ApiException {
// verify the required parameter 'createAssetsBulkRequest' is set
if (createAssetsBulkRequest == null) {
throw new ApiException(
400,
"Missing the required parameter 'createAssetsBulkRequest' when calling"
+ " createAssetsBulk");
}
ValidationUtils.assertParamExists(
"createAssetsBulk", "createAssetsBulkRequest", createAssetsBulkRequest);

HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

Expand Down
65 changes: 14 additions & 51 deletions src/main/java/com/fireblocks/sdk/api/ContractInteractionsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.fireblocks.sdk.ApiClient;
import com.fireblocks.sdk.ApiException;
import com.fireblocks.sdk.ApiResponse;
import com.fireblocks.sdk.ValidationUtils;
import com.fireblocks.sdk.model.ContractAbiResponseDto;
import com.fireblocks.sdk.model.ParameterWithValue;
import com.fireblocks.sdk.model.ReadCallFunctionDto;
Expand Down Expand Up @@ -124,19 +125,9 @@ public CompletableFuture<ApiResponse<ContractAbiResponseDto>> getDeployedContrac

private HttpRequest.Builder getDeployedContractAbiRequestBuilder(
String contractAddress, String assetId, String idempotencyKey) throws ApiException {
// verify the required parameter 'contractAddress' is set
if (contractAddress == null) {
throw new ApiException(
400,
"Missing the required parameter 'contractAddress' when calling"
+ " getDeployedContractAbi");
}
// verify the required parameter 'assetId' is set
if (assetId == null) {
throw new ApiException(
400,
"Missing the required parameter 'assetId' when calling getDeployedContractAbi");
}
ValidationUtils.assertParamExistsAndNotEmpty(
"getDeployedContractAbi", "contractAddress", contractAddress);
ValidationUtils.assertParamExistsAndNotEmpty("getDeployedContractAbi", "assetId", assetId);

HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

Expand Down Expand Up @@ -225,25 +216,11 @@ private HttpRequest.Builder readCallFunctionRequestBuilder(
String assetId,
String idempotencyKey)
throws ApiException {
// verify the required parameter 'readCallFunctionDto' is set
if (readCallFunctionDto == null) {
throw new ApiException(
400,
"Missing the required parameter 'readCallFunctionDto' when calling"
+ " readCallFunction");
}
// verify the required parameter 'contractAddress' is set
if (contractAddress == null) {
throw new ApiException(
400,
"Missing the required parameter 'contractAddress' when calling"
+ " readCallFunction");
}
// verify the required parameter 'assetId' is set
if (assetId == null) {
throw new ApiException(
400, "Missing the required parameter 'assetId' when calling readCallFunction");
}
ValidationUtils.assertParamExists(
"readCallFunction", "readCallFunctionDto", readCallFunctionDto);
ValidationUtils.assertParamExistsAndNotEmpty(
"readCallFunction", "contractAddress", contractAddress);
ValidationUtils.assertParamExistsAndNotEmpty("readCallFunction", "assetId", assetId);

HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

Expand Down Expand Up @@ -339,25 +316,11 @@ private HttpRequest.Builder writeCallFunctionRequestBuilder(
String assetId,
String idempotencyKey)
throws ApiException {
// verify the required parameter 'writeCallFunctionDto' is set
if (writeCallFunctionDto == null) {
throw new ApiException(
400,
"Missing the required parameter 'writeCallFunctionDto' when calling"
+ " writeCallFunction");
}
// verify the required parameter 'contractAddress' is set
if (contractAddress == null) {
throw new ApiException(
400,
"Missing the required parameter 'contractAddress' when calling"
+ " writeCallFunction");
}
// verify the required parameter 'assetId' is set
if (assetId == null) {
throw new ApiException(
400, "Missing the required parameter 'assetId' when calling writeCallFunction");
}
ValidationUtils.assertParamExists(
"writeCallFunction", "writeCallFunctionDto", writeCallFunctionDto);
ValidationUtils.assertParamExistsAndNotEmpty(
"writeCallFunction", "contractAddress", contractAddress);
ValidationUtils.assertParamExistsAndNotEmpty("writeCallFunction", "assetId", assetId);

HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

Expand Down
73 changes: 17 additions & 56 deletions src/main/java/com/fireblocks/sdk/api/ContractTemplatesApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.fireblocks.sdk.ApiException;
import com.fireblocks.sdk.ApiResponse;
import com.fireblocks.sdk.Pair;
import com.fireblocks.sdk.ValidationUtils;
import com.fireblocks.sdk.model.AbiFunction;
import com.fireblocks.sdk.model.ContractDeployRequest;
import com.fireblocks.sdk.model.ContractDeployResponse;
Expand Down Expand Up @@ -116,13 +117,8 @@ public CompletableFuture<ApiResponse<Void>> deleteContractTemplateById(

private HttpRequest.Builder deleteContractTemplateByIdRequestBuilder(String contractTemplateId)
throws ApiException {
// verify the required parameter 'contractTemplateId' is set
if (contractTemplateId == null) {
throw new ApiException(
400,
"Missing the required parameter 'contractTemplateId' when calling"
+ " deleteContractTemplateById");
}
ValidationUtils.assertParamExistsAndNotEmpty(
"deleteContractTemplateById", "contractTemplateId", contractTemplateId);

HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

Expand Down Expand Up @@ -203,20 +199,10 @@ private HttpRequest.Builder deployContractRequestBuilder(
String contractTemplateId,
String idempotencyKey)
throws ApiException {
// verify the required parameter 'contractDeployRequest' is set
if (contractDeployRequest == null) {
throw new ApiException(
400,
"Missing the required parameter 'contractDeployRequest' when calling"
+ " deployContract");
}
// verify the required parameter 'contractTemplateId' is set
if (contractTemplateId == null) {
throw new ApiException(
400,
"Missing the required parameter 'contractTemplateId' when calling"
+ " deployContract");
}
ValidationUtils.assertParamExists(
"deployContract", "contractDeployRequest", contractDeployRequest);
ValidationUtils.assertParamExistsAndNotEmpty(
"deployContract", "contractTemplateId", contractTemplateId);

HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

Expand Down Expand Up @@ -299,13 +285,8 @@ public CompletableFuture<ApiResponse<AbiFunction>> getConstructorByContractTempl

private HttpRequest.Builder getConstructorByContractTemplateIdRequestBuilder(
String contractTemplateId, Boolean withDocs) throws ApiException {
// verify the required parameter 'contractTemplateId' is set
if (contractTemplateId == null) {
throw new ApiException(
400,
"Missing the required parameter 'contractTemplateId' when calling"
+ " getConstructorByContractTemplateId");
}
ValidationUtils.assertParamExistsAndNotEmpty(
"getConstructorByContractTemplateId", "contractTemplateId", contractTemplateId);

HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

Expand Down Expand Up @@ -391,13 +372,8 @@ public CompletableFuture<ApiResponse<ContractTemplateDto>> getContractTemplateBy

private HttpRequest.Builder getContractTemplateByIdRequestBuilder(String contractTemplateId)
throws ApiException {
// verify the required parameter 'contractTemplateId' is set
if (contractTemplateId == null) {
throw new ApiException(
400,
"Missing the required parameter 'contractTemplateId' when calling"
+ " getContractTemplateById");
}
ValidationUtils.assertParamExistsAndNotEmpty(
"getContractTemplateById", "contractTemplateId", contractTemplateId);

HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

Expand Down Expand Up @@ -584,20 +560,10 @@ public CompletableFuture<ApiResponse<AbiFunction>> getFunctionAbiByContractTempl

private HttpRequest.Builder getFunctionAbiByContractTemplateIdRequestBuilder(
String contractTemplateId, String functionSignature) throws ApiException {
// verify the required parameter 'contractTemplateId' is set
if (contractTemplateId == null) {
throw new ApiException(
400,
"Missing the required parameter 'contractTemplateId' when calling"
+ " getFunctionAbiByContractTemplateId");
}
// verify the required parameter 'functionSignature' is set
if (functionSignature == null) {
throw new ApiException(
400,
"Missing the required parameter 'functionSignature' when calling"
+ " getFunctionAbiByContractTemplateId");
}
ValidationUtils.assertParamExistsAndNotEmpty(
"getFunctionAbiByContractTemplateId", "contractTemplateId", contractTemplateId);
ValidationUtils.assertParamExistsAndNotEmpty(
"getFunctionAbiByContractTemplateId", "functionSignature", functionSignature);

HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

Expand Down Expand Up @@ -690,13 +656,8 @@ public CompletableFuture<ApiResponse<ContractTemplateDto>> uploadContractTemplat
private HttpRequest.Builder uploadContractTemplateRequestBuilder(
ContractUploadRequest contractUploadRequest, String idempotencyKey)
throws ApiException {
// verify the required parameter 'contractUploadRequest' is set
if (contractUploadRequest == null) {
throw new ApiException(
400,
"Missing the required parameter 'contractUploadRequest' when calling"
+ " uploadContractTemplate");
}
ValidationUtils.assertParamExists(
"uploadContractTemplate", "contractUploadRequest", contractUploadRequest);

HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

Expand Down
54 changes: 10 additions & 44 deletions src/main/java/com/fireblocks/sdk/api/ContractsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.fireblocks.sdk.ApiClient;
import com.fireblocks.sdk.ApiException;
import com.fireblocks.sdk.ApiResponse;
import com.fireblocks.sdk.ValidationUtils;
import com.fireblocks.sdk.model.AddContractAssetRequest;
import com.fireblocks.sdk.model.CreateContractRequest;
import com.fireblocks.sdk.model.ExternalWalletAsset;
Expand Down Expand Up @@ -131,17 +132,8 @@ private HttpRequest.Builder addContractAssetRequestBuilder(
AddContractAssetRequest addContractAssetRequest,
String idempotencyKey)
throws ApiException {
// verify the required parameter 'contractId' is set
if (contractId == null) {
throw new ApiException(
400,
"Missing the required parameter 'contractId' when calling addContractAsset");
}
// verify the required parameter 'assetId' is set
if (assetId == null) {
throw new ApiException(
400, "Missing the required parameter 'assetId' when calling addContractAsset");
}
ValidationUtils.assertParamExistsAndNotEmpty("addContractAsset", "contractId", contractId);
ValidationUtils.assertParamExistsAndNotEmpty("addContractAsset", "assetId", assetId);

HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

Expand Down Expand Up @@ -289,11 +281,7 @@ public CompletableFuture<ApiResponse<Void>> deleteContract(String contractId)

private HttpRequest.Builder deleteContractRequestBuilder(String contractId)
throws ApiException {
// verify the required parameter 'contractId' is set
if (contractId == null) {
throw new ApiException(
400, "Missing the required parameter 'contractId' when calling deleteContract");
}
ValidationUtils.assertParamExistsAndNotEmpty("deleteContract", "contractId", contractId);

HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

Expand Down Expand Up @@ -352,18 +340,9 @@ public CompletableFuture<ApiResponse<Void>> deleteContractAsset(

private HttpRequest.Builder deleteContractAssetRequestBuilder(String contractId, String assetId)
throws ApiException {
// verify the required parameter 'contractId' is set
if (contractId == null) {
throw new ApiException(
400,
"Missing the required parameter 'contractId' when calling deleteContractAsset");
}
// verify the required parameter 'assetId' is set
if (assetId == null) {
throw new ApiException(
400,
"Missing the required parameter 'assetId' when calling deleteContractAsset");
}
ValidationUtils.assertParamExistsAndNotEmpty(
"deleteContractAsset", "contractId", contractId);
ValidationUtils.assertParamExistsAndNotEmpty("deleteContractAsset", "assetId", assetId);

HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

Expand Down Expand Up @@ -429,11 +408,7 @@ public CompletableFuture<ApiResponse<UnmanagedWallet>> getContract(String contra
}

private HttpRequest.Builder getContractRequestBuilder(String contractId) throws ApiException {
// verify the required parameter 'contractId' is set
if (contractId == null) {
throw new ApiException(
400, "Missing the required parameter 'contractId' when calling getContract");
}
ValidationUtils.assertParamExistsAndNotEmpty("getContract", "contractId", contractId);

HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

Expand Down Expand Up @@ -501,17 +476,8 @@ public CompletableFuture<ApiResponse<ExternalWalletAsset>> getContractAsset(

private HttpRequest.Builder getContractAssetRequestBuilder(String contractId, String assetId)
throws ApiException {
// verify the required parameter 'contractId' is set
if (contractId == null) {
throw new ApiException(
400,
"Missing the required parameter 'contractId' when calling getContractAsset");
}
// verify the required parameter 'assetId' is set
if (assetId == null) {
throw new ApiException(
400, "Missing the required parameter 'assetId' when calling getContractAsset");
}
ValidationUtils.assertParamExistsAndNotEmpty("getContractAsset", "contractId", contractId);
ValidationUtils.assertParamExistsAndNotEmpty("getContractAsset", "assetId", assetId);

HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

Expand Down
Loading