"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateFile = exports.bulkPublishDraftFiles = exports.listDeletedFiles = exports.bulkRestoreFilesFromTrashBin = exports.bulkDeleteFiles = exports.generateWebSocketToken = exports.generateVideoStreamingUrl = exports.searchFiles = exports.listFiles = exports.bulkImportFile = exports.bulkImportFiles = exports.importFile = exports.generateFileResumableUploadUrl = exports.generateFileUploadUrl = exports.updateFileDescriptor = exports.getFileDescriptors = exports.getFileDescriptor = exports.generateFileDownloadUrl = exports.generateFilesDownloadUrl = exports.bulkAnnotateImages = void 0;
var metro_runtime_1 = require("@wix/metro-runtime");
var ambassador_1 = require("@wix/metro-runtime/ambassador");
var metro_runtime_2 = require("@wix/metro-runtime");
var _archive = { urlExpirationDate: 'google.protobuf.Timestamp' };
var _audio = { urlExpirationDate: 'google.protobuf.Timestamp' };
var _audioV2 = { assets: '_audio' };
var _bulkAnnotateImageResult = { item: '_fileDescriptor' };
var _bulkAnnotateImagesRequest = {};
var _bulkAnnotateImagesResponse = { results: '_bulkAnnotateImageResult' };
var _bulkDeleteFilesRequest = {};
var _bulkDeleteFilesResponse = {};
var _bulkImportFileRequest = { importFileRequests: '_importFileRequest' };
var _bulkImportFileResponse = { results: '_bulkImportFileResult' };
var _bulkImportFileResult = { item: '_fileDescriptor' };
var _bulkImportFilesRequest = { importFileRequests: '_importFileRequest' };
var _bulkImportFilesResponse = { files: '_fileDescriptor' };
var _bulkPublishDraftFileResult = { item: '_fileDescriptor' };
var _bulkPublishDraftFilesRequest = {};
var _bulkPublishDraftFilesResponse = {
    results: '_bulkPublishDraftFileResult',
};
var _bulkRestoreFilesFromTrashBinRequest = {};
var _bulkRestoreFilesFromTrashBinResponse = {};
var _document = {
    urlExpirationDate: 'google.protobuf.Timestamp',
    thumbnail: '_image',
};
var _faceRecognition = { confidence: 'DOUBLE' };
var _fileDescriptor = {
    createdDate: 'google.protobuf.Timestamp',
    updatedDate: 'google.protobuf.Timestamp',
    lastUsedDate: 'google.protobuf.Timestamp',
    media: '_fileMedia',
};
var _fileMedia = {
    image: '_imageMedia',
    video: '_videoV2',
    audio: '_audioV2',
    document: '_document',
    vector: '_imageMedia',
    archive: '_archive',
    model3d: '_model3D',
    icon: '_imageMedia',
};
var _focalPoint = { x: 'DOUBLE', y: 'DOUBLE' };
var _generateFileDownloadUrlRequest = {};
var _generateFileDownloadUrlResponse = {};
var _generateFileResumableUploadUrlRequest = {};
var _generateFileResumableUploadUrlResponse = {};
var _generateFilesDownloadUrlRequest = {};
var _generateFilesDownloadUrlResponse = {};
var _generateFileUploadUrlRequest = {};
var _generateFileUploadUrlResponse = {};
var _generateVideoStreamingUrlRequest = {};
var _generateVideoStreamingUrlResponse = {};
var _generateWebSocketTokenRequest = {};
var _generateWebSocketTokenResponse = {};
var _getFileDescriptorRequest = {};
var _getFileDescriptorResponse = { file: '_fileDescriptor' };
var _getFileDescriptorsRequest = {};
var _getFileDescriptorsResponse = { files: '_fileDescriptor' };
var _image = {
    urlExpirationDate: 'google.protobuf.Timestamp',
    focalPoint: '_focalPoint',
};
var _imageMedia = {
    image: '_image',
    faces: '_faceRecognition',
    previewImage: '_image',
};
var _importFileRequest = {};
var _importFileResponse = { file: '_fileDescriptor' };
var _listDeletedFilesRequest = {};
var _listDeletedFilesResponse = { files: '_fileDescriptor' };
var _listFilesRequest = {};
var _listFilesResponse = { files: '_fileDescriptor' };
var _model3D = {
    urlExpirationDate: 'google.protobuf.Timestamp',
    thumbnail: '_image',
};
var _searchFilesRequest = {};
var _searchFilesResponse = { files: '_fileDescriptor' };
var _updateFileDescriptorRequest = {
    fieldMask: 'google.protobuf.FieldMask',
    file: '_fileDescriptor',
};
var _updateFileDescriptorResponse = { file: '_fileDescriptor' };
var _updateFileRequest = {};
var _updateFileResponse = { file: '_fileDescriptor' };
var _videoResolution = {
    urlExpirationDate: 'google.protobuf.Timestamp',
    poster: '_image',
};
var _videoV2 = {
    urlExpirationDate: 'google.protobuf.Timestamp',
    resolutions: '_videoResolution',
    posters: '_image',
};
function resolveComWixMediaSiteMediaV1FilesServiceUrl(opts) {
    var domainToMappings = {
        'apps._base_domain_': [
            {
                srcPath: '/_api/wix-privatemedia-proxy-server',
                destPath: '/api',
            },
            {
                srcPath: '/_api/wix-privatemedia-proxy-server/v1',
                destPath: '/v1',
            },
        ],
        'manage._base_domain_': [
            {
                srcPath: '/_api/wix-privatemedia-proxy-server',
                destPath: '',
            },
        ],
        'www.wixapis.com': [
            {
                srcPath: '/site-media/v1',
                destPath: '/v1',
            },
        ],
        '*.dev.wix-code.com': [
            {
                srcPath: '/_api/wix-privatemedia-proxy-server',
                destPath: '',
            },
        ],
        'api._api_base_domain_': [
            {
                srcPath: '/wix-privatemedia-proxy-server',
                destPath: '',
            },
        ],
        'bo._base_domain_': [
            {
                srcPath: '/wix-privatemedia-proxy-server',
                destPath: '',
            },
        ],
        'wixbo.ai': [
            {
                srcPath: '/wix-privatemedia-proxy-server',
                destPath: '',
            },
        ],
        'wix-bo.com': [
            {
                srcPath: '/wix-privatemedia-proxy-server',
                destPath: '',
            },
        ],
        _: [
            {
                srcPath: '/wix-privatemedia-proxy-server',
                destPath: '',
            },
        ],
        'editor._base_domain_': [
            {
                srcPath: '/_api/wix-privatemedia-proxy-server',
                destPath: '',
            },
        ],
        'blocks._base_domain_': [
            {
                srcPath: '/_api/wix-privatemedia-proxy-server',
                destPath: '',
            },
        ],
        'create.editorx': [
            {
                srcPath: '/_api/wix-privatemedia-proxy-server',
                destPath: '',
            },
        ],
        'platform.rise.ai': [
            {
                srcPath: '/_api/wix-privatemedia-proxy-server',
                destPath: '',
            },
        ],
    };
    return (0, metro_runtime_2.resolveUrl)(Object.assign(opts, { domainToMappings: domainToMappings }));
}
/**
 * Run Image Annotation process on provided list of file ids
 * Note - the processes of this endpoint are synchronous and may take time to complete
 */
