io.nem.sdk.openapi.jersey2.api.ReceiptRoutesApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api-jersey2-client Show documentation
Show all versions of api-jersey2-client Show documentation
Generated Open API client for NEM
package io.nem.sdk.openapi.jersey2.api;
import io.nem.sdk.openapi.jersey2.invoker.ApiException;
import io.nem.sdk.openapi.jersey2.invoker.ApiClient;
import io.nem.sdk.openapi.jersey2.invoker.ApiResponse;
import io.nem.sdk.openapi.jersey2.invoker.Configuration;
import io.nem.sdk.openapi.jersey2.invoker.Pair;
import javax.ws.rs.core.GenericType;
import io.nem.sdk.openapi.jersey2.model.MerkleProofInfoDTO;
import io.nem.sdk.openapi.jersey2.model.ModelError;
import io.nem.sdk.openapi.jersey2.model.StatementsDTO;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2020-02-07T22:44:38.001Z[UTC]")
public class ReceiptRoutesApi {
private ApiClient apiClient;
public ReceiptRoutesApi() {
this(Configuration.getDefaultApiClient());
}
public ReceiptRoutesApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Get receipts from a block
* Returns the receipts linked to a block.
* @param height Block height. (required)
* @return StatementsDTO
* @throws ApiException if fails to make API call
* @http.response.details
Status Code Description Response Headers
200 success -
404 ResourceNotFound -
409 InvalidArgument -
*/
public StatementsDTO getBlockReceipts(java.math.BigInteger height) throws ApiException {
return getBlockReceiptsWithHttpInfo(height).getData();
}
/**
* Get receipts from a block
* Returns the receipts linked to a block.
* @param height Block height. (required)
* @return ApiResponse<StatementsDTO>
* @throws ApiException if fails to make API call
* @http.response.details
Status Code Description Response Headers
200 success -
404 ResourceNotFound -
409 InvalidArgument -
*/
public ApiResponse getBlockReceiptsWithHttpInfo(java.math.BigInteger height) throws ApiException {
Object localVarPostBody = new Object();
// verify the required parameter 'height' is set
if (height == null) {
throw new ApiException(400, "Missing the required parameter 'height' when calling getBlockReceipts");
}
// create path and map variables
String localVarPath = "/block/{height}/receipts"
.replaceAll("\\{" + "height" + "\\}", apiClient.escapeString(height.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Get the merkle path for a given a receipt statement hash and block
* Returns the merkle path for a receipt statement or resolution linked to a block. The path is the complementary data needed to calculate the merkle root. A client can compare if the calculated root equals the one recorded in the block header, verifying that the receipt was linked with the block.
* @param height Block height. (required)
* @param hash Receipt hash. (required)
* @return MerkleProofInfoDTO
* @throws ApiException if fails to make API call
* @http.response.details
Status Code Description Response Headers
200 success -
404 ResourceNotFound -
409 InvalidArgument -
*/
public MerkleProofInfoDTO getMerkleReceipts(java.math.BigInteger height, String hash) throws ApiException {
return getMerkleReceiptsWithHttpInfo(height, hash).getData();
}
/**
* Get the merkle path for a given a receipt statement hash and block
* Returns the merkle path for a receipt statement or resolution linked to a block. The path is the complementary data needed to calculate the merkle root. A client can compare if the calculated root equals the one recorded in the block header, verifying that the receipt was linked with the block.
* @param height Block height. (required)
* @param hash Receipt hash. (required)
* @return ApiResponse<MerkleProofInfoDTO>
* @throws ApiException if fails to make API call
* @http.response.details
Status Code Description Response Headers
200 success -
404 ResourceNotFound -
409 InvalidArgument -
*/
public ApiResponse getMerkleReceiptsWithHttpInfo(java.math.BigInteger height, String hash) throws ApiException {
Object localVarPostBody = new Object();
// verify the required parameter 'height' is set
if (height == null) {
throw new ApiException(400, "Missing the required parameter 'height' when calling getMerkleReceipts");
}
// verify the required parameter 'hash' is set
if (hash == null) {
throw new ApiException(400, "Missing the required parameter 'hash' when calling getMerkleReceipts");
}
// create path and map variables
String localVarPath = "/block/{height}/receipt/{hash}/merkle"
.replaceAll("\\{" + "height" + "\\}", apiClient.escapeString(height.toString()))
.replaceAll("\\{" + "hash" + "\\}", apiClient.escapeString(hash.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}