/*
 * Lethean Blockchain API
 * OpenAPI for Lethean Blockchain
 *
 * The version of the OpenAPI document: 6.0.1
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package lthn;

import invalidPackageName.ApiCallback;
import invalidPackageName.ApiClient;
import invalidPackageName.ApiException;
import invalidPackageName.ApiResponse;
import invalidPackageName.Configuration;
import invalidPackageName.Pair;
import invalidPackageName.ProgressRequestBody;
import invalidPackageName.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import org.openapitools.client.model.BlockDetailsModel;
import org.openapitools.client.model.BlockTemplateModel;
import org.openapitools.client.model.BlockTemplateRequestModel;
import org.openapitools.client.model.HeightModel;
import org.openapitools.client.model.SubmitBlockRequestModel;
import org.openapitools.client.model.SubmitBlockResponseModel;

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

public class BlockApi {
    private ApiClient localVarApiClient;
    private int localHostIndex;
    private String localCustomBaseUrl;

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

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

    public ApiClient getApiClient() {
        return localVarApiClient;
    }

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

    public int getHostIndex() {
        return localHostIndex;
    }

    public void setHostIndex(int hostIndex) {
        this.localHostIndex = hostIndex;
    }

    public String getCustomBaseUrl() {
        return localCustomBaseUrl;
    }

    public void setCustomBaseUrl(String customBaseUrl) {
        this.localCustomBaseUrl = customBaseUrl;
    }

    /**
     * Build call for createBlockTemplate
     * @param blockTemplateRequestModel  (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
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 500 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call createBlockTemplateCall(@javax.annotation.Nonnull BlockTemplateRequestModel blockTemplateRequestModel, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = blockTemplateRequestModel;

        // create path and map variables
        String localVarPath = "/block/template";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] {  };
        return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call createBlockTemplateValidateBeforeCall(@javax.annotation.Nonnull BlockTemplateRequestModel blockTemplateRequestModel, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'blockTemplateRequestModel' is set
        if (blockTemplateRequestModel == null) {
            throw new ApiException("Missing the required parameter 'blockTemplateRequestModel' when calling createBlockTemplate(Async)");
        }

        return createBlockTemplateCall(blockTemplateRequestModel, _callback);

    }

    /**
     * Create a block template for mining
     * 
     * @param blockTemplateRequestModel  (required)
     * @return BlockTemplateModel
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 500 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public BlockTemplateModel createBlockTemplate(@javax.annotation.Nonnull BlockTemplateRequestModel blockTemplateRequestModel) throws ApiException {
        ApiResponse<BlockTemplateModel> localVarResp = createBlockTemplateWithHttpInfo(blockTemplateRequestModel);
        return localVarResp.getData();
    }

    /**
     * Create a block template for mining
     * 
     * @param blockTemplateRequestModel  (required)
     * @return ApiResponse&lt;BlockTemplateModel&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 500 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<BlockTemplateModel> createBlockTemplateWithHttpInfo(@javax.annotation.Nonnull BlockTemplateRequestModel blockTemplateRequestModel) throws ApiException {
        okhttp3.Call localVarCall = createBlockTemplateValidateBeforeCall(blockTemplateRequestModel, null);
        Type localVarReturnType = new TypeToken<BlockTemplateModel>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Create a block template for mining (asynchronously)
     * 
     * @param blockTemplateRequestModel  (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
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 500 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call createBlockTemplateAsync(@javax.annotation.Nonnull BlockTemplateRequestModel blockTemplateRequestModel, final ApiCallback<BlockTemplateModel> _callback) throws ApiException {

        okhttp3.Call localVarCall = createBlockTemplateValidateBeforeCall(blockTemplateRequestModel, _callback);
        Type localVarReturnType = new TypeToken<BlockTemplateModel>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for getBlock
     * @param identifier The hash (hex string) or height (integer) of the block to retrieve. (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
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 404 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getBlockCall(@javax.annotation.Nonnull String identifier, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/block/{identifier}"
            .replace("{" + "identifier" + "}", localVarApiClient.escapeString(identifier.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        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);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] {  };
        return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getBlockValidateBeforeCall(@javax.annotation.Nonnull String identifier, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'identifier' is set
        if (identifier == null) {
            throw new ApiException("Missing the required parameter 'identifier' when calling getBlock(Async)");
        }

        return getBlockCall(identifier, _callback);

    }

    /**
     * Get a block by its hash or height (ID)
     * 
     * @param identifier The hash (hex string) or height (integer) of the block to retrieve. (required)
     * @return BlockDetailsModel
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 404 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public BlockDetailsModel getBlock(@javax.annotation.Nonnull String identifier) throws ApiException {
        ApiResponse<BlockDetailsModel> localVarResp = getBlockWithHttpInfo(identifier);
        return localVarResp.getData();
    }

    /**
     * Get a block by its hash or height (ID)
     * 
     * @param identifier The hash (hex string) or height (integer) of the block to retrieve. (required)
     * @return ApiResponse&lt;BlockDetailsModel&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 404 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<BlockDetailsModel> getBlockWithHttpInfo(@javax.annotation.Nonnull String identifier) throws ApiException {
        okhttp3.Call localVarCall = getBlockValidateBeforeCall(identifier, null);
        Type localVarReturnType = new TypeToken<BlockDetailsModel>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Get a block by its hash or height (ID) (asynchronously)
     * 
     * @param identifier The hash (hex string) or height (integer) of the block to retrieve. (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
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 404 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getBlockAsync(@javax.annotation.Nonnull String identifier, final ApiCallback<BlockDetailsModel> _callback) throws ApiException {

        okhttp3.Call localVarCall = getBlockValidateBeforeCall(identifier, _callback);
        Type localVarReturnType = new TypeToken<BlockDetailsModel>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for getBlocks
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 404 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 200 </td><td> A list of block objects. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getBlocksCall(final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/block";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        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);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] {  };
        return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getBlocksValidateBeforeCall(final ApiCallback _callback) throws ApiException {
        return getBlocksCall(_callback);

    }

    /**
     * Get one or more blocks, with optional pagination.
     * 
     * @return List&lt;BlockDetailsModel&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 404 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 200 </td><td> A list of block objects. </td><td>  -  </td></tr>
     </table>
     */
    public List<BlockDetailsModel> getBlocks() throws ApiException {
        ApiResponse<List<BlockDetailsModel>> localVarResp = getBlocksWithHttpInfo();
        return localVarResp.getData();
    }

    /**
     * Get one or more blocks, with optional pagination.
     * 
     * @return ApiResponse&lt;List&lt;BlockDetailsModel&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 404 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 200 </td><td> A list of block objects. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<List<BlockDetailsModel>> getBlocksWithHttpInfo() throws ApiException {
        okhttp3.Call localVarCall = getBlocksValidateBeforeCall(null);
        Type localVarReturnType = new TypeToken<List<BlockDetailsModel>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Get one or more blocks, with optional pagination. (asynchronously)
     * 
     * @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
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 404 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 200 </td><td> A list of block objects. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getBlocksAsync(final ApiCallback<List<BlockDetailsModel>> _callback) throws ApiException {

        okhttp3.Call localVarCall = getBlocksValidateBeforeCall(_callback);
        Type localVarReturnType = new TypeToken<List<BlockDetailsModel>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for getHeight
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getHeightCall(final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/block/height";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        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);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] {  };
        return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getHeightValidateBeforeCall(final ApiCallback _callback) throws ApiException {
        return getHeightCall(_callback);

    }

    /**
     * Get the current blockchain height
     * 
     * @return HeightModel
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public HeightModel getHeight() throws ApiException {
        ApiResponse<HeightModel> localVarResp = getHeightWithHttpInfo();
        return localVarResp.getData();
    }

    /**
     * Get the current blockchain height
     * 
     * @return ApiResponse&lt;HeightModel&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<HeightModel> getHeightWithHttpInfo() throws ApiException {
        okhttp3.Call localVarCall = getHeightValidateBeforeCall(null);
        Type localVarReturnType = new TypeToken<HeightModel>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Get the current blockchain height (asynchronously)
     * 
     * @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
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getHeightAsync(final ApiCallback<HeightModel> _callback) throws ApiException {

        okhttp3.Call localVarCall = getHeightValidateBeforeCall(_callback);
        Type localVarReturnType = new TypeToken<HeightModel>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for submitBlock
     * @param submitBlockRequestModel  (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
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 406 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call submitBlockCall(@javax.annotation.Nonnull SubmitBlockRequestModel submitBlockRequestModel, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = submitBlockRequestModel;

        // create path and map variables
        String localVarPath = "/block/submit";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] {  };
        return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call submitBlockValidateBeforeCall(@javax.annotation.Nonnull SubmitBlockRequestModel submitBlockRequestModel, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'submitBlockRequestModel' is set
        if (submitBlockRequestModel == null) {
            throw new ApiException("Missing the required parameter 'submitBlockRequestModel' when calling submitBlock(Async)");
        }

        return submitBlockCall(submitBlockRequestModel, _callback);

    }

    /**
     * Submit a new block to the network
     * 
     * @param submitBlockRequestModel  (required)
     * @return SubmitBlockResponseModel
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 406 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public SubmitBlockResponseModel submitBlock(@javax.annotation.Nonnull SubmitBlockRequestModel submitBlockRequestModel) throws ApiException {
        ApiResponse<SubmitBlockResponseModel> localVarResp = submitBlockWithHttpInfo(submitBlockRequestModel);
        return localVarResp.getData();
    }

    /**
     * Submit a new block to the network
     * 
     * @param submitBlockRequestModel  (required)
     * @return ApiResponse&lt;SubmitBlockResponseModel&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 406 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<SubmitBlockResponseModel> submitBlockWithHttpInfo(@javax.annotation.Nonnull SubmitBlockRequestModel submitBlockRequestModel) throws ApiException {
        okhttp3.Call localVarCall = submitBlockValidateBeforeCall(submitBlockRequestModel, null);
        Type localVarReturnType = new TypeToken<SubmitBlockResponseModel>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Submit a new block to the network (asynchronously)
     * 
     * @param submitBlockRequestModel  (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
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 406 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> text/plain </td><td>  -  </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call submitBlockAsync(@javax.annotation.Nonnull SubmitBlockRequestModel submitBlockRequestModel, final ApiCallback<SubmitBlockResponseModel> _callback) throws ApiException {

        okhttp3.Call localVarCall = submitBlockValidateBeforeCall(submitBlockRequestModel, _callback);
        Type localVarReturnType = new TypeToken<SubmitBlockResponseModel>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
}
