/* tslint:disable */
/* eslint-disable */
/**
 * Synapse REST API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: v1
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */
import * as runtime from '../runtime';
import { AddFileToDownloadListRequestToJSON, AddFileToDownloadListResponseFromJSON, AddPartResponseFromJSON, AsyncJobIdFromJSON, BatchFileHandleCopyRequestToJSON, BatchFileHandleCopyResultFromJSON, BatchFileRequestToJSON, BatchFileResultFromJSON, BatchPresignedUploadUrlRequestToJSON, BatchPresignedUploadUrlResponseFromJSON, BulkFileDownloadRequestToJSON, BulkFileDownloadResponseFromJSON, DownloadListFromJSON, DownloadOrderFromJSON, DownloadOrderSummaryRequestToJSON, DownloadOrderSummaryResponseFromJSON, ExternalFileHandleInterfaceFromJSON, ExternalFileHandleInterfaceToJSON, FileHandleFromJSON, FileHandleAssociationListToJSON, FileHandleRestoreRequestToJSON, FileHandleRestoreResponseFromJSON, GoogleCloudFileHandleFromJSON, GoogleCloudFileHandleToJSON, ListWrapperOfUploadDestinationLocationFromJSON, MultipartRequestToJSON, MultipartUploadStatusFromJSON, S3FileHandleFromJSON, S3FileHandleToJSON, UploadDestinationFromJSON, } from '../models/index';
/**
 *
 */
