/** * @module FileDocuments */ import { FileDescriptor, FileViewer } from './common'; import { Subscription } from 'rxjs'; import { Bubble, RBEvent, User } from '.'; export declare enum FileDocumentState { DELETED = "deleted", UPLOADING = "uploading", UPLOADED = "uploaded", NOT_UPLOADED = "not_uploaded", DOWNLOADING = "downloading", UPLOADERROR = "uploadError", UNKNOWN = "unknown" } export declare enum FileDocumentSearchMime { IMAGE = "image", AUDIO_VIDEO = "audio-video", PDF = "pdf", PRESENTATION = "presentation", DOCUMENT = "document", SPREADSHEET = "spreadsheet" } export declare enum FileDocumentSearchSet { ALL = "all", MINE = "mine", RECEIVED = "received" } export declare enum FileDocumentSearchSortBy { FILENAME = "fileName", UPLOADED_DATA = "uploadedDate", SIZE = "size" } export declare enum FileDocumentSearchSortDirection { TOP = 1, DOWN = -1 } export interface FileDocumentThumbnail { /** * */ possible: boolean; /** * */ available: boolean; /** * */ url(): Promise; } export interface FileDocumentSearchOptions { /** * Only searches for files whose name contains this string */ name?: string; /** * DocumentSet, define in which collection set the search should be executed ALL, MINE or RECEIVED * Default is ALL */ documentSet?: FileDocumentSearchSet; /** * The document media type (also known as a Multipurpose Internet Mail Extensions or MIME type) indicates the nature and format * of a document. MIME types are defined and standardized in IETF's RFC 6838 * Default is '' */ mime?: FileDocumentSearchMime; /** * The search result will be sorted following the sortBy info * Default is UPLOADED_DATA */ sortBy?: FileDocumentSearchSortBy; /** * The sort direction * Default is DOWN */ sortDirection?: FileDocumentSearchSortDirection; } /** * @eventProperty */ export declare enum FileDocumentEvents { /** * @eventProperty * When a document is uploaded, the backend will automatically generate a thumbnail whenever possible * (this function is in place for images, video files and pdf files). * This event is fired once when the thumbnail generation is complete and the document is available for download. */ ON_THUMBNAIL_AVAILABLE = "ON_THUMBNAIL_AVAILABLE", /** * @eventProperty * This event is fired once when the upload is complete and the document is available for download. */ ON_UPLOADED = "ON_UPLOADED", /** * @eventProperty * When a large document is uploaded, it will be sent to the backend in chunks, making it possible to monitor its progress. * This event is fired when the transfer progress (in %) changes. */ ON_TRANSFERT_IN_PROGRESS = "ON_TRANSFERT_IN_PROGRESS", /** * @eventProperty * This event is fired when the content of the document is modified */ ON_CONTENT_MODIFIED = "ON_CONTENT_MODIFIED" } export declare class FileDocumentViewer { id: string; type?: string; static createFormFileViewer(fileViewer: FileViewer): FileDocumentViewer; } export interface FileDocument { /** * The document identifier */ id: string; /** * The document name */ name: string; /** * The document size (in bytes) */ size: number; /** * The document date */ date: Date; /** * The document media type (also known as a Multipurpose Internet Mail Extensions or MIME type) indicates the nature and format * of a document. MIME types are defined and standardized in IETF's RFC 6838 */ mime: string; /** * The document current state */ state: FileDocumentState; /** * To ensure the security of your data, every document uploaded to Rainbow will be scanned for viruses. * This field reflects the security status of the document. */ securityStatus: string; /** * Document thumbnail information (possible, available, url) */ thumbnail: FileDocumentThumbnail; /** * When a large document is uploaded, it is sent to the backend in chunks, so its progress can be tracked. * This progress index (in %) is updated when a document is transferred between the client and the backend * (see event "ON_TRANSFERT_PROGRESS_UPDATED"). */ transfertProgress: number; /** * Direct access to underlying fileDescriptor (to compatibility mode) * @internal */ fileDescriptor: FileDescriptor; /** * This method makes it possible to subscribe to the document events (all events are of RBEvent); * @param handler - The call-back function that will be subscribed to the RxJS subject * @param eventNames - array of event to listen */ subscribe(handler: (event: RBEvent) => any, eventNames?: FileDocumentEvents | FileDocumentEvents[]): Subscription; /** * Get this document owner user */ getOwner(): Promise; /** * Replace the document content. * @param data - the new content blob */ replaceContent(data: Blob): void; /** * Uploads a document to the file server. * It is possible to interrupt the upload of a document using the `abortDocumentTransfer` method. */ upload(): Promise; /** * Download a document * This method returns a blob that you can process as you see fit. * It is possible to interrupt the download of a document using the `abortDocumentTransfer` method. */ download(): Promise; /** * This method allows you to copy a document shared by another user into your own storage space. */ copy(): Promise; /** * Abort a document transfert * This method allows you to interrupt a transfer operation (upload or download). */ abortTransfert(): Promise; /** * Delete a document */ delete(): Promise; /** * Add a viewer to share the this document. * @param viewer - The viewer to be added, which can be either a `User` or a `Bubble` instance. */ addViewer(viewer: User | Bubble): Promise; /** * Remove a viewer * @param viewer - The viewer to be removed, which can be either a `User` or a `Bubble` instance. */ removeViewer(viewer: User | Bubble): Promise; /** * Return a local URL for this fileDocument (this url can be only used locally by the connectedUser) */ getLocalUrl(): Promise; /** * Return a temporary public URL for this fileDocument (this url can be shared and use by everyone (TTL = 1 hour)) */ getPublicUrl(): Promise; /** * Return the text content of a file document */ getTextContent(noCache?: boolean): Promise; /** * Return the json content of a file document, throw an exception if typeMime is not '' */ getJsonContent(): Promise; /** * Utility method for generating a human readable JSON representation of this object (debug purpose only) */ toJSON(): any; } /** @internal */ export declare class FileDocumentRB implements FileDocument { private documentService; private contactService; private logger; fd: FileDescriptor; private eventSubject; private thumbnailSubscription?; transfertProgressSubscription?: Subscription; private transfertProgressValue; get id(): string; get name(): string; get date(): Date; get size(): number; get mime(): string; get state(): FileDocumentState; get securityStatus(): string; get fileDescriptor(): FileDescriptor; get transfertProgress(): number; get viewers(): FileDocumentViewer[]; thumbnail: FileDocumentThumbnail; subscribe(handler: (event: RBEvent) => any, eventNames?: FileDocumentEvents | FileDocumentEvents[]): Subscription; sendEvent(name: FileDocumentEvents, data?: any): void; getOwner(): Promise; replaceContent(data: Blob): void; upload(): Promise; download(): Promise; copy(): Promise; abortTransfert(): Promise; delete(): Promise; hasEnoughSpace(): boolean; addViewer(viewer: User | Bubble): Promise; removeViewer(viewer: User | Bubble): Promise; getLocalUrl(): Promise; getPublicUrl(): Promise; getTextContent(noCache?: boolean): Promise; getJsonContent(): Promise; toJSON(): any; handleThumbnail(): void; handleTransferProgress(): void; } //# sourceMappingURL=fileDocument.model.d.ts.map