/* tslint:disable */
/* eslint-disable */
/**
 * Stacks 2.0 Blockchain API
 * This is the documentation for the Stacks 2.0 Blockchain API.  It is comprised of two parts; the Stacks Blockchain API and the Stacks Core API.  [![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/614feab5c108d292bffa#?env%5BStacks%20Blockchain%20API%5D=W3sia2V5Ijoic3R4X2FkZHJlc3MiLCJ2YWx1ZSI6IlNUMlRKUkhESE1ZQlE0MTdIRkIwQkRYNDMwVFFBNVBYUlg2NDk1RzFWIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJibG9ja19pZCIsInZhbHVlIjoiMHgiLCJlbmFibGVkIjp0cnVlfSx7ImtleSI6Im9mZnNldCIsInZhbHVlIjoiMCIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoibGltaXRfdHgiLCJ2YWx1ZSI6IjIwMCIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoibGltaXRfYmxvY2siLCJ2YWx1ZSI6IjMwIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJ0eF9pZCIsInZhbHVlIjoiMHg1NDA5MGMxNmE3MDJiNzUzYjQzMTE0ZTg4NGJjMTlhODBhNzk2MzhmZDQ0OWE0MGY4MDY4Y2RmMDAzY2RlNmUwIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJjb250cmFjdF9pZCIsInZhbHVlIjoiU1RKVFhFSlBKUFBWRE5BOUIwNTJOU1JSQkdRQ0ZOS1ZTMTc4VkdIMS5oZWxsb193b3JsZFxuIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJidGNfYWRkcmVzcyIsInZhbHVlIjoiYWJjIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJjb250cmFjdF9hZGRyZXNzIiwidmFsdWUiOiJTVEpUWEVKUEpQUFZETkE5QjA1Mk5TUlJCR1FDRk5LVlMxNzhWR0gxIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJjb250cmFjdF9uYW1lIiwidmFsdWUiOiJoZWxsb193b3JsZCIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoiY29udHJhY3RfbWFwIiwidmFsdWUiOiJzdG9yZSIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoiY29udHJhY3RfbWV0aG9kIiwidmFsdWUiOiJnZXQtdmFsdWUiLCJlbmFibGVkIjp0cnVlfV0=) 
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


import * as runtime from '../runtime';
import {
    CoreNodeInfoResponse,
    CoreNodeInfoResponseFromJSON,
    CoreNodeInfoResponseToJSON,
    CoreNodePoxResponse,
    CoreNodePoxResponseFromJSON,
    CoreNodePoxResponseToJSON,
    NetworkBlockTimeResponse,
    NetworkBlockTimeResponseFromJSON,
    NetworkBlockTimeResponseToJSON,
    NetworkBlockTimesResponse,
    NetworkBlockTimesResponseFromJSON,
    NetworkBlockTimesResponseToJSON,
} from '../models';

export interface GetNetworkBlockTimeByNetworkRequest {
    network: GetNetworkBlockTimeByNetworkNetworkEnum;
}

/**
 * InfoApi - interface
 * 
 * @export
 * @interface InfoApiInterface
 */
export interface InfoApiInterface {
    /**
     * Get Core API information
     * @summary Get Core API info
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof InfoApiInterface
     */
    getCoreApiInfoRaw(): Promise<runtime.ApiResponse<CoreNodeInfoResponse>>;

    /**
     * Get Core API information
     * Get Core API info
     */
    getCoreApiInfo(): Promise<CoreNodeInfoResponse>;

    /**
     * 
     * @summary Get a given network\'s target block time
     * @param {'testnet' | 'mainnet'} network Which network to retrieve the target block time of
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof InfoApiInterface
     */
    getNetworkBlockTimeByNetworkRaw(requestParameters: GetNetworkBlockTimeByNetworkRequest): Promise<runtime.ApiResponse<NetworkBlockTimeResponse>>;

    /**
     * Get a given network\'s target block time
     */
    getNetworkBlockTimeByNetwork(requestParameters: GetNetworkBlockTimeByNetworkRequest): Promise<NetworkBlockTimeResponse>;

    /**
     * 
     * @summary Get the network target block time
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof InfoApiInterface
     */
    getNetworkBlockTimesRaw(): Promise<runtime.ApiResponse<NetworkBlockTimesResponse>>;

