/* eslint-disable */
/* tslint:disable */
/*
 * ---------------------------------------------------------------
 * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API        ##
 * ##                                                           ##
 * ## AUTHOR: acacode                                           ##
 * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
 * ---------------------------------------------------------------
 */
export var TypesBlockIDFlag;
(function (TypesBlockIDFlag) {
    TypesBlockIDFlag["BLOCK_ID_FLAG_UNKNOWN"] = "BLOCK_ID_FLAG_UNKNOWN";
    TypesBlockIDFlag["BLOCK_ID_FLAG_ABSENT"] = "BLOCK_ID_FLAG_ABSENT";
    TypesBlockIDFlag["BLOCK_ID_FLAG_COMMIT"] = "BLOCK_ID_FLAG_COMMIT";
    TypesBlockIDFlag["BLOCK_ID_FLAG_NIL"] = "BLOCK_ID_FLAG_NIL";
})(TypesBlockIDFlag || (TypesBlockIDFlag = {}));
/**
* SignedMsgType is a type of signed message in the consensus.

 - SIGNED_MSG_TYPE_PREVOTE: Votes
 - SIGNED_MSG_TYPE_PROPOSAL: Proposals
*/
export var TypesSignedMsgType;
(function (TypesSignedMsgType) {
    TypesSignedMsgType["SIGNED_MSG_TYPE_UNKNOWN"] = "SIGNED_MSG_TYPE_UNKNOWN";
    TypesSignedMsgType["SIGNED_MSG_TYPE_PREVOTE"] = "SIGNED_MSG_TYPE_PREVOTE";
    TypesSignedMsgType["SIGNED_MSG_TYPE_PRECOMMIT"] = "SIGNED_MSG_TYPE_PRECOMMIT";
    TypesSignedMsgType["SIGNED_MSG_TYPE_PROPOSAL"] = "SIGNED_MSG_TYPE_PROPOSAL";
})(TypesSignedMsgType || (TypesSignedMsgType = {}));
import axios from "axios";
export var ContentType;
(function (ContentType) {
    ContentType["Json"] = "application/json";
    ContentType["FormData"] = "multipart/form-data";
    ContentType["UrlEncoded"] = "application/x-www-form-urlencoded";
})(ContentType || (ContentType = {}));
export class HttpClient {
    instance;
    securityData = null;
    securityWorker;
    secure;
    format;
    constructor({ securityWorker, secure, format, ...axiosConfig } = {}) {
        this.instance = axios.create({ ...axiosConfig, baseURL: axiosConfig.baseURL || "" });
        this.secure = secure;
        this.format = format;
        this.securityWorker = securityWorker;
    }
    setSecurityData = (data) => {
        this.securityData = data;
    };
    mergeRequestParams(params1, params2) {
        return {
            ...this.instance.defaults,
            ...params1,
            ...(params2 || {}),
            headers: {
                ...(this.instance.defaults.headers || {}),
                ...(params1.headers || {}),
                ...((params2 && params2.headers) || {}),
            },
        };
    }
    createFormData(input) {
        return Object.keys(input || {}).reduce((formData, key) => {
            const property = input[key];
            formData.append(key, property instanceof Blob
                ? property
                : typeof property === "object" && property !== null
                    ? JSON.stringify(property)
                    : `${property}`);
            return formData;
        }, new FormData());
    }
    request = async ({ secure, path, type, query, format, body, ...params }) => {
        const secureParams = ((typeof secure === "boolean" ? secure : this.secure) &&
            this.securityWorker &&
            (await this.securityWorker(this.securityData))) ||
            {};
        const requestParams = this.mergeRequestParams(params, secureParams);
        const responseFormat = (format && this.format) || void 0;
        if (type === ContentType.FormData && body && body !== null && typeof body === "object") {
            requestParams.headers.common = { Accept: "*/*" };
            requestParams.headers.post = {};
            requestParams.headers.put = {};
            body = this.createFormData(body);
        }
        return this.instance.request({
            ...requestParams,
            headers: {
                ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}),
                ...(requestParams.headers || {}),
            },
            params: query,
            responseType: responseFormat,
            data: body,
            url: path,
        });
    };
}
/**
 * @title cosmos/base/tendermint/v1beta1/query.proto
 * @version version not set
 */
export class Api extends HttpClient {
    /**
     * No description
     *
     * @tags Service
     * @name ServiceGetLatestBlock
     * @summary GetLatestBlock returns the latest block.
     * @request GET:/cosmos/base/tendermint/v1beta1/blocks/latest
     */
    serviceGetLatestBlock = (params = {}) => this.request({
        path: `/cosmos/base/tendermint/v1beta1/blocks/latest`,
        method: "GET",
        format: "json",
        ...params,
    });
    /**
     * No description
     *
     * @tags Service
     * @name ServiceGetBlockByHeight
     * @summary GetBlockByHeight queries block for given height.
     * @request GET:/cosmos/base/tendermint/v1beta1/blocks/{height}
     */
    serviceGetBlockByHeight = (height, params = {}) => this.request({
        path: `/cosmos/base/tendermint/v1beta1/blocks/${height}`,
        method: "GET",
        format: "json",
        ...params,
    });
    /**
     * No description
     *
     * @tags Service
     * @name ServiceGetNodeInfo
     * @summary GetNodeInfo queries the current node info.
     * @request GET:/cosmos/base/tendermint/v1beta1/node_info
     */
    serviceGetNodeInfo = (params = {}) => this.request({
        path: `/cosmos/base/tendermint/v1beta1/node_info`,
        method: "GET",
        format: "json",
        ...params,
    });
    /**
     * No description
     *
     * @tags Service
     * @name ServiceGetSyncing
     * @summary GetSyncing queries node syncing.
     * @request GET:/cosmos/base/tendermint/v1beta1/syncing
     */
    serviceGetSyncing = (params = {}) => this.request({
        path: `/cosmos/base/tendermint/v1beta1/syncing`,
        method: "GET",
        format: "json",
        ...params,
    });
    /**
     * No description
     *
     * @tags Service
     * @name ServiceGetLatestValidatorSet
     * @summary GetLatestValidatorSet queries latest validator-set.
     * @request GET:/cosmos/base/tendermint/v1beta1/validatorsets/latest
     */
    serviceGetLatestValidatorSet = (query, params = {}) => this.request({
        path: `/cosmos/base/tendermint/v1beta1/validatorsets/latest`,
        method: "GET",
        query: query,
        format: "json",
        ...params,
    });
    /**
     * No description
     *
     * @tags Service
     * @name ServiceGetValidatorSetByHeight
     * @summary GetValidatorSetByHeight queries validator-set at a given height.
     * @request GET:/cosmos/base/tendermint/v1beta1/validatorsets/{height}
     */
    serviceGetValidatorSetByHeight = (height, query, params = {}) => this.request({
        path: `/cosmos/base/tendermint/v1beta1/validatorsets/${height}`,
        method: "GET",
        query: query,
        format: "json",
        ...params,
    });
}
//# sourceMappingURL=rest.js.map