export class FileServicesApi extends runtime.BaseAPI {
    /**
     */
    async deleteFileV1DownloadListRaw(initOverrides) {
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/download/list`;
        const response = await this.request({
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async deleteFileV1DownloadList(initOverrides) {
        await this.deleteFileV1DownloadListRaw(initOverrides);
    }
    /**
     */
    async deleteFileV1FileHandleHandleIdRaw(requestParameters, initOverrides) {
        if (requestParameters['handleId'] == null) {
            throw new runtime.RequiredError('handleId', 'Required parameter "handleId" was null or undefined when calling deleteFileV1FileHandleHandleId().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/fileHandle/{handleId}`;
        urlPath = urlPath.replace(`{${"handleId"}}`, encodeURIComponent(String(requestParameters['handleId'])));
        const response = await this.request({
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async deleteFileV1FileHandleHandleId(requestParameters, initOverrides) {
        await this.deleteFileV1FileHandleHandleIdRaw(requestParameters, initOverrides);
    }
    /**
     */
    async deleteFileV1FileHandleHandleIdFilepreviewRaw(requestParameters, initOverrides) {
        if (requestParameters['handleId'] == null) {
            throw new runtime.RequiredError('handleId', 'Required parameter "handleId" was null or undefined when calling deleteFileV1FileHandleHandleIdFilepreview().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/fileHandle/{handleId}/filepreview`;
        urlPath = urlPath.replace(`{${"handleId"}}`, encodeURIComponent(String(requestParameters['handleId'])));
        const response = await this.request({
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async deleteFileV1FileHandleHandleIdFilepreview(requestParameters, initOverrides) {
        await this.deleteFileV1FileHandleHandleIdFilepreviewRaw(requestParameters, initOverrides);
    }
    /**
     */
    async getFileV1DownloadListRaw(initOverrides) {
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/download/list`;
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => DownloadListFromJSON(jsonValue));
    }
    /**
     */
    async getFileV1DownloadList(initOverrides) {
        const response = await this.getFileV1DownloadListRaw(initOverrides);
        return await response.value();
    }
    /**
     */
    async getFileV1DownloadListAddAsyncGetAsyncTokenRaw(requestParameters, initOverrides) {
        if (requestParameters['asyncToken'] == null) {
            throw new runtime.RequiredError('asyncToken', 'Required parameter "asyncToken" was null or undefined when calling getFileV1DownloadListAddAsyncGetAsyncToken().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/download/list/add/async/get/{asyncToken}`;
        urlPath = urlPath.replace(`{${"asyncToken"}}`, encodeURIComponent(String(requestParameters['asyncToken'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AddFileToDownloadListResponseFromJSON(jsonValue));
    }
    /**
     */
    async getFileV1DownloadListAddAsyncGetAsyncToken(requestParameters, initOverrides) {
        const response = await this.getFileV1DownloadListAddAsyncGetAsyncTokenRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getFileV1DownloadOrderOrderIdRaw(requestParameters, initOverrides) {
        if (requestParameters['orderId'] == null) {
            throw new runtime.RequiredError('orderId', 'Required parameter "orderId" was null or undefined when calling getFileV1DownloadOrderOrderId().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/download/order/{orderId}`;
        urlPath = urlPath.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => DownloadOrderFromJSON(jsonValue));
    }
    /**
     */
    async getFileV1DownloadOrderOrderId(requestParameters, initOverrides) {
        const response = await this.getFileV1DownloadOrderOrderIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getFileV1EntityIdUploadDestinationRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getFileV1EntityIdUploadDestination().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/entity/{id}/uploadDestination`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => UploadDestinationFromJSON(jsonValue));
    }
    /**
     */
    async getFileV1EntityIdUploadDestination(requestParameters, initOverrides) {
        const response = await this.getFileV1EntityIdUploadDestinationRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getFileV1EntityIdUploadDestinationLocationsRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getFileV1EntityIdUploadDestinationLocations().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/entity/{id}/uploadDestinationLocations`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => ListWrapperOfUploadDestinationLocationFromJSON(jsonValue));
    }
    /**
     */
    async getFileV1EntityIdUploadDestinationLocations(requestParameters, initOverrides) {
        const response = await this.getFileV1EntityIdUploadDestinationLocationsRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getFileV1EntityIdUploadDestinationStorageLocationIdRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getFileV1EntityIdUploadDestinationStorageLocationId().');
        }
        if (requestParameters['storageLocationId'] == null) {
            throw new runtime.RequiredError('storageLocationId', 'Required parameter "storageLocationId" was null or undefined when calling getFileV1EntityIdUploadDestinationStorageLocationId().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/entity/{id}/uploadDestination/{storageLocationId}`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        urlPath = urlPath.replace(`{${"storageLocationId"}}`, encodeURIComponent(String(requestParameters['storageLocationId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => UploadDestinationFromJSON(jsonValue));
    }
    /**
     */
    async getFileV1EntityIdUploadDestinationStorageLocationId(requestParameters, initOverrides) {
        const response = await this.getFileV1EntityIdUploadDestinationStorageLocationIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getFileV1FileBulkAsyncGetAsyncTokenRaw(requestParameters, initOverrides) {
        if (requestParameters['asyncToken'] == null) {
            throw new runtime.RequiredError('asyncToken', 'Required parameter "asyncToken" was null or undefined when calling getFileV1FileBulkAsyncGetAsyncToken().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/file/bulk/async/get/{asyncToken}`;
        urlPath = urlPath.replace(`{${"asyncToken"}}`, encodeURIComponent(String(requestParameters['asyncToken'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => BulkFileDownloadResponseFromJSON(jsonValue));
    }
    /**
     */
    async getFileV1FileBulkAsyncGetAsyncToken(requestParameters, initOverrides) {
        const response = await this.getFileV1FileBulkAsyncGetAsyncTokenRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getFileV1FileHandleHandleIdRaw(requestParameters, initOverrides) {
        if (requestParameters['handleId'] == null) {
            throw new runtime.RequiredError('handleId', 'Required parameter "handleId" was null or undefined when calling getFileV1FileHandleHandleId().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/fileHandle/{handleId}`;
        urlPath = urlPath.replace(`{${"handleId"}}`, encodeURIComponent(String(requestParameters['handleId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => FileHandleFromJSON(jsonValue));
    }
    /**
     */
    async getFileV1FileHandleHandleId(requestParameters, initOverrides) {
        const response = await this.getFileV1FileHandleHandleIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getFileV1FileHandleHandleIdUrlRaw(requestParameters, initOverrides) {
        if (requestParameters['handleId'] == null) {
            throw new runtime.RequiredError('handleId', 'Required parameter "handleId" was null or undefined when calling getFileV1FileHandleHandleIdUrl().');
        }
        const queryParameters = {};
        if (requestParameters['redirect'] != null) {
            queryParameters['redirect'] = requestParameters['redirect'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/fileHandle/{handleId}/url`;
        urlPath = urlPath.replace(`{${"handleId"}}`, encodeURIComponent(String(requestParameters['handleId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        if (this.isJsonMime(response.headers.get('content-type'))) {
            return new runtime.JSONApiResponse(response);
        }
        else {
            return new runtime.TextApiResponse(response);
        }
    }
    /**
     */
    async getFileV1FileHandleHandleIdUrl(requestParameters, initOverrides) {
        const response = await this.getFileV1FileHandleHandleIdUrlRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getFileV1FileHandleRestoreAsyncGetAsyncTokenRaw(requestParameters, initOverrides) {
        if (requestParameters['asyncToken'] == null) {
            throw new runtime.RequiredError('asyncToken', 'Required parameter "asyncToken" was null or undefined when calling getFileV1FileHandleRestoreAsyncGetAsyncToken().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/fileHandle/restore/async/get/{asyncToken}`;
        urlPath = urlPath.replace(`{${"asyncToken"}}`, encodeURIComponent(String(requestParameters['asyncToken'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => FileHandleRestoreResponseFromJSON(jsonValue));
    }
    /**
     */
    async getFileV1FileHandleRestoreAsyncGetAsyncToken(requestParameters, initOverrides) {
        const response = await this.getFileV1FileHandleRestoreAsyncGetAsyncTokenRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getFileV1FileIdRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getFileV1FileId().');
        }
        if (requestParameters['fileAssociateType'] == null) {
            throw new runtime.RequiredError('fileAssociateType', 'Required parameter "fileAssociateType" was null or undefined when calling getFileV1FileId().');
        }
        if (requestParameters['fileAssociateId'] == null) {
            throw new runtime.RequiredError('fileAssociateId', 'Required parameter "fileAssociateId" was null or undefined when calling getFileV1FileId().');
        }
        const queryParameters = {};
        if (requestParameters['redirect'] != null) {
            queryParameters['redirect'] = requestParameters['redirect'];
        }
        if (requestParameters['fileAssociateType'] != null) {
            queryParameters['fileAssociateType'] = requestParameters['fileAssociateType'];
        }
        if (requestParameters['fileAssociateId'] != null) {
            queryParameters['fileAssociateId'] = requestParameters['fileAssociateId'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/file/{id}`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        if (this.isJsonMime(response.headers.get('content-type'))) {
            return new runtime.JSONApiResponse(response);
        }
        else {
            return new runtime.TextApiResponse(response);
        }
    }
    /**
     */
    async getFileV1FileId(requestParameters, initOverrides) {
        const response = await this.getFileV1FileIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postFileV1DownloadListAddRaw(requestParameters, initOverrides) {
        if (requestParameters['fileHandleAssociationList'] == null) {
            throw new runtime.RequiredError('fileHandleAssociationList', 'Required parameter "fileHandleAssociationList" was null or undefined when calling postFileV1DownloadListAdd().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/download/list/add`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: FileHandleAssociationListToJSON(requestParameters['fileHandleAssociationList']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => DownloadListFromJSON(jsonValue));
    }
    /**
     */
    async postFileV1DownloadListAdd(requestParameters, initOverrides) {
        const response = await this.postFileV1DownloadListAddRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postFileV1DownloadListAddAsyncStartRaw(requestParameters, initOverrides) {
        if (requestParameters['addFileToDownloadListRequest'] == null) {
            throw new runtime.RequiredError('addFileToDownloadListRequest', 'Required parameter "addFileToDownloadListRequest" was null or undefined when calling postFileV1DownloadListAddAsyncStart().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/download/list/add/async/start`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: AddFileToDownloadListRequestToJSON(requestParameters['addFileToDownloadListRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AsyncJobIdFromJSON(jsonValue));
    }
    /**
     */
    async postFileV1DownloadListAddAsyncStart(requestParameters, initOverrides) {
        const response = await this.postFileV1DownloadListAddAsyncStartRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postFileV1DownloadListRemoveRaw(requestParameters, initOverrides) {
        if (requestParameters['fileHandleAssociationList'] == null) {
            throw new runtime.RequiredError('fileHandleAssociationList', 'Required parameter "fileHandleAssociationList" was null or undefined when calling postFileV1DownloadListRemove().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/download/list/remove`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: FileHandleAssociationListToJSON(requestParameters['fileHandleAssociationList']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => DownloadListFromJSON(jsonValue));
    }
    /**
     */
    async postFileV1DownloadListRemove(requestParameters, initOverrides) {
        const response = await this.postFileV1DownloadListRemoveRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postFileV1DownloadOrderRaw(requestParameters, initOverrides) {
        if (requestParameters['zipFileName'] == null) {
            throw new runtime.RequiredError('zipFileName', 'Required parameter "zipFileName" was null or undefined when calling postFileV1DownloadOrder().');
        }
        const queryParameters = {};
        if (requestParameters['zipFileName'] != null) {
            queryParameters['zipFileName'] = requestParameters['zipFileName'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/download/order`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => DownloadOrderFromJSON(jsonValue));
    }
    /**
     */
    async postFileV1DownloadOrder(requestParameters, initOverrides) {
        const response = await this.postFileV1DownloadOrderRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postFileV1DownloadOrderHistoryRaw(requestParameters, initOverrides) {
        if (requestParameters['downloadOrderSummaryRequest'] == null) {
            throw new runtime.RequiredError('downloadOrderSummaryRequest', 'Required parameter "downloadOrderSummaryRequest" was null or undefined when calling postFileV1DownloadOrderHistory().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/download/order/history`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: DownloadOrderSummaryRequestToJSON(requestParameters['downloadOrderSummaryRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => DownloadOrderSummaryResponseFromJSON(jsonValue));
    }
    /**
     */
    async postFileV1DownloadOrderHistory(requestParameters, initOverrides) {
        const response = await this.postFileV1DownloadOrderHistoryRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postFileV1ExternalFileHandleRaw(requestParameters, initOverrides) {
        if (requestParameters['externalFileHandleInterface'] == null) {
            throw new runtime.RequiredError('externalFileHandleInterface', 'Required parameter "externalFileHandleInterface" was null or undefined when calling postFileV1ExternalFileHandle().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/externalFileHandle`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: ExternalFileHandleInterfaceToJSON(requestParameters['externalFileHandleInterface']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => ExternalFileHandleInterfaceFromJSON(jsonValue));
    }
    /**
     */
    async postFileV1ExternalFileHandle(requestParameters, initOverrides) {
        const response = await this.postFileV1ExternalFileHandleRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postFileV1ExternalFileHandleGoogleCloudRaw(requestParameters, initOverrides) {
        if (requestParameters['googleCloudFileHandle'] == null) {
            throw new runtime.RequiredError('googleCloudFileHandle', 'Required parameter "googleCloudFileHandle" was null or undefined when calling postFileV1ExternalFileHandleGoogleCloud().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/externalFileHandle/googleCloud`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: GoogleCloudFileHandleToJSON(requestParameters['googleCloudFileHandle']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => GoogleCloudFileHandleFromJSON(jsonValue));
    }
    /**
     */
    async postFileV1ExternalFileHandleGoogleCloud(requestParameters, initOverrides) {
        const response = await this.postFileV1ExternalFileHandleGoogleCloudRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postFileV1ExternalFileHandleS3Raw(requestParameters, initOverrides) {
        if (requestParameters['s3FileHandle'] == null) {
            throw new runtime.RequiredError('s3FileHandle', 'Required parameter "s3FileHandle" was null or undefined when calling postFileV1ExternalFileHandleS3().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/externalFileHandle/s3`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: S3FileHandleToJSON(requestParameters['s3FileHandle']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => S3FileHandleFromJSON(jsonValue));
    }
    /**
     */
    async postFileV1ExternalFileHandleS3(requestParameters, initOverrides) {
        const response = await this.postFileV1ExternalFileHandleS3Raw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postFileV1FileBulkAsyncStartRaw(requestParameters, initOverrides) {
        if (requestParameters['bulkFileDownloadRequest'] == null) {
            throw new runtime.RequiredError('bulkFileDownloadRequest', 'Required parameter "bulkFileDownloadRequest" was null or undefined when calling postFileV1FileBulkAsyncStart().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/file/bulk/async/start`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: BulkFileDownloadRequestToJSON(requestParameters['bulkFileDownloadRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AsyncJobIdFromJSON(jsonValue));
    }
    /**
     */
    async postFileV1FileBulkAsyncStart(requestParameters, initOverrides) {
        const response = await this.postFileV1FileBulkAsyncStartRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postFileV1FileHandleBatchRaw(requestParameters, initOverrides) {
        if (requestParameters['batchFileRequest'] == null) {
            throw new runtime.RequiredError('batchFileRequest', 'Required parameter "batchFileRequest" was null or undefined when calling postFileV1FileHandleBatch().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/fileHandle/batch`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: BatchFileRequestToJSON(requestParameters['batchFileRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => BatchFileResultFromJSON(jsonValue));
    }
    /**
     */
    async postFileV1FileHandleBatch(requestParameters, initOverrides) {
        const response = await this.postFileV1FileHandleBatchRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postFileV1FileHandleHandleIdToCopyFromCopyRaw(requestParameters, initOverrides) {
        if (requestParameters['handleIdToCopyFrom'] == null) {
            throw new runtime.RequiredError('handleIdToCopyFrom', 'Required parameter "handleIdToCopyFrom" was null or undefined when calling postFileV1FileHandleHandleIdToCopyFromCopy().');
        }
        if (requestParameters['s3FileHandle'] == null) {
            throw new runtime.RequiredError('s3FileHandle', 'Required parameter "s3FileHandle" was null or undefined when calling postFileV1FileHandleHandleIdToCopyFromCopy().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/fileHandle/{handleIdToCopyFrom}/copy`;
        urlPath = urlPath.replace(`{${"handleIdToCopyFrom"}}`, encodeURIComponent(String(requestParameters['handleIdToCopyFrom'])));
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: S3FileHandleToJSON(requestParameters['s3FileHandle']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => S3FileHandleFromJSON(jsonValue));
    }
    /**
     */
    async postFileV1FileHandleHandleIdToCopyFromCopy(requestParameters, initOverrides) {
        const response = await this.postFileV1FileHandleHandleIdToCopyFromCopyRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postFileV1FileHandleRestoreAsyncStartRaw(requestParameters, initOverrides) {
        if (requestParameters['fileHandleRestoreRequest'] == null) {
            throw new runtime.RequiredError('fileHandleRestoreRequest', 'Required parameter "fileHandleRestoreRequest" was null or undefined when calling postFileV1FileHandleRestoreAsyncStart().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/fileHandle/restore/async/start`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: FileHandleRestoreRequestToJSON(requestParameters['fileHandleRestoreRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AsyncJobIdFromJSON(jsonValue));
    }
    /**
     */
    async postFileV1FileHandleRestoreAsyncStart(requestParameters, initOverrides) {
        const response = await this.postFileV1FileHandleRestoreAsyncStartRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postFileV1FileMultipartRaw(requestParameters, initOverrides) {
        if (requestParameters['multipartRequest'] == null) {
            throw new runtime.RequiredError('multipartRequest', 'Required parameter "multipartRequest" was null or undefined when calling postFileV1FileMultipart().');
        }
        const queryParameters = {};
        if (requestParameters['forceRestart'] != null) {
            queryParameters['forceRestart'] = requestParameters['forceRestart'];
        }
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/file/multipart`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: MultipartRequestToJSON(requestParameters['multipartRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => MultipartUploadStatusFromJSON(jsonValue));
    }
    /**
     */
    async postFileV1FileMultipart(requestParameters, initOverrides) {
        const response = await this.postFileV1FileMultipartRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postFileV1FileMultipartUploadIdPresignedUrlBatchRaw(requestParameters, initOverrides) {
        if (requestParameters['uploadId'] == null) {
            throw new runtime.RequiredError('uploadId', 'Required parameter "uploadId" was null or undefined when calling postFileV1FileMultipartUploadIdPresignedUrlBatch().');
        }
        if (requestParameters['batchPresignedUploadUrlRequest'] == null) {
            throw new runtime.RequiredError('batchPresignedUploadUrlRequest', 'Required parameter "batchPresignedUploadUrlRequest" was null or undefined when calling postFileV1FileMultipartUploadIdPresignedUrlBatch().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/file/multipart/{uploadId}/presigned/url/batch`;
        urlPath = urlPath.replace(`{${"uploadId"}}`, encodeURIComponent(String(requestParameters['uploadId'])));
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: BatchPresignedUploadUrlRequestToJSON(requestParameters['batchPresignedUploadUrlRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => BatchPresignedUploadUrlResponseFromJSON(jsonValue));
    }
    /**
     */
    async postFileV1FileMultipartUploadIdPresignedUrlBatch(requestParameters, initOverrides) {
        const response = await this.postFileV1FileMultipartUploadIdPresignedUrlBatchRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postFileV1FilehandlesCopyRaw(requestParameters, initOverrides) {
        if (requestParameters['batchFileHandleCopyRequest'] == null) {
            throw new runtime.RequiredError('batchFileHandleCopyRequest', 'Required parameter "batchFileHandleCopyRequest" was null or undefined when calling postFileV1FilehandlesCopy().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/filehandles/copy`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: BatchFileHandleCopyRequestToJSON(requestParameters['batchFileHandleCopyRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => BatchFileHandleCopyResultFromJSON(jsonValue));
    }
    /**
     */
    async postFileV1FilehandlesCopy(requestParameters, initOverrides) {
        const response = await this.postFileV1FilehandlesCopyRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putFileV1FileMultipartUploadIdAddPartNumberRaw(requestParameters, initOverrides) {
        if (requestParameters['uploadId'] == null) {
            throw new runtime.RequiredError('uploadId', 'Required parameter "uploadId" was null or undefined when calling putFileV1FileMultipartUploadIdAddPartNumber().');
        }
        if (requestParameters['partNumber'] == null) {
            throw new runtime.RequiredError('partNumber', 'Required parameter "partNumber" was null or undefined when calling putFileV1FileMultipartUploadIdAddPartNumber().');
        }
        if (requestParameters['partMD5Hex'] == null) {
            throw new runtime.RequiredError('partMD5Hex', 'Required parameter "partMD5Hex" was null or undefined when calling putFileV1FileMultipartUploadIdAddPartNumber().');
        }
        const queryParameters = {};
        if (requestParameters['partMD5Hex'] != null) {
            queryParameters['partMD5Hex'] = requestParameters['partMD5Hex'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/file/multipart/{uploadId}/add/{partNumber}`;
        urlPath = urlPath.replace(`{${"uploadId"}}`, encodeURIComponent(String(requestParameters['uploadId'])));
        urlPath = urlPath.replace(`{${"partNumber"}}`, encodeURIComponent(String(requestParameters['partNumber'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AddPartResponseFromJSON(jsonValue));
    }
    /**
     */
    async putFileV1FileMultipartUploadIdAddPartNumber(requestParameters, initOverrides) {
        const response = await this.putFileV1FileMultipartUploadIdAddPartNumberRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putFileV1FileMultipartUploadIdCompleteRaw(requestParameters, initOverrides) {
        if (requestParameters['uploadId'] == null) {
            throw new runtime.RequiredError('uploadId', 'Required parameter "uploadId" was null or undefined when calling putFileV1FileMultipartUploadIdComplete().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/file/v1/file/multipart/{uploadId}/complete`;
        urlPath = urlPath.replace(`{${"uploadId"}}`, encodeURIComponent(String(requestParameters['uploadId'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => MultipartUploadStatusFromJSON(jsonValue));
    }
    /**
     */
    async putFileV1FileMultipartUploadIdComplete(requestParameters, initOverrides) {
        const response = await this.putFileV1FileMultipartUploadIdCompleteRaw(requestParameters, initOverrides);
        return await response.value();
    }
}
//# sourceMappingURL=FileServicesApi.js.map