    /**
     * Get the network target block time
     */
    getNetworkBlockTimes(): Promise<NetworkBlockTimesResponse>;

    /**
     * Get Proof of Transfer (PoX) information. Can be used for Stacking.
     * @summary Get PoX details
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof InfoApiInterface
     */
    getPoxInfoRaw(): Promise<runtime.ApiResponse<CoreNodePoxResponse>>;

    /**
     * Get Proof of Transfer (PoX) information. Can be used for Stacking.
     * Get PoX details
     */
    getPoxInfo(): Promise<CoreNodePoxResponse>;

    /**
     * Get Blockchain API status
     * @summary Get Blockchain API status
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof InfoApiInterface
     */
    getStatusRaw(): Promise<runtime.ApiResponse<void>>;

    /**
     * Get Blockchain API status
     * Get Blockchain API status
     */
    getStatus(): Promise<void>;

}

/**
 * 
 */
export class InfoApi extends runtime.BaseAPI implements InfoApiInterface {

    /**
     * Get Core API information
     * Get Core API info
     */
    async getCoreApiInfoRaw(): Promise<runtime.ApiResponse<CoreNodeInfoResponse>> {
        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        const response = await this.request({
            path: `/v2/info`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => CoreNodeInfoResponseFromJSON(jsonValue));
    }

    /**
     * Get Core API information
     * Get Core API info
     */
    async getCoreApiInfo(): Promise<CoreNodeInfoResponse> {
        const response = await this.getCoreApiInfoRaw();
        return await response.value();
    }

    /**
     * Get a given network\'s target block time
     */
    async getNetworkBlockTimeByNetworkRaw(requestParameters: GetNetworkBlockTimeByNetworkRequest): Promise<runtime.ApiResponse<NetworkBlockTimeResponse>> {
        if (requestParameters.network === null || requestParameters.network === undefined) {
            throw new runtime.RequiredError('network','Required parameter requestParameters.network was null or undefined when calling getNetworkBlockTimeByNetwork.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        const response = await this.request({
            path: `/extended/v1/info/network_block_time/{network}`.replace(`{${"network"}}`, encodeURIComponent(String(requestParameters.network))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => NetworkBlockTimeResponseFromJSON(jsonValue));
    }

    /**
     * Get a given network\'s target block time
     */
    async getNetworkBlockTimeByNetwork(requestParameters: GetNetworkBlockTimeByNetworkRequest): Promise<NetworkBlockTimeResponse> {
        const response = await this.getNetworkBlockTimeByNetworkRaw(requestParameters);
        return await response.value();
    }

    /**
     * Get the network target block time
     */
    async getNetworkBlockTimesRaw(): Promise<runtime.ApiResponse<NetworkBlockTimesResponse>> {
        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        const response = await this.request({
            path: `/extended/v1/info/network_block_times`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => NetworkBlockTimesResponseFromJSON(jsonValue));
    }

    /**
     * Get the network target block time
     */
    async getNetworkBlockTimes(): Promise<NetworkBlockTimesResponse> {
        const response = await this.getNetworkBlockTimesRaw();
        return await response.value();
    }

    /**
     * Get Proof of Transfer (PoX) information. Can be used for Stacking.
     * Get PoX details
     */
    async getPoxInfoRaw(): Promise<runtime.ApiResponse<CoreNodePoxResponse>> {
        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        const response = await this.request({
            path: `/v2/pox`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => CoreNodePoxResponseFromJSON(jsonValue));
    }

    /**
     * Get Proof of Transfer (PoX) information. Can be used for Stacking.
     * Get PoX details
     */
    async getPoxInfo(): Promise<CoreNodePoxResponse> {
        const response = await this.getPoxInfoRaw();
        return await response.value();
    }

    /**
     * Get Blockchain API status
     * Get Blockchain API status
     */
    async getStatusRaw(): Promise<runtime.ApiResponse<void>> {
        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        const response = await this.request({
            path: `/extended/v1/status`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Get Blockchain API status
     * Get Blockchain API status
     */
    async getStatus(): Promise<void> {
        await this.getStatusRaw();
    }

}

/**
    * @export
    * @enum {string}
    */
export enum GetNetworkBlockTimeByNetworkNetworkEnum {
    testnet = 'testnet',
    mainnet = 'mainnet'
}