function bulkAnnotateImages(payload) {
    var _a = (0, ambassador_1.serializer)(_bulkAnnotateImagesRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = (0, ambassador_1.serializer)(_bulkAnnotateImagesResponse, {
        _archive: _archive,
        _audio: _audio,
        _audioV2: _audioV2,
        _bulkAnnotateImageResult: _bulkAnnotateImageResult,
        _document: _document,
        _faceRecognition: _faceRecognition,
        _fileDescriptor: _fileDescriptor,
        _fileMedia: _fileMedia,
        _focalPoint: _focalPoint,
        _image: _image,
        _imageMedia: _imageMedia,
        _model3D: _model3D,
        _videoResolution: _videoResolution,
        _videoV2: _videoV2,
    }).fromJSON;
    function __bulkAnnotateImages(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.media.site_media.v1.file_descriptor',
            method: 'POST',
            methodFqn: 'com.wix.media.site_media.v1.FilesService.BulkAnnotateImages',
            url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                protoPath: '/v1/bulk/files/images/annotate',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __bulkAnnotateImages.fromReq = fromReq;
    __bulkAnnotateImages.__isAmbassador = true;
    return __bulkAnnotateImages;
}
exports.bulkAnnotateImages = bulkAnnotateImages;
/**
 * Generates a URL for downloading a compressed file containing specific files in the Media Manager.
 *
 * The compressed file can contain up to 1000 files.
 *
 * To generate a permanent URL for downloading a compressed file that contains multiple files in the Media Manager, call the Generate Files Download URL endpoint.
 * Since this is a permanent URL, it is less secure.
 * Therefore, to download private files, call the Generate File Download URL endpoint for each private file that you want to generate a download URL for.
 */
function generateFilesDownloadUrl(payload) {
    var _a = (0, ambassador_1.serializer)(_generateFilesDownloadUrlRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = (0, ambassador_1.serializer)(_generateFilesDownloadUrlResponse, {}).fromJSON;
    function __generateFilesDownloadUrl(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.media.site_media.v1.file_descriptor',
            method: 'POST',
            methodFqn: 'com.wix.media.site_media.v1.FilesService.GenerateFilesDownloadUrl',
            url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                protoPath: '/v1/files/generate-download-url',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __generateFilesDownloadUrl.fromReq = fromReq;
    __generateFilesDownloadUrl.__isAmbassador = true;
    return __generateFilesDownloadUrl;
}
exports.generateFilesDownloadUrl = generateFilesDownloadUrl;
/**
 * Generates one or more temporary URLs for downloading a specific file in the Media Manager.
 *
 * To download different assets of the file, specify the `assetKeys` parameter which generates a download URL for each asset.
 * If no `assetKey` is specified, it defaults to `src`, which generates one download URL in the original file's format and quality.
 *
 * Call this endpoint to grant external clients access to a private media file. Specify the `expirationInMinutes` parameter to set the URL expiration time, and the `expirationRedirectUrl` parameter to add a redirect url when the URL expires.
 *
 * To generate a permanent URL for downloading a compressed file that contains multiple files in the Media Manager, call the Generate Files Download URL endpoint.
 * Since this is a permanent URL, it is less secure.
 * Therefore, to download private files, call the Generate File Download URL endpoint for each private file that you want to generate a download URL for.
 */
function generateFileDownloadUrl(payload) {
    var _a = (0, ambassador_1.serializer)(_generateFileDownloadUrlRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = (0, ambassador_1.serializer)(_generateFileDownloadUrlResponse, {}).fromJSON;
    function __generateFileDownloadUrl(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.media.site_media.v1.file_descriptor',
            method: 'POST',
            methodFqn: 'com.wix.media.site_media.v1.FilesService.GenerateFileDownloadUrl',
            url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                protoPath: '/v1/files/generate-file-download-url',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __generateFileDownloadUrl.fromReq = fromReq;
    __generateFileDownloadUrl.__isAmbassador = true;
    return __generateFileDownloadUrl;
}
exports.generateFileDownloadUrl = generateFileDownloadUrl;
/** Gets information about a specific file in the Media Manager. */
function getFileDescriptor(payload) {
    var _a = (0, ambassador_1.serializer)(_getFileDescriptorRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = (0, ambassador_1.serializer)(_getFileDescriptorResponse, {
        _archive: _archive,
        _audio: _audio,
        _audioV2: _audioV2,
        _document: _document,
        _faceRecognition: _faceRecognition,
        _fileDescriptor: _fileDescriptor,
        _fileMedia: _fileMedia,
        _focalPoint: _focalPoint,
        _image: _image,
        _imageMedia: _imageMedia,
        _model3D: _model3D,
        _videoResolution: _videoResolution,
        _videoV2: _videoV2,
    }).fromJSON;
    function __getFileDescriptor(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.media.site_media.v1.file_descriptor',
            method: 'GET',
            methodFqn: 'com.wix.media.site_media.v1.FilesService.GetFileDescriptor',
            url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                protoPath: '/v1/files/get-file-by-id',
                data: serializedData,
                host: host,
            }),
            params: (0, metro_runtime_1.toURLSearchParams)(serializedData),
            transformResponse: fromRes,
            fallback: [
                {
                    method: 'GET',
                    url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                        protoPath: '/v1/files/get-file-by-id',
                        data: serializedData,
                        host: host,
                    }),
                    params: (0, metro_runtime_1.toURLSearchParams)(serializedData),
                },
            ],
        };
        return metadata;
    }
    __getFileDescriptor.fromReq = fromReq;
    __getFileDescriptor.__isAmbassador = true;
    return __getFileDescriptor;
}
exports.getFileDescriptor = getFileDescriptor;
/** Gets information about specific files in the Media Manager. */
function getFileDescriptors(payload) {
    var _a = (0, ambassador_1.serializer)(_getFileDescriptorsRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = (0, ambassador_1.serializer)(_getFileDescriptorsResponse, {
        _archive: _archive,
        _audio: _audio,
        _audioV2: _audioV2,
        _document: _document,
        _faceRecognition: _faceRecognition,
        _fileDescriptor: _fileDescriptor,
        _fileMedia: _fileMedia,
        _focalPoint: _focalPoint,
        _image: _image,
        _imageMedia: _imageMedia,
        _model3D: _model3D,
        _videoResolution: _videoResolution,
        _videoV2: _videoV2,
    }).fromJSON;
    function __getFileDescriptors(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.media.site_media.v1.file_descriptor',
            method: 'POST',
            methodFqn: 'com.wix.media.site_media.v1.FilesService.GetFileDescriptors',
            url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                protoPath: '/v1/files/get-files',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __getFileDescriptors.fromReq = fromReq;
    __getFileDescriptors.__isAmbassador = true;
    return __getFileDescriptors;
}
exports.getFileDescriptors = getFileDescriptors;
/**
 * Updates a file. <br />
 *
 * Specify the `parentFolderId` parameter to move a file from its current folder to a different folder.
 */
function updateFileDescriptor(payload) {
    var _a = (0, ambassador_1.serializer)(_updateFileDescriptorRequest, {
        _archive: _archive,
        _audio: _audio,
        _audioV2: _audioV2,
        _document: _document,
        _faceRecognition: _faceRecognition,
        _fileDescriptor: _fileDescriptor,
        _fileMedia: _fileMedia,
        _focalPoint: _focalPoint,
        _image: _image,
        _imageMedia: _imageMedia,
        _model3D: _model3D,
        _videoResolution: _videoResolution,
        _videoV2: _videoV2,
    }), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = (0, ambassador_1.serializer)(_updateFileDescriptorResponse, {
        _archive: _archive,
        _audio: _audio,
        _audioV2: _audioV2,
        _document: _document,
        _faceRecognition: _faceRecognition,
        _fileDescriptor: _fileDescriptor,
        _fileMedia: _fileMedia,
        _focalPoint: _focalPoint,
        _image: _image,
        _imageMedia: _imageMedia,
        _model3D: _model3D,
        _videoResolution: _videoResolution,
        _videoV2: _videoV2,
    }).fromJSON;
    function __updateFileDescriptor(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.media.site_media.v1.file_descriptor',
            method: 'PATCH',
            methodFqn: 'com.wix.media.site_media.v1.FilesService.UpdateFileDescriptor',
            url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                protoPath: '/v1/files/update-file-descriptor',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __updateFileDescriptor.fromReq = fromReq;
    __updateFileDescriptor.__isAmbassador = true;
    return __updateFileDescriptor;
}
exports.updateFileDescriptor = updateFileDescriptor;
/**
 * Generates an upload URL to allow external clients to upload a file to the Media Manager. <br/>
 *
 * To learn how external clients can use the generated upload URL in the response to upload a file to the Media Manager, see Upload API ([SDK](https://dev.wix.com/docs/sdk/backend-modules/media/files/upload-api) | [REST](https://dev.wix.com/docs/rest/assets/media/media-manager/files/upload-api)).
 * > **Notes:**
 * > - When you upload a file, it's not immediately available, meaning you can't manage or use the file straight away. Learn more about knowing when a file is ready ([SDK](https://dev.wix.com/docs/sdk/backend-modules/media/files/importing-files#backend-modules_media_files_knowing-when-a-file-is-ready) | [REST](https://dev.wix.com/docs/rest/assets/media/media-manager/files/importing-files#knowing-when-a-file-is-ready)).
 * > - Any interruption in the upload process stops the file upload. For files larger than 10MB, or when network connection is poor, call Generate File Resumable Upload URL instead. With the resumable upload URL, any interruption in the upload process pauses the file upload, and resumes the file upload process after the interruption.
 */
function generateFileUploadUrl(payload) {
    var _a = (0, ambassador_1.serializer)(_generateFileUploadUrlRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = (0, ambassador_1.serializer)(_generateFileUploadUrlResponse, {}).fromJSON;
    function __generateFileUploadUrl(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.media.site_media.v1.file_descriptor',
            method: 'POST',
            methodFqn: 'com.wix.media.site_media.v1.FilesService.GenerateFileUploadUrl',
            url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                protoPath: '/v1/files/generate-upload-url',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __generateFileUploadUrl.fromReq = fromReq;
    __generateFileUploadUrl.__isAmbassador = true;
    return __generateFileUploadUrl;
}
exports.generateFileUploadUrl = generateFileUploadUrl;
/**
 * Generates a resumable upload URL to allow external clients to easily upload large files over 10MB to the Media Manager. <br/>
 *
 * With the resumable upload URL, any interruptions in the upload process pauses the file upload, and resumes the file upload process after the interruption. The resumable upload URL is also helpful when network connection is poor.
 * To learn how external clients can use the generated upload URL in the response to upload large files to the Media Manager, see Resumable Upload API ([SDK](https://dev.wix.com/docs/sdk/backend-modules/media/files/resumable-upload-api) | [REST](https://dev.wix.com/docs/rest/assets/media/media-manager/files/resumable-upload-api)).
 *
 * > **Note:** When you upload a file, it's not immediately available, meaning you can't manage or use the file straight away. Learn more about knowing when a file is ready ([SDK](https://dev.wix.com/docs/sdk/backend-modules/media/files/importing-files#backend-modules_media_files_knowing-when-a-file-is-ready) | [REST](https://dev.wix.com/docs/rest/assets/media/media-manager/files/importing-files#knowing-when-a-file-is-ready)).
 */
function generateFileResumableUploadUrl(payload) {
    var _a = (0, ambassador_1.serializer)(_generateFileResumableUploadUrlRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = (0, ambassador_1.serializer)(_generateFileResumableUploadUrlResponse, {}).fromJSON;
    function __generateFileResumableUploadUrl(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.media.site_media.v1.file_descriptor',
            method: 'POST',
            methodFqn: 'com.wix.media.site_media.v1.FilesService.GenerateFileResumableUploadUrl',
            url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                protoPath: '/v1/files/generate-resumable-upload-url',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __generateFileResumableUploadUrl.fromReq = fromReq;
    __generateFileResumableUploadUrl.__isAmbassador = true;
    return __generateFileResumableUploadUrl;
}
exports.generateFileResumableUploadUrl = generateFileResumableUploadUrl;
/**
 * Imports a file to the Media Manager using an external url.
 *
 * Returns information about the imported file.
 * Specify the `parentFolderId` and `filePath` parameters to specify which folder you want the file to be imported to.
 * If no folder is specified, the file is imported to the `media-root` folder.
 *
 * >**Notes:**
 * > - The `media` property isn't returned in the `files` response object.
 * > - When you import a file, it's not immediately available, meaning you can't manage or use the file straight away. Learn more about knowing when a file is ready ([SDK](https://dev.wix.com/docs/sdk/backend-modules/media/files/importing-files#backend-modules_media_files_knowing-when-a-file-is-ready) | [REST](https://dev.wix.com/docs/rest/assets/media/media-manager/files/importing-files#knowing-when-a-file-is-ready)).
 *
 * To import a file, you need to do one of the following:
 * - Specify its [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) in the `mimeType` field of the request. For example, `mimeType: 'image/jpeg'`.
 * - Specify its extension in either the `displayName` or `url` field of the request. For example, `displayName: 'Example Image.jpeg` or `url: https://www.example.com/image.jpeg`.
 * - Ensure the server hosting the file supports HEAD requests. In these cases the Wix servers can retrieve the MIME type from the hosting server.
 * > **Note:** If you want to validate the media type, specify the file's expected media type in the optional `mediaType` field of the request.  For example, `mediaType: 'IMAGE'`.
 */
function importFile(payload) {
    var _a = (0, ambassador_1.serializer)(_importFileRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = (0, ambassador_1.serializer)(_importFileResponse, {
        _archive: _archive,
        _audio: _audio,
        _audioV2: _audioV2,
        _document: _document,
        _faceRecognition: _faceRecognition,
        _fileDescriptor: _fileDescriptor,
        _fileMedia: _fileMedia,
        _focalPoint: _focalPoint,
        _image: _image,
        _imageMedia: _imageMedia,
        _model3D: _model3D,
        _videoResolution: _videoResolution,
        _videoV2: _videoV2,
    }).fromJSON;
    function __importFile(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.media.site_media.v1.file_descriptor',
            method: 'POST',
            methodFqn: 'com.wix.media.site_media.v1.FilesService.ImportFile',
            url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                protoPath: '/v1/files/import',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __importFile.fromReq = fromReq;
    __importFile.__isAmbassador = true;
    return __importFile;
}
exports.importFile = importFile;
/**
 * Imports a bulk of files to the Media Manager using external urls. <br/>
 *
 * Returns information about the imported files.
 *
 * Use the `parentFolderId` and `filePath` parameters to specify the folder you want each file to be imported to.
 * If no folder is specified, the file is imported to the `media-root` folder.
 *
 * >**Notes:**
 * > - The `media` property isn't returned in the `files` response object.
 * > - When you import a file, it's not immediately available, meaning you can't manage or use the file straight away. Learn more about knowing when a file is ready ([SDK](https://dev.wix.com/docs/sdk/backend-modules/media/files/importing-files#backend-modules_media_files_knowing-when-a-file-is-ready) | [REST](https://dev.wix.com/docs/rest/assets/media/media-manager/files/importing-files#knowing-when-a-file-is-ready)).
 *
 * To import files, you need to do one of the following for each file:
 * - Specify its [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) in the `mimeType` field of the request. For example, `mimeType: 'image/jpeg'`.
 * - Include its extension in either the `displayName` or `url` field of the request. For example, `displayName: 'Example Image.jpeg` or `url: https://www.example.com/image.jpeg`.
 * - Ensure the server hosting the file supports HEAD requests. In these cases the Wix servers can retrieve the MIME type from the hosting server.
 * > **Note:** If you want to validate the media type, specify the file's expected media type in the optional `mediaType` field of the request.  For example, `mediaType: 'IMAGE'`.
 * @deprecated It has been replaced with com.wix.media.site_media.v1.FilesService.BulkImportFile(), and will be removed on 2024-03-31.
 */
function bulkImportFiles(payload) {
    var _a = (0, ambassador_1.serializer)(_bulkImportFilesRequest, { _importFileRequest: _importFileRequest }), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = (0, ambassador_1.serializer)(_bulkImportFilesResponse, {
        _archive: _archive,
        _audio: _audio,
        _audioV2: _audioV2,
        _document: _document,
        _faceRecognition: _faceRecognition,
        _fileDescriptor: _fileDescriptor,
        _fileMedia: _fileMedia,
        _focalPoint: _focalPoint,
        _image: _image,
        _imageMedia: _imageMedia,
        _model3D: _model3D,
        _videoResolution: _videoResolution,
        _videoV2: _videoV2,
    }).fromJSON;
    function __bulkImportFiles(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.media.site_media.v1.file_descriptor',
            method: 'POST',
            methodFqn: 'com.wix.media.site_media.v1.FilesService.BulkImportFiles',
            url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                protoPath: '/v1/bulk/files/import',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __bulkImportFiles.fromReq = fromReq;
    __bulkImportFiles.__isAmbassador = true;
    return __bulkImportFiles;
}
exports.bulkImportFiles = bulkImportFiles;
/**
 * Imports a bulk of files to the Media Manager using external urls. <br/>
 *
 * Returns information about the imported files.
 *
 * Specify the `parentFolderId` and `filePath` parameters to specify the folder you want each file to be imported to.
 * If no folder is specified, the file is imported to the `media-root` folder.
 *
 * >**Notes:**
 * > - The `media` property isn't returned in the `files` response object.
 * > - When you import a file, it's not immediately available, meaning you can't manage or use the file straight away. Learn more about knowing when a file is ready ([SDK](https://dev.wix.com/docs/sdk/backend-modules/media/files/importing-files#backend-modules_media_files_knowing-when-a-file-is-ready) | [REST](https://dev.wix.com/docs/rest/assets/media/media-manager/files/importing-files#knowing-when-a-file-is-ready)).
 *
 * To import files, you need to do one of the following for each file:
 * - Specify its [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) in the `mimeType` field of the request. For example, `mimeType: 'image/jpeg'`.
 * - Include its extension in either the `displayName` or `url` field of the request. For example, `displayName: 'Example Image.jpeg` or `url: https://www.example.com/image.jpeg`.
 * - Ensure the server hosting the file supports HEAD requests. In these cases the Wix servers can retrieve the MIME type from the hosting server.
 * > **Note:** If you want to validate the media type, specify the file's expected media type in the optional `mediaType` field of the request.  For example, `mediaType: 'IMAGE'`.
 */
function bulkImportFile(payload) {
    var _a = (0, ambassador_1.serializer)(_bulkImportFileRequest, { _importFileRequest: _importFileRequest }), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = (0, ambassador_1.serializer)(_bulkImportFileResponse, {
        _archive: _archive,
        _audio: _audio,
        _audioV2: _audioV2,
        _bulkImportFileResult: _bulkImportFileResult,
        _document: _document,
        _faceRecognition: _faceRecognition,
        _fileDescriptor: _fileDescriptor,
        _fileMedia: _fileMedia,
        _focalPoint: _focalPoint,
        _image: _image,
        _imageMedia: _imageMedia,
        _model3D: _model3D,
        _videoResolution: _videoResolution,
        _videoV2: _videoV2,
    }).fromJSON;
    function __bulkImportFile(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.media.site_media.v1.file_descriptor',
            method: 'POST',
            methodFqn: 'com.wix.media.site_media.v1.FilesService.BulkImportFile',
            url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                protoPath: '/v1/bulk/files/import-v2',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __bulkImportFile.fromReq = fromReq;
    __bulkImportFile.__isAmbassador = true;
    return __bulkImportFile;
}
exports.bulkImportFile = bulkImportFile;
/**
 * Retrieves a list of files in the Media Manager.
 *
 * To retrieve a list of files within a specific folder in the Media Manager, specify the folder's ID in the `parentFolderId` parameter. If no folder is specified, the method retrieves the list of files in the root folder of the Media Manager.
 */
function listFiles(payload) {
    var _a = (0, ambassador_1.serializer)(_listFilesRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = (0, ambassador_1.serializer)(_listFilesResponse, {
        _archive: _archive,
        _audio: _audio,
        _audioV2: _audioV2,
        _document: _document,
        _faceRecognition: _faceRecognition,
        _fileDescriptor: _fileDescriptor,
        _fileMedia: _fileMedia,
        _focalPoint: _focalPoint,
        _image: _image,
        _imageMedia: _imageMedia,
        _model3D: _model3D,
        _videoResolution: _videoResolution,
        _videoV2: _videoV2,
    }).fromJSON;
    function __listFiles(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.media.site_media.v1.file_descriptor',
            method: 'GET',
            methodFqn: 'com.wix.media.site_media.v1.FilesService.ListFiles',
            url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                protoPath: '/v1/files',
                data: serializedData,
                host: host,
            }),
            params: (0, metro_runtime_1.toURLSearchParams)(serializedData, true),
            transformResponse: fromRes,
        };
        return metadata;
    }
    __listFiles.fromReq = fromReq;
    __listFiles.__isAmbassador = true;
    return __listFiles;
}
exports.listFiles = listFiles;
/**
 * Retrieves a list of up to 200 files with the specified filtering, sorting, and cursor paging.
 *
 * If no parameters are specified, the method returns all files in the `MEDIA_ROOT` folder.
 *
 * ## Defaults
 *
 * Search Files has the following default setting, which you can override:
 * + Sorted by `updatedDate` in descending order.
 *
 * ## Filters
 *
 * When using filters for dates, you must use
 * [UTC time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time).
 *
 * ## See also
 *
 * To learn about working with *Search* methods, see
 * _API Query Language_
 * ([SDK](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/api-query-language) | [REST](https://dev.wix.com/docs/rest/articles/get-started/api-query-language))
 * and *Sorting and Paging*
 * ([SDK](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/api-query-language#the-sort-array) | [REST](https://dev.wix.com/docs/rest/articles/get-started/sorting-and-paging)).
 */
function searchFiles(payload) {
    var _a = (0, ambassador_1.serializer)(_searchFilesRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = (0, ambassador_1.serializer)(_searchFilesResponse, {
        _archive: _archive,
        _audio: _audio,
        _audioV2: _audioV2,
        _document: _document,
        _faceRecognition: _faceRecognition,
        _fileDescriptor: _fileDescriptor,
        _fileMedia: _fileMedia,
        _focalPoint: _focalPoint,
        _image: _image,
        _imageMedia: _imageMedia,
        _model3D: _model3D,
        _videoResolution: _videoResolution,
        _videoV2: _videoV2,
    }).fromJSON;
    function __searchFiles(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.media.site_media.v1.file_descriptor',
            method: 'POST',
            methodFqn: 'com.wix.media.site_media.v1.FilesService.SearchFiles',
            url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                protoPath: '/v1/files/search',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __searchFiles.fromReq = fromReq;
    __searchFiles.__isAmbassador = true;
    return __searchFiles;
}
exports.searchFiles = searchFiles;
/**
 * Generates a URL for streaming a specific video file in the Media Manager. <br/>
 *
 * To stream different assets of the file, specify the `assetKeys` parameter which generates a video streaming URL for each asset. If no assetKey is specified, it defaults to `src`, which generates one video streaming URL in the original file's format and quality.
 */
function generateVideoStreamingUrl(payload) {
    var _a = (0, ambassador_1.serializer)(_generateVideoStreamingUrlRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = (0, ambassador_1.serializer)(_generateVideoStreamingUrlResponse, {}).fromJSON;
    function __generateVideoStreamingUrl(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.media.site_media.v1.file_descriptor',
            method: 'POST',
            methodFqn: 'com.wix.media.site_media.v1.FilesService.GenerateVideoStreamingUrl',
            url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                protoPath: '/v1/files/generate-video-stream-url',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __generateVideoStreamingUrl.fromReq = fromReq;
    __generateVideoStreamingUrl.__isAmbassador = true;
    return __generateVideoStreamingUrl;
}
exports.generateVideoStreamingUrl = generateVideoStreamingUrl;
/**
 * Return a token for a direct web socket notification channel
 * This API is not platformized (Contact the Media team for use instructions)
 * This API should be internal only
 */
function generateWebSocketToken(payload) {
    var _a = (0, ambassador_1.serializer)(_generateWebSocketTokenRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = (0, ambassador_1.serializer)(_generateWebSocketTokenResponse, {}).fromJSON;
    function __generateWebSocketToken(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.media.site_media.v1.file_descriptor',
            method: 'POST',
            methodFqn: 'com.wix.media.site_media.v1.FilesService.GenerateWebSocketToken',
            url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                protoPath: '/v1/files/generate-web-socket-token',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __generateWebSocketToken.fromReq = fromReq;
    __generateWebSocketToken.__isAmbassador = true;
    return __generateWebSocketToken;
}
exports.generateWebSocketToken = generateWebSocketToken;
/**
 * Deletes the specified files from the Media Manager. <br/>
 *
 * The deleted files are moved to the Media Manager's trash bin (`TRASH-ROOT` folder) unless permanently deleted. To permanently delete files, specify the `permanent` parameter with the value `true`. Permanently deleting files isn't reversible, so make sure that these files aren't being used in a site or in any other way as the files will no longer be accessible.
 *
 * Note the following:
 * * The specified files can be from different folders.
 * * Moving multiple files at once is an asynchronous action, and may take time for the changes to appear in the Media Manager.
 * * Attempting to delete files that are already in the trash bin doesn't result in an error.
 * * If a site contains deleted media files, the deleted media files still appear on the site as the files are still in the Media Manager (in the trash bin).
 * * You can use Bulk Restore Files From Trash Bin to restore files from the Media Manager's trash bin.
 */
function bulkDeleteFiles(payload) {
    var _a = (0, ambassador_1.serializer)(_bulkDeleteFilesRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = (0, ambassador_1.serializer)(_bulkDeleteFilesResponse, {}).fromJSON;
    function __bulkDeleteFiles(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.media.site_media.v1.file_descriptor',
            method: 'POST',
            methodFqn: 'com.wix.media.site_media.v1.FilesService.BulkDeleteFiles',
            url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                protoPath: '/v1/bulk/files/delete',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __bulkDeleteFiles.fromReq = fromReq;
    __bulkDeleteFiles.__isAmbassador = true;
    return __bulkDeleteFiles;
}
exports.bulkDeleteFiles = bulkDeleteFiles;
/** Restores the specified files from the Media Manager's trash bin, and moves them to their original locations in the Media Manager. */
function bulkRestoreFilesFromTrashBin(payload) {
    var _a = (0, ambassador_1.serializer)(_bulkRestoreFilesFromTrashBinRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = (0, ambassador_1.serializer)(_bulkRestoreFilesFromTrashBinResponse, {}).fromJSON;
    function __bulkRestoreFilesFromTrashBin(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.media.site_media.v1.file_descriptor',
            method: 'POST',
            methodFqn: 'com.wix.media.site_media.v1.FilesService.BulkRestoreFilesFromTrashBin',
            url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                protoPath: '/v1/bulk/trash-bin/files/restore',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __bulkRestoreFilesFromTrashBin.fromReq = fromReq;
    __bulkRestoreFilesFromTrashBin.__isAmbassador = true;
    return __bulkRestoreFilesFromTrashBin;
}
exports.bulkRestoreFilesFromTrashBin = bulkRestoreFilesFromTrashBin;
/**
 * Retrieves a list of files in the Media Manager's trash bin. <br/>
 *
 * >**Note:** The Media Manager's trash bin (`TRASH-ROOT` folder) only contains temporarily deleted files, not permanently deleted files.
 */
function listDeletedFiles(payload) {
    var _a = (0, ambassador_1.serializer)(_listDeletedFilesRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = (0, ambassador_1.serializer)(_listDeletedFilesResponse, {
        _archive: _archive,
        _audio: _audio,
        _audioV2: _audioV2,
        _document: _document,
        _faceRecognition: _faceRecognition,
        _fileDescriptor: _fileDescriptor,
        _fileMedia: _fileMedia,
        _focalPoint: _focalPoint,
        _image: _image,
        _imageMedia: _imageMedia,
        _model3D: _model3D,
        _videoResolution: _videoResolution,
        _videoV2: _videoV2,
    }).fromJSON;
    function __listDeletedFiles(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.media.site_media.v1.file_descriptor',
            method: 'GET',
            methodFqn: 'com.wix.media.site_media.v1.FilesService.ListDeletedFiles',
            url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                protoPath: '/v1/trash-bin/files',
                data: serializedData,
                host: host,
            }),
            params: (0, metro_runtime_1.toURLSearchParams)(serializedData, true),
            transformResponse: fromRes,
        };
        return metadata;
    }
    __listDeletedFiles.fromReq = fromReq;
    __listDeletedFiles.__isAmbassador = true;
    return __listDeletedFiles;
}
exports.listDeletedFiles = listDeletedFiles;
function bulkPublishDraftFiles(payload) {
    var _a = (0, ambassador_1.serializer)(_bulkPublishDraftFilesRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = (0, ambassador_1.serializer)(_bulkPublishDraftFilesResponse, {
        _archive: _archive,
        _audio: _audio,
        _audioV2: _audioV2,
        _bulkPublishDraftFileResult: _bulkPublishDraftFileResult,
        _document: _document,
        _faceRecognition: _faceRecognition,
        _fileDescriptor: _fileDescriptor,
        _fileMedia: _fileMedia,
        _focalPoint: _focalPoint,
        _image: _image,
        _imageMedia: _imageMedia,
        _model3D: _model3D,
        _videoResolution: _videoResolution,
        _videoV2: _videoV2,
    }).fromJSON;
    function __bulkPublishDraftFiles(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.media.site_media.v1.file_descriptor',
            method: 'POST',
            methodFqn: 'com.wix.media.site_media.v1.FilesService.BulkPublishDraftFiles',
            url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                protoPath: '/v1/bulk/files/publish-drafts',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __bulkPublishDraftFiles.fromReq = fromReq;
    __bulkPublishDraftFiles.__isAmbassador = true;
    return __bulkPublishDraftFiles;
}
exports.bulkPublishDraftFiles = bulkPublishDraftFiles;
/**
 * Updates a file.
 *
 * Specify the `parentFolderId` parameter to move a file from its current folder to a different folder.
 * @deprecated It has been replaced with com.wix.media.site_media.v1.FilesService.UpdateFileDescriptor(), and will be removed on 2023-03-31.
 */
function updateFile(payload) {
    var _a = (0, ambassador_1.serializer)(_updateFileRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = (0, ambassador_1.serializer)(_updateFileResponse, {
        _archive: _archive,
        _audio: _audio,
        _audioV2: _audioV2,
        _document: _document,
        _faceRecognition: _faceRecognition,
        _fileDescriptor: _fileDescriptor,
        _fileMedia: _fileMedia,
        _focalPoint: _focalPoint,
        _image: _image,
        _imageMedia: _imageMedia,
        _model3D: _model3D,
        _videoResolution: _videoResolution,
        _videoV2: _videoV2,
    }).fromJSON;
    function __updateFile(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.media.site_media.v1.file_descriptor',
            method: 'PATCH',
            methodFqn: 'com.wix.media.site_media.v1.FilesService.UpdateFile',
            url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
                protoPath: '/v1/files/update-file',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __updateFile.fromReq = fromReq;
    __updateFile.__isAmbassador = true;
    return __updateFile;
}
exports.updateFile = updateFile;
//# sourceMappingURL=http.impl.js.map