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

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

There is a newer version: 1.0.3
Show newest version
/*
 * Catapult REST Endpoints
 * OpenAPI Specification of catapult-rest 1.1.2
 *
 * The version of the OpenAPI document: 0.9.4
 * 
 *
 * 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.symbol.sdk.openapi.okhttp_gson.api;

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

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import io.nem.symbol.sdk.openapi.okhttp_gson.model.BlockInfoDTO;
import io.nem.symbol.sdk.openapi.okhttp_gson.model.BlockOrderByEnum;
import io.nem.symbol.sdk.openapi.okhttp_gson.model.BlockPage;
import io.nem.symbol.sdk.openapi.okhttp_gson.model.MerkleProofInfoDTO;
import io.nem.symbol.sdk.openapi.okhttp_gson.model.ModelError;
import io.nem.symbol.sdk.openapi.okhttp_gson.model.Order;

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. (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 = null; // create path and map variables String localVarPath = "/blocks/{height}" .replaceAll("\\{" + "height" + "\\}", localVarApiClient.escapeString(height.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = 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, localVarCookieParams, 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. (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. (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. (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 getMerkleTransaction * @param height Block height. (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 = null; // create path and map variables String localVarPath = "/blocks/{height}/transactions/{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 localVarCookieParams = 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, localVarCookieParams, 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 merkle path is the minimum number of nodes needed to calculate the merkle root. Steps to calculate the merkle root: 1. proofHash = hash (leaf). 2. Concatenate proofHash with the first unprocessed item from the merklePath list as follows: * a) If item.position == left -> proofHash = sha_256(item.hash + proofHash). * b) If item.position == right -> proofHash = sha_256(proofHash+ item.hash). 3. Repeat 2. for every item in the merklePath list. 4. Compare if the calculated proofHash equals the one recorded in the block header (block.transactionsHash) to verify if the transaction was included in the block. * @param height Block height. (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 merkle path is the minimum number of nodes needed to calculate the merkle root. Steps to calculate the merkle root: 1. proofHash = hash (leaf). 2. Concatenate proofHash with the first unprocessed item from the merklePath list as follows: * a) If item.position == left -> proofHash = sha_256(item.hash + proofHash). * b) If item.position == right -> proofHash = sha_256(proofHash+ item.hash). 3. Repeat 2. for every item in the merklePath list. 4. Compare if the calculated proofHash equals the one recorded in the block header (block.transactionsHash) to verify if the transaction was included in the block. * @param height Block height. (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 merkle path is the minimum number of nodes needed to calculate the merkle root. Steps to calculate the merkle root: 1. proofHash = hash (leaf). 2. Concatenate proofHash with the first unprocessed item from the merklePath list as follows: * a) If item.position == left -> proofHash = sha_256(item.hash + proofHash). * b) If item.position == right -> proofHash = sha_256(proofHash+ item.hash). 3. Repeat 2. for every item in the merklePath list. 4. Compare if the calculated proofHash equals the one recorded in the block header (block.transactionsHash) to verify if the transaction was included in the block. * @param height Block height. (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; } /** * Build call for searchBlocks * @param signerPublicKey Public key of the account signing the entity. (optional) * @param beneficiaryAddress Filter by beneficiary address. (optional) * @param pageSize Select the number of entries to return. (optional, default to 10) * @param pageNumber Filter by page number. (optional, default to 1) * @param offset Entry id at which to start pagination. If the ordering parameter is set to -id, the elements returned precede the identifier. Otherwise, newer elements with respect to the id are returned. (optional) * @param order Sort responses in ascending or descending order based on the collection property set on the param ``orderBy``. If the request does not specify ``orderBy``, REST returns the collection ordered by id. (optional, default to desc) * @param orderBy (optional) * @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 searchBlocksCall(String signerPublicKey, String beneficiaryAddress, Integer pageSize, Integer pageNumber, String offset, Order order, BlockOrderByEnum orderBy, final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/blocks"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); if (signerPublicKey != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("signerPublicKey", signerPublicKey)); } if (beneficiaryAddress != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("beneficiaryAddress", beneficiaryAddress)); } if (pageSize != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("pageSize", pageSize)); } if (pageNumber != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("pageNumber", pageNumber)); } if (offset != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); } if (order != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("order", order)); } if (orderBy != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("orderBy", orderBy)); } Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = 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, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call searchBlocksValidateBeforeCall(String signerPublicKey, String beneficiaryAddress, Integer pageSize, Integer pageNumber, String offset, Order order, BlockOrderByEnum orderBy, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = searchBlocksCall(signerPublicKey, beneficiaryAddress, pageSize, pageNumber, offset, order, orderBy, _callback); return localVarCall; } /** * Get blocks * Gets an array of bocks. * @param signerPublicKey Public key of the account signing the entity. (optional) * @param beneficiaryAddress Filter by beneficiary address. (optional) * @param pageSize Select the number of entries to return. (optional, default to 10) * @param pageNumber Filter by page number. (optional, default to 1) * @param offset Entry id at which to start pagination. If the ordering parameter is set to -id, the elements returned precede the identifier. Otherwise, newer elements with respect to the id are returned. (optional) * @param order Sort responses in ascending or descending order based on the collection property set on the param ``orderBy``. If the request does not specify ``orderBy``, REST returns the collection ordered by id. (optional, default to desc) * @param orderBy (optional) * @return BlockPage * @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 BlockPage searchBlocks(String signerPublicKey, String beneficiaryAddress, Integer pageSize, Integer pageNumber, String offset, Order order, BlockOrderByEnum orderBy) throws ApiException { ApiResponse localVarResp = searchBlocksWithHttpInfo(signerPublicKey, beneficiaryAddress, pageSize, pageNumber, offset, order, orderBy); return localVarResp.getData(); } /** * Get blocks * Gets an array of bocks. * @param signerPublicKey Public key of the account signing the entity. (optional) * @param beneficiaryAddress Filter by beneficiary address. (optional) * @param pageSize Select the number of entries to return. (optional, default to 10) * @param pageNumber Filter by page number. (optional, default to 1) * @param offset Entry id at which to start pagination. If the ordering parameter is set to -id, the elements returned precede the identifier. Otherwise, newer elements with respect to the id are returned. (optional) * @param order Sort responses in ascending or descending order based on the collection property set on the param ``orderBy``. If the request does not specify ``orderBy``, REST returns the collection ordered by id. (optional, default to desc) * @param orderBy (optional) * @return ApiResponse<BlockPage> * @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 searchBlocksWithHttpInfo(String signerPublicKey, String beneficiaryAddress, Integer pageSize, Integer pageNumber, String offset, Order order, BlockOrderByEnum orderBy) throws ApiException { okhttp3.Call localVarCall = searchBlocksValidateBeforeCall(signerPublicKey, beneficiaryAddress, pageSize, pageNumber, offset, order, orderBy, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Get blocks (asynchronously) * Gets an array of bocks. * @param signerPublicKey Public key of the account signing the entity. (optional) * @param beneficiaryAddress Filter by beneficiary address. (optional) * @param pageSize Select the number of entries to return. (optional, default to 10) * @param pageNumber Filter by page number. (optional, default to 1) * @param offset Entry id at which to start pagination. If the ordering parameter is set to -id, the elements returned precede the identifier. Otherwise, newer elements with respect to the id are returned. (optional) * @param order Sort responses in ascending or descending order based on the collection property set on the param ``orderBy``. If the request does not specify ``orderBy``, REST returns the collection ordered by id. (optional, default to desc) * @param orderBy (optional) * @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 searchBlocksAsync(String signerPublicKey, String beneficiaryAddress, Integer pageSize, Integer pageNumber, String offset, Order order, BlockOrderByEnum orderBy, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = searchBlocksValidateBeforeCall(signerPublicKey, beneficiaryAddress, pageSize, pageNumber, offset, order, orderBy, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy