UNPKG

@awhere/api

Version:

The awesome aWhere API for JavaScript.

80 lines 3.24 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var interfaces_1 = require("@awhere/interfaces"); var ItemBase_1 = __importDefault(require("../../Item/ItemBase")); var FileItem = /** @class */ (function (_super) { __extends(FileItem, _super); function FileItem() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(FileItem.prototype, "type", { get: function () { return interfaces_1.ItemType.file; }, enumerable: false, configurable: true }); Object.defineProperty(FileItem.prototype, "subtype", { get: function () { return this._subtype; }, enumerable: false, configurable: true }); Object.defineProperty(FileItem.prototype, "props", { get: function () { return this._props; }, set: function (value) { this._props = value; }, enumerable: false, configurable: true }); FileItem.prototype.isImage = function () { return Object.values(interfaces_1.FileItemTypeImage).includes(this.subtype); }; FileItem.prototype.isDocument = function () { return Object.values(interfaces_1.FileItemTypeDocument).includes(this.subtype); }; FileItem.prototype.isAudio = function () { return Object.values(interfaces_1.FileItemTypeAudio).includes(this.subtype); }; FileItem.prototype.isVideo = function () { return Object.values(interfaces_1.FileItemTypeVideo).includes(this.subtype); }; FileItem.prototype.isSpreadsheet = function () { return Object.values(interfaces_1.FileItemTypeMSExcel).includes(this.subtype); }; FileItem.prototype.download = function (responseType, onDownloadProgress) { if (responseType === void 0) { responseType = 'blob'; } return this.request.get("/item/".concat(this._id, "/actions/download"), { responseType: responseType, onDownloadProgress: onDownloadProgress, }); }; FileItem.prototype.getVersions = function () { return this.request.get("/item/".concat(this._id, "/actions/getVersions")); }; return FileItem; }(ItemBase_1.default)); exports.default = FileItem; //# sourceMappingURL=FileItem.js.map