/* eslint-disable */
/* tslint:disable */
/*
 * ---------------------------------------------------------------
 * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API        ##
 * ##                                                           ##
 * ## AUTHOR: acacode                                           ##
 * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
 * ---------------------------------------------------------------
 */
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/authz/v1beta1/authz.proto
 * @version version not set
 */
export class Api extends HttpClient {
    /**
     * No description
     *
     * @tags Query
     * @name QueryGrants
     * @summary Returns list of `Authorization`, granted to the grantee by the granter.
     * @request GET:/cosmos/authz/v1beta1/grants
     */
    queryGrants = (query, params = {}) => this.request({
        path: `/cosmos/authz/v1beta1/grants`,
        method: "GET",
        query: query,
        format: "json",
        ...params,
    });
    /**
     * @description Since: cosmos-sdk 0.45.2
     *
     * @tags Query
     * @name QueryGranteeGrants
     * @summary GranteeGrants returns a list of `GrantAuthorization` by grantee.
     * @request GET:/cosmos/authz/v1beta1/grants/grantee/{grantee}
     */
    queryGranteeGrants = (grantee, query, params = {}) => this.request({
        path: `/cosmos/authz/v1beta1/grants/grantee/${grantee}`,
        method: "GET",
        query: query,
        format: "json",
        ...params,
    });
    /**
     * @description Since: cosmos-sdk 0.45.2
     *
     * @tags Query
     * @name QueryGranterGrants
     * @summary GranterGrants returns list of `GrantAuthorization`, granted by granter.
     * @request GET:/cosmos/authz/v1beta1/grants/granter/{granter}
     */
    queryGranterGrants = (granter, query, params = {}) => this.request({
        path: `/cosmos/authz/v1beta1/grants/granter/${granter}`,
        method: "GET",
        query: query,
        format: "json",
        ...params,
    });
}
//# sourceMappingURL=rest.js.map