All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.nem.sdk.openapi.jersey2.api.BlockRoutesApi Maven / Gradle / Ivy

There is a newer version: 0.8.4
Show newest version
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.BlockInfoDTO;
import io.nem.sdk.openapi.jersey2.model.MerkleProofInfoDTO;
import io.nem.sdk.openapi.jersey2.model.ModelError;
import io.nem.sdk.openapi.jersey2.model.TransactionInfoDTO;

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 BlockRoutesApi {
  private ApiClient apiClient;

  public BlockRoutesApi() {
    this(Configuration.getDefaultApiClient());
  }

  public BlockRoutesApi(ApiClient apiClient) {
    this.apiClient = apiClient;
  }

  public ApiClient getApiClient() {
    return apiClient;
  }

  public void setApiClient(ApiClient apiClient) {
    this.apiClient = apiClient;
  }

  /**
   * Get block information
   * Gets a block from the chain that has the given height.
   * @param height Block height.  (required)
   * @return BlockInfoDTO
   * @throws ApiException if fails to make API call
   * @http.response.details
     
Status Code Description Response Headers
200 success -
404 ResourceNotFound -
409 InvalidArgument -
*/ public BlockInfoDTO getBlockByHeight(java.math.BigInteger height) throws ApiException { return getBlockByHeightWithHttpInfo(height).getData(); } /** * Get block information * Gets a block from the chain that has the given height. * @param height Block height. (required) * @return ApiResponse<BlockInfoDTO> * @throws ApiException if fails to make API call * @http.response.details
Status Code Description Response Headers
200 success -
404 ResourceNotFound -
409 InvalidArgument -
*/ public ApiResponse getBlockByHeightWithHttpInfo(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 getBlockByHeight"); } // create path and map variables String localVarPath = "/block/{height}" .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 transactions from a block * Returns an array of transactions included in a block for a given block height. * @param height Block height. (required) * @param pageSize Number of transactions to return for each request. (optional, default to 10) * @param id Transaction identifier up to which transactions are returned. (optional) * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. (optional, default to "-id") * @return List<TransactionInfoDTO> * @throws ApiException if fails to make API call * @http.response.details
Status Code Description Response Headers
200 success -
404 ResourceNotFound -
409 InvalidArgument -
*/ public List getBlockTransactions(java.math.BigInteger height, Integer pageSize, String id, String ordering) throws ApiException { return getBlockTransactionsWithHttpInfo(height, pageSize, id, ordering).getData(); } /** * Get transactions from a block * Returns an array of transactions included in a block for a given block height. * @param height Block height. (required) * @param pageSize Number of transactions to return for each request. (optional, default to 10) * @param id Transaction identifier up to which transactions are returned. (optional) * @param ordering Ordering criteria: * -id - Descending order by id. * id - Ascending order by id. (optional, default to "-id") * @return ApiResponse<List<TransactionInfoDTO>> * @throws ApiException if fails to make API call * @http.response.details
Status Code Description Response Headers
200 success -
404 ResourceNotFound -
409 InvalidArgument -
*/ public ApiResponse> getBlockTransactionsWithHttpInfo(java.math.BigInteger height, Integer pageSize, String id, String ordering) 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 getBlockTransactions"); } // create path and map variables String localVarPath = "/block/{height}/transactions" .replaceAll("\\{" + "height" + "\\}", apiClient.escapeString(height.toString())); // query params List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); localVarQueryParams.addAll(apiClient.parameterToPairs("", "pageSize", pageSize)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "id", id)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "ordering", ordering)); 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 blocks information * Gets up to limit number of blocks after given block height. * @param height Block height. (required) * @param limit Number of elements to be returned. The limit should be greater than or equal to \"db.pageSizeMin\" and not higher than \"db.pageSizeMax\". The settings are adjustable via a configuration file (rest/resources/rest.json) per REST instance. (required) * @return List<BlockInfoDTO> * @throws ApiException if fails to make API call * @http.response.details
Status Code Description Response Headers
200 success -
409 InvalidArgument -
*/ public List getBlocksByHeightWithLimit(java.math.BigInteger height, Integer limit) throws ApiException { return getBlocksByHeightWithLimitWithHttpInfo(height, limit).getData(); } /** * Get blocks information * Gets up to limit number of blocks after given block height. * @param height Block height. (required) * @param limit Number of elements to be returned. The limit should be greater than or equal to \"db.pageSizeMin\" and not higher than \"db.pageSizeMax\". The settings are adjustable via a configuration file (rest/resources/rest.json) per REST instance. (required) * @return ApiResponse<List<BlockInfoDTO>> * @throws ApiException if fails to make API call * @http.response.details
Status Code Description Response Headers
200 success -
409 InvalidArgument -
*/ public ApiResponse> getBlocksByHeightWithLimitWithHttpInfo(java.math.BigInteger height, Integer limit) 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 getBlocksByHeightWithLimit"); } // verify the required parameter 'limit' is set if (limit == null) { throw new ApiException(400, "Missing the required parameter 'limit' when calling getBlocksByHeightWithLimit"); } // create path and map variables String localVarPath = "/blocks/{height}/limit/{limit}" .replaceAll("\\{" + "height" + "\\}", apiClient.escapeString(height.toString())) .replaceAll("\\{" + "limit" + "\\}", apiClient.escapeString(limit.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 transaction and block * Returns the merkle path for a transaction included in 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 transaction was included in the block. * @param height Block height. (required) * @param hash Transaction 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 getMerkleTransaction(java.math.BigInteger height, String hash) throws ApiException { return getMerkleTransactionWithHttpInfo(height, hash).getData(); } /** * Get the merkle path for a given a transaction and block * Returns the merkle path for a transaction included in 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 transaction was included in the block. * @param height Block height. (required) * @param hash Transaction 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 getMerkleTransactionWithHttpInfo(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 getMerkleTransaction"); } // verify the required parameter 'hash' is set if (hash == null) { throw new ApiException(400, "Missing the required parameter 'hash' when calling getMerkleTransaction"); } // create path and map variables String localVarPath = "/block/{height}/transaction/{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); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy