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

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

/*
 * Catapult REST Endpoints
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 0.7.21
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package io.nem.sdk.openapi.okhttp_gson.api;

import io.nem.sdk.openapi.okhttp_gson.invoker.ApiCallback;
import io.nem.sdk.openapi.okhttp_gson.invoker.ApiClient;
import io.nem.sdk.openapi.okhttp_gson.invoker.ApiException;
import io.nem.sdk.openapi.okhttp_gson.invoker.ApiResponse;
import io.nem.sdk.openapi.okhttp_gson.invoker.Configuration;
import io.nem.sdk.openapi.okhttp_gson.invoker.Pair;
import io.nem.sdk.openapi.okhttp_gson.invoker.ProgressRequestBody;
import io.nem.sdk.openapi.okhttp_gson.invoker.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import io.nem.sdk.openapi.okhttp_gson.model.BlockInfoDTO;
import io.nem.sdk.openapi.okhttp_gson.model.MerkleProofInfoDTO;
import io.nem.sdk.openapi.okhttp_gson.model.ModelError;
import io.nem.sdk.openapi.okhttp_gson.model.TransactionInfoDTO;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class BlockRoutesApi {
    private ApiClient localVarApiClient;

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

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

    public ApiClient getApiClient() {
        return localVarApiClient;
    }

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

    /**
     * Build call for getBlockByHeight
     * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead.  (required)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     
Status Code Description Response Headers
200 success -
404 ResourceNotFound -
409 InvalidArgument -
*/ public okhttp3.Call getBlockByHeightCall(java.math.BigInteger height, final ApiCallback _callback) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/block/{height}" .replaceAll("\\{" + "height" + "\\}", localVarApiClient.escapeString(height.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { }; return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call getBlockByHeightValidateBeforeCall(java.math.BigInteger height, final ApiCallback _callback) throws ApiException { // verify the required parameter 'height' is set if (height == null) { throw new ApiException("Missing the required parameter 'height' when calling getBlockByHeight(Async)"); } okhttp3.Call localVarCall = getBlockByHeightCall(height, _callback); return localVarCall; } /** * Get block information * Gets a block from the chain that has the given height. * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. (required) * @return BlockInfoDTO * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 success -
404 ResourceNotFound -
409 InvalidArgument -
*/ public BlockInfoDTO getBlockByHeight(java.math.BigInteger height) throws ApiException { ApiResponse localVarResp = getBlockByHeightWithHttpInfo(height); return localVarResp.getData(); } /** * Get block information * Gets a block from the chain that has the given height. * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. (required) * @return ApiResponse<BlockInfoDTO> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 success -
404 ResourceNotFound -
409 InvalidArgument -
*/ public ApiResponse getBlockByHeightWithHttpInfo(java.math.BigInteger height) throws ApiException { okhttp3.Call localVarCall = getBlockByHeightValidateBeforeCall(height, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Get block information (asynchronously) * Gets a block from the chain that has the given height. * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details
Status Code Description Response Headers
200 success -
404 ResourceNotFound -
409 InvalidArgument -
*/ public okhttp3.Call getBlockByHeightAsync(java.math.BigInteger height, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getBlockByHeightValidateBeforeCall(height, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getBlockTransactions * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. (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") * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details
Status Code Description Response Headers
200 success -
404 ResourceNotFound -
409 InvalidArgument -
*/ public okhttp3.Call getBlockTransactionsCall(java.math.BigInteger height, Integer pageSize, String id, String ordering, final ApiCallback _callback) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/block/{height}/transactions" .replaceAll("\\{" + "height" + "\\}", localVarApiClient.escapeString(height.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (pageSize != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("pageSize", pageSize)); } if (id != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("id", id)); } if (ordering != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("ordering", ordering)); } Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { }; return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call getBlockTransactionsValidateBeforeCall(java.math.BigInteger height, Integer pageSize, String id, String ordering, final ApiCallback _callback) throws ApiException { // verify the required parameter 'height' is set if (height == null) { throw new ApiException("Missing the required parameter 'height' when calling getBlockTransactions(Async)"); } okhttp3.Call localVarCall = getBlockTransactionsCall(height, pageSize, id, ordering, _callback); return localVarCall; } /** * Get transactions from a block * Returns an array of transactions included in a block for a given block height. * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. (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 fail to call the API, e.g. server error or cannot deserialize the response body * @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 { ApiResponse> localVarResp = getBlockTransactionsWithHttpInfo(height, pageSize, id, ordering); return localVarResp.getData(); } /** * Get transactions from a block * Returns an array of transactions included in a block for a given block height. * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. (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 fail to call the API, e.g. server error or cannot deserialize the response body * @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 { okhttp3.Call localVarCall = getBlockTransactionsValidateBeforeCall(height, pageSize, id, ordering, null); Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Get transactions from a block (asynchronously) * Returns an array of transactions included in a block for a given block height. * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. (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") * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details
Status Code Description Response Headers
200 success -
404 ResourceNotFound -
409 InvalidArgument -
*/ public okhttp3.Call getBlockTransactionsAsync(java.math.BigInteger height, Integer pageSize, String id, String ordering, final ApiCallback> _callback) throws ApiException { okhttp3.Call localVarCall = getBlockTransactionsValidateBeforeCall(height, pageSize, id, ordering, _callback); Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getBlocksByHeightWithLimit * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. (required) * @param limit Number of elements to be returned. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details
Status Code Description Response Headers
200 success -
409 InvalidArgument -
*/ public okhttp3.Call getBlocksByHeightWithLimitCall(java.math.BigInteger height, Integer limit, final ApiCallback _callback) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/blocks/{height}/limit/{limit}" .replaceAll("\\{" + "height" + "\\}", localVarApiClient.escapeString(height.toString())) .replaceAll("\\{" + "limit" + "\\}", localVarApiClient.escapeString(limit.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { }; return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call getBlocksByHeightWithLimitValidateBeforeCall(java.math.BigInteger height, Integer limit, final ApiCallback _callback) throws ApiException { // verify the required parameter 'height' is set if (height == null) { throw new ApiException("Missing the required parameter 'height' when calling getBlocksByHeightWithLimit(Async)"); } // verify the required parameter 'limit' is set if (limit == null) { throw new ApiException("Missing the required parameter 'limit' when calling getBlocksByHeightWithLimit(Async)"); } okhttp3.Call localVarCall = getBlocksByHeightWithLimitCall(height, limit, _callback); return localVarCall; } /** * Get blocks information * Gets up to limit number of blocks after given block height. * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. (required) * @param limit Number of elements to be returned. (required) * @return List<BlockInfoDTO> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 success -
409 InvalidArgument -
*/ public List getBlocksByHeightWithLimit(java.math.BigInteger height, Integer limit) throws ApiException { ApiResponse> localVarResp = getBlocksByHeightWithLimitWithHttpInfo(height, limit); return localVarResp.getData(); } /** * Get blocks information * Gets up to limit number of blocks after given block height. * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. (required) * @param limit Number of elements to be returned. (required) * @return ApiResponse<List<BlockInfoDTO>> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 success -
409 InvalidArgument -
*/ public ApiResponse> getBlocksByHeightWithLimitWithHttpInfo(java.math.BigInteger height, Integer limit) throws ApiException { okhttp3.Call localVarCall = getBlocksByHeightWithLimitValidateBeforeCall(height, limit, null); Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Get blocks information (asynchronously) * Gets up to limit number of blocks after given block height. * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. (required) * @param limit Number of elements to be returned. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details
Status Code Description Response Headers
200 success -
409 InvalidArgument -
*/ public okhttp3.Call getBlocksByHeightWithLimitAsync(java.math.BigInteger height, Integer limit, final ApiCallback> _callback) throws ApiException { okhttp3.Call localVarCall = getBlocksByHeightWithLimitValidateBeforeCall(height, limit, _callback); Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getMerkleTransaction * @param height Block height. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. (required) * @param hash Transaction hash. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details
Status Code Description Response Headers
200 success -
404 ResourceNotFound -
409 InvalidArgument -
*/ public okhttp3.Call getMerkleTransactionCall(java.math.BigInteger height, String hash, final ApiCallback _callback) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/block/{height}/transaction/{hash}/merkle" .replaceAll("\\{" + "height" + "\\}", localVarApiClient.escapeString(height.toString())) .replaceAll("\\{" + "hash" + "\\}", localVarApiClient.escapeString(hash.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { }; return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call getMerkleTransactionValidateBeforeCall(java.math.BigInteger height, String hash, final ApiCallback _callback) throws ApiException { // verify the required parameter 'height' is set if (height == null) { throw new ApiException("Missing the required parameter 'height' when calling getMerkleTransaction(Async)"); } // verify the required parameter 'hash' is set if (hash == null) { throw new ApiException("Missing the required parameter 'hash' when calling getMerkleTransaction(Async)"); } okhttp3.Call localVarCall = getMerkleTransactionCall(height, hash, _callback); return localVarCall; } /** * 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. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. (required) * @param hash Transaction hash. (required) * @return MerkleProofInfoDTO * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @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 { ApiResponse localVarResp = getMerkleTransactionWithHttpInfo(height, hash); return localVarResp.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. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. (required) * @param hash Transaction hash. (required) * @return ApiResponse<MerkleProofInfoDTO> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @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 { okhttp3.Call localVarCall = getMerkleTransactionValidateBeforeCall(height, hash, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Get the merkle path for a given a transaction and block (asynchronously) * 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. If height -1 is not a multiple of the limit provided, the inferior closest multiple + 1 is used instead. (required) * @param hash Transaction hash. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details
Status Code Description Response Headers
200 success -
404 ResourceNotFound -
409 InvalidArgument -
*/ public okhttp3.Call getMerkleTransactionAsync(java.math.BigInteger height, String hash, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getMerkleTransactionValidateBeforeCall(height, hash, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy