"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.WebhooksApi = void 0;
const runtime = __importStar(require("../runtime"));
const models_1 = require("../models");
/**
 *
 */
class WebhooksApi extends runtime.BaseAPI {
    /**
     * Get all Webhooks for a given Vendor.
     * Get Webhooks
     */
    async webhooksGetRaw(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: `/webhooks/`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(models_1.WebhookFromJSON));
    }
    /**
     * Get all Webhooks for a given Vendor.
     * Get Webhooks
     */
    async webhooksGet(initOverrides) {
        const response = await this.webhooksGetRaw(initOverrides);
        return await response.value();
    }
    /**
     * Add an endpoint to use with Octane\'s Webhook API.
     * Add Webhook
     */
    async webhooksPostRaw(requestParameters, initOverrides) {
        if (requestParameters.createWebhookArgs === null || requestParameters.createWebhookArgs === undefined) {
            throw new runtime.RequiredError('createWebhookArgs', 'Required parameter requestParameters.createWebhookArgs was null or undefined when calling webhooksPost.');
        }
        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: `/webhooks/`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: (0, models_1.CreateWebhookArgsToJSON)(requestParameters.createWebhookArgs),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, models_1.WebhookFromJSON)(jsonValue));
    }
    /**
     * Add an endpoint to use with Octane\'s Webhook API.
     * Add Webhook
     */
    async webhooksPost(requestParameters, initOverrides) {
        const response = await this.webhooksPostRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Delete and unregister a webhook URL given its UUID.
     * Delete Webhook
     */
    async webhooksUuidDeleteRaw(requestParameters, initOverrides) {
        if (requestParameters.uuid === null || requestParameters.uuid === undefined) {
            throw new runtime.RequiredError('uuid', 'Required parameter requestParameters.uuid was null or undefined when calling webhooksUuidDelete.');
        }
        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: `/webhooks/{uuid}`.replace(`{${"uuid"}}`, encodeURIComponent(String(requestParameters.uuid))),
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * Delete and unregister a webhook URL given its UUID.
     * Delete Webhook
     */
    async webhooksUuidDelete(requestParameters, initOverrides) {
        await this.webhooksUuidDeleteRaw(requestParameters, initOverrides);
    }
    /**
     * Retrieve a webhook given its UUID.
     * Get Webhook
     */
    async webhooksUuidGetRaw(requestParameters, initOverrides) {
        if (requestParameters.uuid === null || requestParameters.uuid === undefined) {
            throw new runtime.RequiredError('uuid', 'Required parameter requestParameters.uuid was null or undefined when calling webhooksUuidGet.');
        }
        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: `/webhooks/{uuid}`.replace(`{${"uuid"}}`, encodeURIComponent(String(requestParameters.uuid))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, models_1.WebhookFromJSON)(jsonValue));
    }
    /**
     * Retrieve a webhook given its UUID.
     * Get Webhook
     */
    async webhooksUuidGet(requestParameters, initOverrides) {
        const response = await this.webhooksUuidGetRaw(requestParameters, initOverrides);
        return await response.value();
    }
}
exports.WebhooksApi = WebhooksApi;
//# sourceMappingURL=data:application/json;base64, 