"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImportsCommand = void 0;
const requests_1 = require("../requests");
const shared_1 = require("../shared");
class ImportsCommand extends shared_1.AbstractCommand {
    importVideo(options) {
        const { attributes } = options;
        const path = '/api/v1/videos/imports';
        let attaches = {};
        if (attributes.torrentfile)
            attaches = { torrentfile: attributes.torrentfile };
        return (0, requests_1.unwrapBody)(this.postUploadRequest(Object.assign(Object.assign({}, options), { path,
            attaches, fields: options.attributes, implicitToken: true, defaultExpectedStatus: 200 })));
    }
    delete(options) {
        const path = '/api/v1/videos/imports/' + options.importId;
        return this.deleteRequest(Object.assign(Object.assign({}, options), { path, implicitToken: true, defaultExpectedStatus: 204 }));
    }
    cancel(options) {
        const path = '/api/v1/videos/imports/' + options.importId + '/cancel';
        return this.postBodyRequest(Object.assign(Object.assign({}, options), { path, implicitToken: true, defaultExpectedStatus: 204 }));
    }
    getMyVideoImports(options = {}) {
        const { sort, targetUrl, videoChannelSyncId, search } = options;
        const path = '/api/v1/users/me/videos/imports';
        return this.getRequestBody(Object.assign(Object.assign({}, options), { path, query: { sort, targetUrl, videoChannelSyncId, search }, implicitToken: true, defaultExpectedStatus: 200 }));
    }
}
exports.ImportsCommand = ImportsCommand;
//# sourceMappingURL=imports-command.js.map