"use strict";
/* tslint:disable */
/* eslint-disable */
/**
 * Montelo
 * Documentation for the Montelo API.
 *
 * The version of the OpenAPI document: 1.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;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (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.DatasetApi = void 0;
const runtime = __importStar(require("../runtime"));
const index_1 = require("../models/index");
/**
 *
 */
class DatasetApi extends runtime.BaseAPI {
    /**
     */
    async datasetControllerCreateDatasetRaw(requestParameters, initOverrides) {
        if (requestParameters.envId === null || requestParameters.envId === undefined) {
            throw new runtime.RequiredError('envId', 'Required parameter requestParameters.envId was null or undefined when calling datasetControllerCreateDataset.');
        }
        if (requestParameters.createDatasetInput === null || requestParameters.createDatasetInput === undefined) {
            throw new runtime.RequiredError('createDatasetInput', 'Required parameter requestParameters.createDatasetInput was null or undefined when calling datasetControllerCreateDataset.');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearer", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        const response = await this.request({
            path: `/env/{envId}/dataset`.replace(`{${"envId"}}`, encodeURIComponent(String(requestParameters.envId))),
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: (0, index_1.CreateDatasetInputToJSON)(requestParameters.createDatasetInput),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.DatasetDtoFromJSON)(jsonValue));
    }
    /**
     */
    async datasetControllerCreateDataset(requestParameters, initOverrides) {
        const response = await this.datasetControllerCreateDatasetRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async datasetControllerDeleteDatasetRaw(requestParameters, initOverrides) {
        if (requestParameters.datasetId === null || requestParameters.datasetId === undefined) {
            throw new runtime.RequiredError('datasetId', 'Required parameter requestParameters.datasetId was null or undefined when calling datasetControllerDeleteDataset.');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearer", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        const response = await this.request({
            path: `/dataset/{datasetId}`.replace(`{${"datasetId"}}`, encodeURIComponent(String(requestParameters.datasetId))),
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.DeleteSuccessDtoFromJSON)(jsonValue));
    }
    /**
     */
    async datasetControllerDeleteDataset(requestParameters, initOverrides) {
        const response = await this.datasetControllerDeleteDatasetRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async datasetControllerDownloadDatasetRaw(requestParameters, initOverrides) {
        if (requestParameters.datasetId === null || requestParameters.datasetId === undefined) {
            throw new runtime.RequiredError('datasetId', 'Required parameter requestParameters.datasetId was null or undefined when calling datasetControllerDownloadDataset.');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearer", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        const response = await this.request({
            path: `/dataset/{datasetId}/download`.replace(`{${"datasetId"}}`, encodeURIComponent(String(requestParameters.datasetId))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async datasetControllerDownloadDataset(requestParameters, initOverrides) {
        await this.datasetControllerDownloadDatasetRaw(requestParameters, initOverrides);
    }
    /**
     */
    async datasetControllerGetAllDatasetsForEnvRaw(requestParameters, initOverrides) {
        if (requestParameters.envId === null || requestParameters.envId === undefined) {
            throw new runtime.RequiredError('envId', 'Required parameter requestParameters.envId was null or undefined when calling datasetControllerGetAllDatasetsForEnv.');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearer", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        const response = await this.request({
            path: `/env/{envId}/dataset`.replace(`{${"envId"}}`, encodeURIComponent(String(requestParameters.envId))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(index_1.DatasetDtoFromJSON));
    }
    /**
     */
    async datasetControllerGetAllDatasetsForEnv(requestParameters, initOverrides) {
        const response = await this.datasetControllerGetAllDatasetsForEnvRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async datasetControllerGetDatasetRecentExperimentsRaw(requestParameters, initOverrides) {
        if (requestParameters.datasetId === null || requestParameters.datasetId === undefined) {
            throw new runtime.RequiredError('datasetId', 'Required parameter requestParameters.datasetId was null or undefined when calling datasetControllerGetDatasetRecentExperiments.');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearer", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        const response = await this.request({
            path: `/dataset/{datasetId}/experiments`.replace(`{${"datasetId"}}`, encodeURIComponent(String(requestParameters.datasetId))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(index_1.ExperimentDtoFromJSON));
    }
    /**
     */
    async datasetControllerGetDatasetRecentExperiments(requestParameters, initOverrides) {
        const response = await this.datasetControllerGetDatasetRecentExperimentsRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async datasetControllerGetDatasetWithDatapointsRaw(requestParameters, initOverrides) {
        if (requestParameters.datasetId === null || requestParameters.datasetId === undefined) {
            throw new runtime.RequiredError('datasetId', 'Required parameter requestParameters.datasetId was null or undefined when calling datasetControllerGetDatasetWithDatapoints.');
        }
        const queryParameters = {};
        if (requestParameters.take !== undefined) {
            queryParameters['take'] = requestParameters.take;
        }
        if (requestParameters.skip !== undefined) {
            queryParameters['skip'] = requestParameters.skip;
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearer", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        const response = await this.request({
            path: `/dataset/{datasetId}`.replace(`{${"datasetId"}}`, encodeURIComponent(String(requestParameters.datasetId))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.FullDatasetWithCountDtoFromJSON)(jsonValue));
    }
    /**
     */
    async datasetControllerGetDatasetWithDatapoints(requestParameters, initOverrides) {
        const response = await this.datasetControllerGetDatasetWithDatapointsRaw(requestParameters, initOverrides);
        return await response.value();
    }
}
exports.DatasetApi = DatasetApi;
