@kaltura-ng/kaltura-client
Version:
Kaltura Typescript client
53 lines • 2.79 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import { KalturaRequest } from "./kaltura-request";
var KalturaUploadRequest = (function (_super) {
__extends(KalturaUploadRequest, _super);
function KalturaUploadRequest(data, _a) {
var responseType = _a.responseType, responseSubType = _a.responseSubType, responseConstructor = _a.responseConstructor;
var _this = _super.call(this, data, { responseType: responseType, responseSubType: responseSubType, responseConstructor: responseConstructor }) || this;
_this.uploadedFileSize = 0;
_this.uploadedFileSize = data.uploadedFileSize;
return _this;
}
KalturaUploadRequest.prototype.setProgress = function (callback) {
this._progressCallback = callback;
return this;
};
KalturaUploadRequest.prototype._getProgressCallback = function () {
return this._progressCallback;
};
KalturaUploadRequest.prototype.supportChunkUpload = function () {
// chunk upload currently assume support according to request/reseponse properties. Should get this information from the client-generator directly.
var properties = this._getMetadata().properties;
var responseSupportChunk = this._responseConstructor ? (new this._responseConstructor()).hasMetadataProperty("uploadedFileSize") : false;
return responseSupportChunk
&& !!properties["resume"]
&& !!properties["resumeAt"]
&& !!properties["finalChunk"];
};
KalturaUploadRequest.prototype.getFileInfo = function () {
var metadataProperties = this._getMetadata().properties;
var filePropertyName = Object.keys(metadataProperties).find(function (propertyName) { return metadataProperties[propertyName].type === "f"; });
return filePropertyName ? { propertyName: filePropertyName, file: this[filePropertyName] } : null;
};
KalturaUploadRequest.prototype.toRequestObject = function () {
var result = _super.prototype.toRequestObject.call(this);
var filePropertyName = this.getFileInfo().propertyName;
if (filePropertyName) {
delete result[filePropertyName];
}
return result;
};
return KalturaUploadRequest;
}(KalturaRequest));
export { KalturaUploadRequest };
//# sourceMappingURL=kaltura-upload-request.js.map