"use strict";
/* tslint:disable */
/* eslint-disable */
/**
 * Octane API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * 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.
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreditsApi = void 0;
const runtime = __importStar(require("../runtime"));
const models_1 = require("../models");
/**
 *
 */
class CreditsApi extends runtime.BaseAPI {
    /**
     * Returns all the credit grants under your account.
     * Get Credit Grants
     */
    async creditsGrantGetRaw(requestParameters, initOverrides) {
        if (requestParameters.listCreditGrantsArgs === null || requestParameters.listCreditGrantsArgs === undefined) {
            throw new runtime.RequiredError('listCreditGrantsArgs', 'Required parameter requestParameters.listCreditGrantsArgs was null or undefined when calling creditsGrantGet.');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("BearerApiKeyAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        const response = await this.request({
            path: `/credits/grant/`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
            body: (0, models_1.ListCreditGrantsArgsToJSON)(requestParameters.listCreditGrantsArgs),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, models_1.ListCreditGrantsFromJSON)(jsonValue));
    }
    /**
     * Returns all the credit grants under your account.
     * Get Credit Grants
     */
    async creditsGrantGet(requestParameters, initOverrides) {
        const response = await this.creditsGrantGetRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Deactivates a credit grant with the given grant UUID.
     * Void a Credit Grant
     */
    async creditsGrantGrantUuidVoidPostRaw(requestParameters, initOverrides) {
        if (requestParameters.grantUuid === null || requestParameters.grantUuid === undefined) {
            throw new runtime.RequiredError('grantUuid', 'Required parameter requestParameters.grantUuid was null or undefined when calling creditsGrantGrantUuidVoidPost.');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("BearerApiKeyAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        const response = await this.request({
            path: `/credits/grant/{grant_uuid}/void`.replace(`{${"grant_uuid"}}`, encodeURIComponent(String(requestParameters.grantUuid))),
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: (0, models_1.VoidCreditGrantArgsToJSON)(requestParameters.voidCreditGrantArgs),
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * Deactivates a credit grant with the given grant UUID.
     * Void a Credit Grant
     */
    async creditsGrantGrantUuidVoidPost(requestParameters, initOverrides) {
        await this.creditsGrantGrantUuidVoidPostRaw(requestParameters, initOverrides);
    }
    /**
     * Creates a credit grant for one of your customers.
     * Create a Credit Grant
     */
    async creditsGrantPostRaw(requestParameters, initOverrides) {
        if (requestParameters.createCreditGrantArgs === null || requestParameters.createCreditGrantArgs === undefined) {
            throw new runtime.RequiredError('createCreditGrantArgs', 'Required parameter requestParameters.createCreditGrantArgs was null or undefined when calling creditsGrantPost.');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("BearerApiKeyAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        const response = await this.request({
            path: `/credits/grant/`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: (0, models_1.CreateCreditGrantArgsToJSON)(requestParameters.createCreditGrantArgs),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, models_1.CreditGrantFromJSON)(jsonValue));
    }
    /**
     * Creates a credit grant for one of your customers.
     * Create a Credit Grant
     */
    async creditsGrantPost(requestParameters, initOverrides) {
        const response = await this.creditsGrantPostRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Returns the credit ledger for one of your customers.
     * Fetch a Credit Ledger
     */
    async creditsLedgerCustomerNameAsOfStrGetRaw(requestParameters, initOverrides) {
        if (requestParameters.asOfStr === null || requestParameters.asOfStr === undefined) {
            throw new runtime.RequiredError('asOfStr', 'Required parameter requestParameters.asOfStr was null or undefined when calling creditsLedgerCustomerNameAsOfStrGet.');
        }
        if (requestParameters.customerName === null || requestParameters.customerName === undefined) {
            throw new runtime.RequiredError('customerName', 'Required parameter requestParameters.customerName was null or undefined when calling creditsLedgerCustomerNameAsOfStrGet.');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("BearerApiKeyAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        const response = await this.request({
            path: `/credits/ledger/{customer_name}/{as_of_str}`.replace(`{${"as_of_str"}}`, encodeURIComponent(String(requestParameters.asOfStr))).replace(`{${"customer_name"}}`, encodeURIComponent(String(requestParameters.customerName))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(models_1.CreditLedgerFromJSON));
    }
    /**
     * Returns the credit ledger for one of your customers.
     * Fetch a Credit Ledger
     */
    async creditsLedgerCustomerNameAsOfStrGet(requestParameters, initOverrides) {
        const response = await this.creditsLedgerCustomerNameAsOfStrGetRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Returns the credit ledger for one of your customers.
     * Fetch a Credit Ledger
     */
    async creditsLedgerCustomerNameGetRaw(requestParameters, initOverrides) {
        if (requestParameters.customerName === null || requestParameters.customerName === undefined) {
            throw new runtime.RequiredError('customerName', 'Required parameter requestParameters.customerName was null or undefined when calling creditsLedgerCustomerNameGet.');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("BearerApiKeyAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        const response = await this.request({
            path: `/credits/ledger/{customer_name}/`.replace(`{${"customer_name"}}`, encodeURIComponent(String(requestParameters.customerName))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(models_1.CreditLedgerFromJSON));
    }
    /**
     * Returns the credit ledger for one of your customers.
     * Fetch a Credit Ledger
     */
    async creditsLedgerCustomerNameGet(requestParameters, initOverrides) {
        const response = await this.creditsLedgerCustomerNameGetRaw(requestParameters, initOverrides);
        return await response.value();
    }
}
exports.CreditsApi = CreditsApi;
//# sourceMappingURL=data:application/json;base64, 