"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.MetersApi = void 0;
const runtime = __importStar(require("../runtime"));
const models_1 = require("../models");
/**
 *
 */
class MetersApi extends runtime.BaseAPI {
    /**
     * Get all meters for a given vendor.
     * Get Meters
     */
    async metersGetRaw(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: `/meters/`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(models_1.MeterFromJSON));
    }
    /**
     * Get all meters for a given vendor.
     * Get Meters
     */
    async metersGet(initOverrides) {
        const response = await this.metersGetRaw(initOverrides);
        return await response.value();
    }
    /**
     * Update a meter by its unique name.
     * Archive Meter
     */
    async metersMeterNameArchivePostRaw(requestParameters, initOverrides) {
        if (requestParameters.meterName === null || requestParameters.meterName === undefined) {
            throw new runtime.RequiredError('meterName', 'Required parameter requestParameters.meterName was null or undefined when calling metersMeterNameArchivePost.');
        }
        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: `/meters/{meter_name}/archive`.replace(`{${"meter_name"}}`, encodeURIComponent(String(requestParameters.meterName))),
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * Update a meter by its unique name.
     * Archive Meter
     */
    async metersMeterNameArchivePost(requestParameters, initOverrides) {
        await this.metersMeterNameArchivePostRaw(requestParameters, initOverrides);
    }
    /**
     * Delete a meter by its unique name. Meters can only be deleted if not in-use by a price plan.
     * Delete Meter
     */
    async metersMeterNameDeleteRaw(requestParameters, initOverrides) {
        if (requestParameters.meterName === null || requestParameters.meterName === undefined) {
            throw new runtime.RequiredError('meterName', 'Required parameter requestParameters.meterName was null or undefined when calling metersMeterNameDelete.');
        }
        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: `/meters/{meter_name}`.replace(`{${"meter_name"}}`, encodeURIComponent(String(requestParameters.meterName))),
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * Delete a meter by its unique name. Meters can only be deleted if not in-use by a price plan.
     * Delete Meter
     */
    async metersMeterNameDelete(requestParameters, initOverrides) {
        await this.metersMeterNameDeleteRaw(requestParameters, initOverrides);
    }
    /**
     * Get a meter by its unique name.
     * Get Meter
     */
    async metersMeterNameGetRaw(requestParameters, initOverrides) {
        if (requestParameters.meterName === null || requestParameters.meterName === undefined) {
            throw new runtime.RequiredError('meterName', 'Required parameter requestParameters.meterName was null or undefined when calling metersMeterNameGet.');
        }
        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: `/meters/{meter_name}`.replace(`{${"meter_name"}}`, encodeURIComponent(String(requestParameters.meterName))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, models_1.MeterFromJSON)(jsonValue));
    }
    /**
     * Get a meter by its unique name.
     * Get Meter
     */
    async metersMeterNameGet(requestParameters, initOverrides) {
        const response = await this.metersMeterNameGetRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Update a meter by its unique name.
     * Update Meter
     */
    async metersMeterNamePutRaw(requestParameters, initOverrides) {
        if (requestParameters.meterName === null || requestParameters.meterName === undefined) {
            throw new runtime.RequiredError('meterName', 'Required parameter requestParameters.meterName was null or undefined when calling metersMeterNamePut.');
        }
        if (requestParameters.updateMeterArgs === null || requestParameters.updateMeterArgs === undefined) {
            throw new runtime.RequiredError('updateMeterArgs', 'Required parameter requestParameters.updateMeterArgs was null or undefined when calling metersMeterNamePut.');
        }
        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: `/meters/{meter_name}`.replace(`{${"meter_name"}}`, encodeURIComponent(String(requestParameters.meterName))),
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: (0, models_1.UpdateMeterArgsToJSON)(requestParameters.updateMeterArgs),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, models_1.MeterFromJSON)(jsonValue));
    }
    /**
     * Update a meter by its unique name.
     * Update Meter
     */
    async metersMeterNamePut(requestParameters, initOverrides) {
        const response = await this.metersMeterNamePutRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Create a new meter for a given vendor.
     * Create Meter
     */
    async metersPostRaw(requestParameters, initOverrides) {
        if (requestParameters.createMeterArgs === null || requestParameters.createMeterArgs === undefined) {
            throw new runtime.RequiredError('createMeterArgs', 'Required parameter requestParameters.createMeterArgs was null or undefined when calling metersPost.');
        }
        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: `/meters/`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: (0, models_1.CreateMeterArgsToJSON)(requestParameters.createMeterArgs),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, models_1.MeterFromJSON)(jsonValue));
    }
    /**
     * Create a new meter for a given vendor.
     * Create Meter
     */
    async metersPost(requestParameters, initOverrides) {
        const response = await this.metersPostRaw(requestParameters, initOverrides);
        return await response.value();
    }
}
exports.MetersApi = MetersApi;
//# sourceMappingURL=data:application/json;base64, 