"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CaptionsCommand = void 0;
const core_utils_1 = require("../../core-utils");
const shared_1 = require("../shared");
class CaptionsCommand extends shared_1.AbstractCommand {
    add(options) {
        const { videoId, language, fixture, mimeType } = options;
        const path = '/api/v1/videos/' + videoId + '/captions/' + language;
        const captionfile = (0, core_utils_1.buildAbsoluteFixturePath)(fixture);
        const captionfileAttach = mimeType
            ? [captionfile, { contentType: mimeType }]
            : captionfile;
        return this.putUploadRequest(Object.assign(Object.assign({}, options), { path, fields: {}, attaches: {
                captionfile: captionfileAttach
            }, implicitToken: true, defaultExpectedStatus: 204 }));
    }
    list(options) {
        const { videoId } = options;
        const path = '/api/v1/videos/' + videoId + '/captions';
        return this.getRequestBody(Object.assign(Object.assign({}, options), { path, implicitToken: false, defaultExpectedStatus: 200 }));
    }
    delete(options) {
        const { videoId, language } = options;
        const path = '/api/v1/videos/' + videoId + '/captions/' + language;
        return this.deleteRequest(Object.assign(Object.assign({}, options), { path, implicitToken: true, defaultExpectedStatus: 204 }));
    }
}
exports.CaptionsCommand = CaptionsCommand;
//# sourceMappingURL=captions-command.js.map