"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.CouponsApi = void 0;
const runtime = __importStar(require("../runtime"));
const models_1 = require("../models");
/**
 *
 */
class CouponsApi extends runtime.BaseAPI {
    /**
     * Apply a coupon to the provided customer.
     * Apply Coupon
     */
    async couponsApplyCouponPostRaw(requestParameters, initOverrides) {
        if (requestParameters.applyCouponInputArgs === null || requestParameters.applyCouponInputArgs === undefined) {
            throw new runtime.RequiredError('applyCouponInputArgs', 'Required parameter requestParameters.applyCouponInputArgs was null or undefined when calling couponsApplyCouponPost.');
        }
        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: `/coupons/apply_coupon`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: (0, models_1.ApplyCouponInputArgsToJSON)(requestParameters.applyCouponInputArgs),
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * Apply a coupon to the provided customer.
     * Apply Coupon
     */
    async couponsApplyCouponPost(requestParameters, initOverrides) {
        await this.couponsApplyCouponPostRaw(requestParameters, initOverrides);
    }
    /**
     * Delete a specific coupon for a vendor.
     * Delete Coupon
     */
    async couponsCouponNameDeleteRaw(requestParameters, initOverrides) {
        if (requestParameters.couponName === null || requestParameters.couponName === undefined) {
            throw new runtime.RequiredError('couponName', 'Required parameter requestParameters.couponName was null or undefined when calling couponsCouponNameDelete.');
        }
        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: `/coupons/{coupon_name}`.replace(`{${"coupon_name"}}`, encodeURIComponent(String(requestParameters.couponName))),
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * Delete a specific coupon for a vendor.
     * Delete Coupon
     */
    async couponsCouponNameDelete(requestParameters, initOverrides) {
        await this.couponsCouponNameDeleteRaw(requestParameters, initOverrides);
    }
    /**
     * Get a specific coupon for a vendor.
     * Get Coupon
     */
    async couponsCouponNameGetRaw(requestParameters, initOverrides) {
        if (requestParameters.couponName === null || requestParameters.couponName === undefined) {
            throw new runtime.RequiredError('couponName', 'Required parameter requestParameters.couponName was null or undefined when calling couponsCouponNameGet.');
        }
        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: `/coupons/{coupon_name}`.replace(`{${"coupon_name"}}`, encodeURIComponent(String(requestParameters.couponName))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, models_1.CouponFromJSON)(jsonValue));
    }
    /**
     * Get a specific coupon for a vendor.
     * Get Coupon
     */
    async couponsCouponNameGet(requestParameters, initOverrides) {
        const response = await this.couponsCouponNameGetRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Gets all coupons for a specific vendor.
     * Get Coupons
     */
    async couponsGetRaw(initOverrides) {
        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: `/coupons/`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(models_1.CouponFromJSON));
    }
    /**
     * Gets all coupons for a specific vendor.
     * Get Coupons
     */
    async couponsGet(initOverrides) {
        const response = await this.couponsGetRaw(initOverrides);
        return await response.value();
    }
    /**
     * Create a coupon for a vendor.
     * Create Coupons
     */
    async couponsPostRaw(requestParameters, initOverrides) {
        if (requestParameters.couponInputArgs === null || requestParameters.couponInputArgs === undefined) {
            throw new runtime.RequiredError('couponInputArgs', 'Required parameter requestParameters.couponInputArgs was null or undefined when calling couponsPost.');
        }
        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: `/coupons/`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: (0, models_1.CouponInputArgsToJSON)(requestParameters.couponInputArgs),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, models_1.CouponFromJSON)(jsonValue));
    }
    /**
     * Create a coupon for a vendor.
     * Create Coupons
     */
    async couponsPost(requestParameters, initOverrides) {
        const response = await this.couponsPostRaw(requestParameters, initOverrides);
        return await response.value();
    }
}
exports.CouponsApi = CouponsApi;
//# sourceMappingURL=data:application/json;base64, 