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

io.nem.symbol.sdk.openapi.okhttp_gson.api.ReceiptRoutesApi 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.MerkleProofInfoDTO;
import io.nem.symbol.sdk.openapi.okhttp_gson.model.ModelError;
import io.nem.symbol.sdk.openapi.okhttp_gson.model.StatementsDTO;

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

public class ReceiptRoutesApi {
    private ApiClient localVarApiClient;

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

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

    public ApiClient getApiClient() {
        return localVarApiClient;
    }

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

    /**
     * Build call for getBlockReceipts
     * @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 getBlockReceiptsCall(java.math.BigInteger height, final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/block/{height}/receipts" .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 getBlockReceiptsValidateBeforeCall(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 getBlockReceipts(Async)"); } okhttp3.Call localVarCall = getBlockReceiptsCall(height, _callback); return localVarCall; } /** * Get receipts from a block * Returns the receipts linked to a block. * @param height Block height. (required) * @return StatementsDTO * @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 StatementsDTO getBlockReceipts(java.math.BigInteger height) throws ApiException { ApiResponse localVarResp = getBlockReceiptsWithHttpInfo(height); return localVarResp.getData(); } /** * Get receipts from a block * Returns the receipts linked to a block. * @param height Block height. (required) * @return ApiResponse<StatementsDTO> * @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 getBlockReceiptsWithHttpInfo(java.math.BigInteger height) throws ApiException { okhttp3.Call localVarCall = getBlockReceiptsValidateBeforeCall(height, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Get receipts from a block (asynchronously) * Returns the receipts linked to a block. * @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 getBlockReceiptsAsync(java.math.BigInteger height, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getBlockReceiptsValidateBeforeCall(height, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getMerkleReceipts * @param height Block height. (required) * @param hash Receipt 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 getMerkleReceiptsCall(java.math.BigInteger height, String hash, final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/block/{height}/receipt/{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 getMerkleReceiptsValidateBeforeCall(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 getMerkleReceipts(Async)"); } // verify the required parameter 'hash' is set if (hash == null) { throw new ApiException("Missing the required parameter 'hash' when calling getMerkleReceipts(Async)"); } okhttp3.Call localVarCall = getMerkleReceiptsCall(height, hash, _callback); return localVarCall; } /** * 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 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.receiptsHash) to verify if the statement was linked with the block. * @param height Block height. (required) * @param hash Receipt 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 getMerkleReceipts(java.math.BigInteger height, String hash) throws ApiException { ApiResponse localVarResp = getMerkleReceiptsWithHttpInfo(height, hash); return localVarResp.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 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.receiptsHash) to verify if the statement was linked with the block. * @param height Block height. (required) * @param hash Receipt 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 getMerkleReceiptsWithHttpInfo(java.math.BigInteger height, String hash) throws ApiException { okhttp3.Call localVarCall = getMerkleReceiptsValidateBeforeCall(height, hash, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Get the merkle path for a given a receipt statement hash and block (asynchronously) * Returns the merkle path for a receipt statement or resolution linked to 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.receiptsHash) to verify if the statement was linked with the block. * @param height Block height. (required) * @param hash Receipt 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 getMerkleReceiptsAsync(java.math.BigInteger height, String hash, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getMerkleReceiptsValidateBeforeCall(height, hash, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy