export {}; import { Observable } from 'rxjs'; import { FileDescriptor } from "../common/models/FileDescriptor"; import { Conversation } from "../common/models/Conversation"; import { EventEmitter } from "events"; import { Logger } from "../common/Logger"; import { Core } from "../Core"; import { GenericService } from "./GenericService"; import { DataStoreType } from "../config/config.js"; import { Bubble } from "../common/models/Bubble.js"; declare function FileUpdated(input: any): void; declare class FileStorage extends GenericService { private _fileServerService; private _conversations; fileDescriptors: any; fileDescriptorsByDate: any; fileDescriptorsByName: any; fileDescriptorsBySize: any; receivedFileDescriptors: any; receivedFileDescriptorsByName: any; receivedFileDescriptorsByDate: any; receivedFileDescriptorsBySize: any; consumptionData: any; private _contactService; private _errorHelperService; private _helpersService; static getClassName(): string; getClassName(): string; static getAccessorName(): string; getAccessorName(): string; constructor(_core: Core, _eventEmitter: EventEmitter, _logger: Logger, _startConfig: { start_up: boolean; optional: boolean; }); start(_options: any): Promise; stop(): Promise; init(useRestAtStartup: boolean): Promise; /**************** API ***************/ /** * @public * @since 1.47.1 * @nodered true * @method uploadFileToConversation * @instance * @async * @category Files TRANSFER * @param {Conversation} conversation The conversation where the message will be added * @param {{size, type, name, preview, path}} object reprensenting The file to add. Properties are : the Size of the file in octets, the mimetype, the name, a thumbnail preview if it is an image, the path to the file to share. * @param {String} strMessage An optional message to add with the file * @param {DataStoreType} p_messagesDataStore used to override the general of SDK's parameter "messagesDataStore". default value `undefined` to use the general value.
* DataStoreType.NoStore Tell the server to NOT store the messages for delay distribution or for history of the bot and the contact.
* DataStoreType.NoPermanentStore Tell the server to NOT store the messages for history of the bot and the contact. But being stored temporarily as a normal part of delivery (e.g. if the recipient is offline at the time of sending).
* DataStoreType.StoreTwinSide The messages are fully stored.
* DataStoreType.UsestoreMessagesField to follow the storeMessages SDK's parameter behaviour.
* @description * Allow to add a file to an existing conversation (ie: conversation with a contact)
* Return the promise
* @return {Message} Return the message sent
*/ uploadFileToConversation(conversation: Conversation, file: any, strMessage: string, p_messagesDataStore?: DataStoreType): Promise; /** * @public * @since 1.47.1 * @nodered true * @method uploadFileToBubble * @instance * @async * @category Files TRANSFER * @param {Bubble} bubble The bubble where the message will be added * @param {File} file The file to add * @param {String} strMessage An optional message to add with the file * @param {DataStoreType} p_messagesDataStore used to override the general of SDK's parameter "messagesDataStore". default value `undefined` to use the general value.
* DataStoreType.NoStore Tell the server to NOT store the messages for delay distribution or for history of the bot and the contact.
* DataStoreType.NoPermanentStore Tell the server to NOT store the messages for history of the bot and the contact. But being stored temporarily as a normal part of delivery (e.g. if the recipient is offline at the time of sending).
* DataStoreType.StoreTwinSide The messages are fully stored.
* DataStoreType.UsestoreMessagesField to follow the storeMessages SDK's parameter behaviour.
* @description * Allow to add a file to an existing Bubble conversation
* Return a promise
* @return {Message} Return the message sent
*/ uploadFileToBubble(bubble: Bubble, file: File, strMessage: string, p_messagesDataStore?: DataStoreType): Promise; /** * @public * @since 1.67.0 * @nodered true * @method uploadFileToStorage * @category Files TRANSFER * @async * @param {String|File} file An {size, type, name, preview, path}} object reprensenting The file to add. Properties are : the Size of the file in octets, the mimetype, the name, a thumbnail preview if it is an image, the path to the file to share. * @param {boolean} voicemessage When set to True, that allows to identify voice memos in a chat or multi-users chat conversation. * @param {number} duration The voice message in seconds. This field must be a positive number and is only taken into account when voicemessage is true. * @param {boolean} encoding AAC is the choosen format to encode a voice message. This is the native format for mobile clients, nor web client (OPUS, OGG..). This field must be set to true to order a transcodind and is only taken into account when voicemessage is true. * @param {boolean} ccarelogs When set to True, that allows to identify a log file uploaded by the user * @param {boolean} ccareclientlogs When set to True, that allows to identify a log file uploaded automatically by the client application * @instance * @description * Send a file in user storage
*/ uploadFileToStorage(file: any, voicemessage?: boolean, duration?: number, encoding?: boolean, ccarelogs?: boolean, ccareclientlogs?: boolean): Promise; /** * @public * @since 1.47.1 * @nodered true * @method downloadFile * @category Files TRANSFER * @async * @instance * @param {FileDescriptor} fileDescriptor The description of the file to download (short file descriptor) * @description * Allow to download a file from the server
* Return a promise
* @return {} Object with : Array of buffer Binary data of the file type, Mime type, fileSize: fileSize, Size of the file , fileName: fileName The name of the file Return the file received */ downloadFile(fileDescriptor: any): Promise; /** * @public * @since 1.79.0 * @nodered true * @method downloadFileInPath * @instance * @category Files TRANSFER * @async * @param {FileDescriptor} fileDescriptor The description of the file to download (short file descriptor) * @param {string} path If provided then the retrieved file is stored in it. If not provided then * @async * @description * Allow to download a file from the server and store it in provided path.
* Return a promise
* @return {Observable} Return an Observable object to see the completion of the download/save.
* It returns a percentage of downloaded data Values are between 0 and 100 (include).
* The last one value is the description and content of the file :
* {
* buffer : blobArray, // the buffer with the content of the file.
* type: mime, // The mime type of the encoded file
* fileSize: fileSize, // The size in octects of the file
* fileName: fileName // The file saved.
* }
* Warning !!! :
* take care to not log this last data which can be very important for big files. You can test if the value is < 101.
*/ downloadFileInPath(fileDescriptor: any, path: string): Promise>; /** * @public * @since 1.47.1 * @nodered true * @method getFilesTemporaryURL * @instance * @async * @category Files TRANSFER * @param {string} fileId The id of description of the file to get download url. * @description * In order to use a download manager, get a file backend temporary URL.
* Return a promise
* @return {Object} Return a SDK OK Object or a SDK error object depending the result */ getFilesTemporaryURL(fileId: string): Promise; /** * @public * @since 1.47.1 * @nodered true * @method removeFile * @instance * @async * @category Files TRANSFER * @param {FileDescriptor} fileDescriptor The description of the file to remove (short file descriptor) * @description * Remove an uploaded file
* Return a promise
* @return {Object} Return a SDK OK Object or a SDK error object depending the result */ removeFile(fileDescriptor: any): Promise; /** * @private * @since 1.47.1 * @method * @instance * @async * @category Files FILE MANAGEMENT / PROPERTIES * @description * Allow to add a file to an existing Peer 2 Peer or Bubble conversation
* Return a promise
* @return {Message} Return the message sent */ _addFileToConversation(conversation: Conversation, file: any, data: string | any[], p_messagesDataStore: DataStoreType): any; /**********************************************************/ /** Basic accessors to FileStorage's properties **/ /**********************************************************/ getFileDescriptorById(id: any): any; /** * @public * @nodered true * @since 1.47.1 * @method getFileDescriptorFromId * @instance * @category Files FILE MANAGEMENT / PROPERTIES * @param {String} id The file id * @description * Get the file descriptor the user own by it's id
* @return {FileDescriptor} Return a file descriptors found or null if no file descriptor has been found */ getFileDescriptorFromId(id: any): any; /** * @public * @nodered true * @since 1.47.1 * @method getFilesReceivedInConversation * @instance * @async * @param {Conversation} conversation The conversation where to get the files * @category Files FILE MANAGEMENT / PROPERTIES * @description * Get the list of all files received in a conversation with a contact
* Return a promise
* @return {FileDescriptor[]} Return an array of file descriptors found or an empty array if no file descriptor has been found */ getFilesReceivedInConversation(conversation: any): Promise; /** * @public * @since 1.47.1 * @nodered true * @method getFilesReceivedInBubble * @instance * @async * @category Files FILE MANAGEMENT / PROPERTIES * @param {Bubble} bubble The bubble where to get the files * @param {string} ownerId Among all files shared with the user, allow to precify a provider. * @param {boolean} fileName Allows to filter file descriptors by fileName criterion. * @param {string} extension Allows to filter file descriptors by extension criterion. * @param {string} typeMIME Allows to filter file descriptors by typeMIME criterion. * typeMIME='image/jpeg' allows to get all jpeg file * typeMime='image' allows to get all image files whatever the extension * typeMIME='image/jpeg'&typeMIME='image/png' allows to get all jpeg and png files * typeMIME='image'&typeMIME='video' allows to get all image and video files whatever the extension * @param {boolean} isUploaded Allows to filter file descriptors by isUploaded criterion. * @param {string} purpose Allows to filter file descriptors by the utility of the file (conference_record for instance). purpose=conference_record allows to get all records of conference * @param {string} roomName A word of the conference name. When purpose=conference_record is used, allow to reduce the list of results focusing of the recording name. * @param {boolean} overall When true, allow to get all files (my files and received files) in the same paginated list * @param {string} format Allows to retrieve viewers of each file when the format is full. * small: _id fileName extension typeMIME ownerId isUploaded uploadedDate size thumbnail thumbnail500 isClean tags * medium: _id fileName extension typeMIME ownerId isUploaded uploadedDate size thumbnail thumbnail500 isClean tags * full: _id fileName extension typeMIME ownerId isUploaded uploadedDate size viewers thumbnail thumbnail500 isClean tags * Default value : full Possibles values : small, medium, full * @param {number} limit Allow to specify the number of fileDescriptors to retrieve. Default value : 1000 * @param {number} offset Allow to specify the position of first fileDescriptor to retrieve (first fileDescriptor if not specified). Warning: if offset > total, no results are returned. * @param {string} sortField Sort fileDescriptor list based on the given field. Default value : fileName * @param {number} sortOrder Specify order when sorting fileDescriptor list (1: arranged in alphabetical order, -1: reverse order). Default value : 1 Possibles values : -1, 1 * @return {Promise} : list of received files descriptors * * * | Champ | Type | Description | * | --- | --- | --- | * | data | Object | File descriptor Object | * | tags | Object | Wrap a set of data according with the file use | * | path | String | The path under which the owner will be able to classified the file. The folder management is not yet available; only a get files per path. For instance this facility is used to implement OXO visual voice mail feature on client side.

* /
* /voice-messages | * | msgId | String | When the file is generated by the Rainbow visual voice mail feature - The message Id (ex: "g0F6jhGrIXN5NQa") | * | messageType | String | When the file is generated by the Rainbow visual voice mail feature - The message type

Valeur par défaut : `voice_message`

Valeurs autorisées : `voice_message`, `conv_recording` | * | duration | Number | The message duration in second (voice message duration) | * | id | String | File unique identifier (like 56d0277a0261b53142a5cab5) | * | fileName | String | Name of the file | * | extension | String | File extension (jpeg, txt, ...) | * | typeMIME | String | https://fr.wikipedia.org/wiki/Type_MIME (image/jpeg, text/plain, ...) | * | ownerId | String | Rainbow Id of the file owner. Useful to filter file descriptor for files shared inside a room. In this case the provider is also a viewer. | * | isUploaded | Boolean | true when the file was uploaded at least one time | * | size | Number | Size of the file (Default: value given by Rainbow clients). Refreshed from the backend file storage each time the file is uploaded. | * | viewers | Object\[\] | A set of objects including user or room Rainbow Id, type (user, room) | * | dateToSort | Date-Time | A processed date to help ordering descriptors not only from the file name.

dateToSort is processed as follow:

* `Default value`: either file is never uploaded : dateToSort = 1970-01-01T00:00:00.000Z or file is uploaded but no downloaded date is available : dateToSort = upLoadedDate
* In case of the viewerId is a user, a downloadedDate may override the default value. In this case dateToSort is the `downloadedDate`.
* When a query sorted by uploadedDate is wanted (`sort=uploadedDate`), no 'dateToSort' processing is done. The uploadedDate field is copied instead. | * | thumbnail | Object | Data of the thumbnail 'low resolution' (200X200 for images, 300x300 for .pdf, at least one dimension is 200 or 300)) | * | availableThumbnail | Boolean | Thumbnail availability | * | wantThumbnailDate | Date-Time | When the thumbnail is ordered | * | size | Number | Thumbnail size | * | md5sum | String | md5 of the thumbnail get from the backend file storage | * | typeMIME | String | https://fr.wikipedia.org/wiki/Type_MIME (application/octet-stream) | * | thumbnail500 | Object | Data of the thumbnail 'High resolution' (500x500 - at least one dimension is 500) | * | availableThumbnail | Boolean | Thumbnail availability | * | wantThumbnailDate | Date-Time | When the thumbnail is ordered | * | size | Number | Thumbnail size | * | md5sum | String | md5 of the thumbnail get from the backend file storage | * | isClean | Boolean | Null when the file is not yet scanned by an anti-virus | * | typeMIME | String | https://fr.wikipedia.org/wiki/Type_MIME (application/octet-stream) | * | avReport | String | Null when the file is not yet scanned by an anti-virus | * */ getFilesReceivedInBubble(bubble: any, ownerId: string, fileName: boolean, extension: string, typeMIME: string, isUploaded: boolean, purpose: string, roomName: string, overall: boolean, format: string, limit: number, offset: number, sortField: string, sortOrder: number): Promise; /** * @private * @description * Method returns a file descriptor with full contact object in viewers'list by requesting server
* * @category Files FILE MANAGEMENT / PROPERTIES * @async * @param {string} fileId [required] Identifier of file descriptor * @return {Promise} file descriptor * */ getCompleteFileDescriptorById(fileId: any): Promise; /** * * @private * * @category Files FILE MANAGEMENT / PROPERTIES * @return {FileDescriptor[]} */ getDocuments(): any; /** * * @private * * @category Files FILE MANAGEMENT / PROPERTIES * @return {FileDescriptor} */ getReceivedDocuments(): any; /** * * @private * * @category Files FILE MANAGEMENT / PROPERTIES * @param {boolean} received * @return {FileDescriptor[]} */ getDocumentsByName(received: any): any; /** * * @private * * @category Files FILE MANAGEMENT / PROPERTIES * @param {boolean} received * @return {FileDescriptor[]} */ getDocumentsByDate(received: any): any; /** * * @private * * @category Files FILE MANAGEMENT / PROPERTIES * @param {boolean} received * @return {FileDescriptor[]} */ getDocumentsBySize(received: any): any; /** * * @private * * @category Files FILE MANAGEMENT / PROPERTIES * @param {string} dbId * @return {FileDescriptor[]} */ getReceivedFilesFromContact(dbId: any): any; /** * * @private * * @category Files FILE MANAGEMENT / PROPERTIES * @param {string} dbId * @return {FileDescriptor[]} */ getSentFilesToContact(dbId: any): any; /** * @nodered true * @method getReceivedFilesForRoom * @public * * @instance * @category Files FILE MANAGEMENT / PROPERTIES * @param {string} bubbleId id of the bubble * @description * Method to get the list of received files descriptors. * @return {FileDescriptor[]} */ getReceivedFilesForRoom(bubbleId: any): any; /** * * @category Files FILE MANAGEMENT / PROPERTIES * @private * * @return {Object} */ getConsumptionData(): any; /**********************************************************/ /** Methods requesting server **/ /**********************************************************/ /** * @private * @description * Method requests server to create a file descriptor this will be saved to local file descriptor list (i.e. this.fileDescriptors)
* * @category Files FILE MANAGEMENT / PROPERTIES * @param {string} name [required] name of file for which file descriptor has to be created * @param {string} extension [required] extension of file * @param {number} size [required] size of file * @param {FileViewer[]} viewers [required] list of viewers having access to the file (a viewer could be either be a user or a room) * @param {boolean} voicemessage When set to True, that allows to identify voice memos in a chat or multi-users chat conversation. * @param {number} duration The voice message in seconds. This field must be a positive number and is only taken into account when voicemessage is true. * @param {boolean} encoding AAC is the choosen format to encode a voice message. This is the native format for mobile clients, nor web client (OPUS, OGG..). This field must be set to true to order a transcodind and is only taken into account when voicemessage is true. * @param {boolean} ccarelogs When set to True, that allows to identify a log file uploaded by the user * @param {boolean} ccareclientlogs When set to True, that allows to identify a log file uploaded automatically by the client application * @return {Promise} file descriptor created by server or error * */ createFileDescriptor(name: any, extension: any, size: any, viewers: any, voicemessage?: boolean, duration?: number, encoding?: boolean, ccarelogs?: boolean, ccareclientlogs?: boolean): Promise; /** * * @private * * @category Files FILE MANAGEMENT / PROPERTIES * @param {*} data * @return {FileDescriptor} */ createFileDescriptorFromData(data: any): any; /** * @private * @description * * Method request deletion of a file descriptor on the server and removes it from local storage
* @category Files FILE MANAGEMENT / PROPERTIES * @param {string} id [required] file descriptor id to be destroyed * @return {Promise} list of remaining file descriptors */ deleteFileDescriptor(id: any): Promise; /** * @private * * @category Files FILE MANAGEMENT / PROPERTIES * @description * Method request deletion of all files on the server and removes them from local storage
* @return {Promise<{}>} ??? */ deleteAllFileDescriptor(): Promise; /** * @public * @nodered true * @method retrieveFileDescriptorsListPerOwner * @category Files FILE MANAGEMENT / PROPERTIES * @async * @instance * @param {string} fileName Allows to filter file descriptors by fileName criterion. * @param {string} extension Allows to filter file descriptors by extension criterion. * @param {string} typeMIME Allows to filter file descriptors by typeMIME criterion. * typeMIME='image/jpeg' allows to get all jpeg file * typeMime='image' allows to get all image files whatever the extension * typeMIME='image/jpeg'&typeMIME='image/png' allows to get all jpeg and png files * typeMIME='image'&typeMIME='video' allows to get all image and video files whatever the extension * @param {string} purpose Allows to filter file descriptors by the utility of the file (conference_record for instance). purpose=conference_record allows to get all records of conference * @param {boolean} isUploaded Allows to filter file descriptors by isUploaded criterion. * @param {string} viewerId Among all files shared by the user, allow to specify a viewer. * @param {string} path For visual voice mail feature only (step1), allows to get file descriptors of each file under the given path. * @param {number} limit=1000 Allow to specify the number of items to retrieve. Default value : 1000 Possibles values : 0-1000 * @param {number} offset=0 Allow to specify the position of first item to retrieve (first item if not specified). Warning: if offset > total, no results are returned. Default value : 0 * @param {string} sortField Sort items list based on the given field. * @param {string} sortOrder=1 Specify order when sorting items list. Default value : 1 Possibles values : -1, 1 * @param {string} format="full" Allows to retrieve more or less file descriptors details in response. * small: _id, fileName, extension, isClean * medium: _id, fileName, extension, typeMIME, size, isUploaded,isClean, avReport, thumbnail, thumbnail500, original_w, original_h * full: all descriptors fields except storageURL * Default value : full Possibles values : "small", "medium", "full" * @description * Method retrieve full list of files belonging to user making the request
* * @return {Promise} * */ retrieveFileDescriptorsListPerOwner(fileName?: string, extension?: string, typeMIME?: string, purpose?: string, isUploaded?: boolean, viewerId?: string, path?: string, limit?: number, offset?: number, sortField?: string, sortOrder?: number, format?: string): Promise<[any]>; /** * @private * * @category Files FILE MANAGEMENT / PROPERTIES * @description * Method retrieve a list of [limit] files belonging to user making the request begining with offset
* * @return {Promise} * */ retrieveFileDescriptorsListPerOwnerwithOffset(fileName: string, extension: string, typeMIME: string, purpose: string, isUploaded: boolean, viewerId: string, path: string, limit: number, offset: number, sortField: string, sortOrder: number, format?: string): Promise; /** * @private * * @description * Method request for the list of files received by a user from a given peer (i.e. inside a given conversation)
* * @category Files FILE MANAGEMENT / PROPERTIES * @async * @param {string} userId [required] dbId of user making the request * @param {string} peerId [required] dbId of peer user in the conversation * @return {Promise} : list of received files descriptors * */ retrieveFilesReceivedFromPeer(userId: any, peerId: any): Promise; /** * @public * @nodered true * @method retrieveSentFiles * @category Files FILE MANAGEMENT / PROPERTIES * @instance * @description * Method request for the list of files sent to a given peer (i.e. inside a given conversation)
* * @param {string} peerId [required] id of peer user in the conversation * @param {string} fileName Allows to filter file descriptors by fileName criterion. * @param {string} extension Allows to filter file descriptors by extension criterion. * @param {string} typeMIME Allows to filter file descriptors by typeMIME criterion. * typeMIME='image/jpeg' allows to get all jpeg file * typeMime='image' allows to get all image files whatever the extension * typeMIME='image/jpeg'&typeMIME='image/png' allows to get all jpeg and png files * typeMIME='image'&typeMIME='video' allows to get all image and video files whatever the extension * @param {string} purpose Allows to filter file descriptors by the utility of the file (conference_record for instance). purpose=conference_record allows to get all records of conference * @param {boolean} isUploaded Allows to filter file descriptors by isUploaded criterion. * @param {string} path For visual voice mail feature only (step1), allows to get file descriptors of each file under the given path. * @param {number} limit Allow to specify the number of items to retrieve. Default value : 1000 Possibles values : 0-1000 * @param {number} offset Allow to specify the position of first item to retrieve (first item if not specified). Warning: if offset > total, no results are returned. Default value : 0 * @param {string} sortField Sort items list based on the given field. * @param {string} sortOrder Specify order when sorting items list. Default value : 1 Possibles values : -1, 1 * @param {string} format Allows to retrieve more or less file descriptors details in response. * small: _id, fileName, extension, isClean * medium: _id, fileName, extension, typeMIME, size, isUploaded,isClean, avReport, thumbnail, thumbnail500, original_w, original_h * full: all descriptors fields except storageURL * Default value : full Possibles values : "small", "medium", "full" * @return {Promise} : list of sent files descriptors * */ retrieveSentFiles(peerId: string, fileName?: string, extension?: string, typeMIME?: string, purpose?: string, isUploaded?: boolean, path?: string, limit?: number, offset?: number, sortField?: string, sortOrder?: number, format?: string): Promise; /** * @public * * @nodered true * @method retrieveReceivedFilesForRoom * @instance * @description * Method request for the list of files received in a room
* * @category Files FILE MANAGEMENT / PROPERTIES * @param {string} bubbleId [required] Id of the room * @param {string} ownerId Among all files shared with the user, allow to precify a provider. * @param {boolean} fileName Allows to filter file descriptors by fileName criterion. * @param {string} extension Allows to filter file descriptors by extension criterion. * @param {string} typeMIME Allows to filter file descriptors by typeMIME criterion. * typeMIME='image/jpeg' allows to get all jpeg file * typeMime='image' allows to get all image files whatever the extension * typeMIME='image/jpeg'&typeMIME='image/png' allows to get all jpeg and png files * typeMIME='image'&typeMIME='video' allows to get all image and video files whatever the extension * @param {boolean} isUploaded Allows to filter file descriptors by isUploaded criterion. * @param {string} purpose Allows to filter file descriptors by the utility of the file (conference_record for instance). purpose=conference_record allows to get all records of conference * @param {string} roomName A word of the conference name. When purpose=conference_record is used, allow to reduce the list of results focusing of the recording name. * @param {boolean} overall When true, allow to get all files (my files and received files) in the same paginated list * @param {string} format Allows to retrieve viewers of each file when the format is full. * small: _id fileName extension typeMIME ownerId isUploaded uploadedDate size thumbnail thumbnail500 isClean tags * medium: _id fileName extension typeMIME ownerId isUploaded uploadedDate size thumbnail thumbnail500 isClean tags * full: _id fileName extension typeMIME ownerId isUploaded uploadedDate size viewers thumbnail thumbnail500 isClean tags * Default value : full Possibles values : small, medium, full * @param {number} limit Allow to specify the number of fileDescriptors to retrieve. Default value : 1000 * @param {number} offset Allow to specify the position of first fileDescriptor to retrieve (first fileDescriptor if not specified). Warning: if offset > total, no results are returned. * @param {string} sortField Sort fileDescriptor list based on the given field. Default value : fileName * @param {number} sortOrder Specify order when sorting fileDescriptor list (1: arranged in alphabetical order, -1: reverse order). Default value : 1 Possibles values : -1, 1 * @return {Promise} : list of received files descriptors * * * | Champ | Type | Description | * | --- | --- | --- | * | data | Object | File descriptor Object | * | tags | Object | Wrap a set of data according with the file use | * | path | String | The path under which the owner will be able to classified the file. The folder management is not yet available; only a get files per path. For instance this facility is used to implement OXO visual voice mail feature on client side.

* /
* /voice-messages | * | msgId | String | When the file is generated by the Rainbow visual voice mail feature - The message Id (ex: "g0F6jhGrIXN5NQa") | * | messageType | String | When the file is generated by the Rainbow visual voice mail feature - The message type

Valeur par défaut : `voice_message`

Valeurs autorisées : `voice_message`, `conv_recording` | * | duration | Number | The message duration in second (voice message duration) | * | id | String | File unique identifier (like 56d0277a0261b53142a5cab5) | * | fileName | String | Name of the file | * | extension | String | File extension (jpeg, txt, ...) | * | typeMIME | String | https://fr.wikipedia.org/wiki/Type_MIME (image/jpeg, text/plain, ...) | * | ownerId | String | Rainbow Id of the file owner. Useful to filter file descriptor for files shared inside a room. In this case the provider is also a viewer. | * | isUploaded | Boolean | true when the file was uploaded at least one time | * | size | Number | Size of the file (Default: value given by Rainbow clients). Refreshed from the backend file storage each time the file is uploaded. | * | viewers | Object\[\] | A set of objects including user or room Rainbow Id, type (user, room) | * | dateToSort | Date-Time | A processed date to help ordering descriptors not only from the file name.

dateToSort is processed as follow:

* `Default value`: either file is never uploaded : dateToSort = 1970-01-01T00:00:00.000Z or file is uploaded but no downloaded date is available : dateToSort = upLoadedDate
* In case of the viewerId is a user, a downloadedDate may override the default value. In this case dateToSort is the `downloadedDate`.
* When a query sorted by uploadedDate is wanted (`sort=uploadedDate`), no 'dateToSort' processing is done. The uploadedDate field is copied instead. | * | thumbnail | Object | Data of the thumbnail 'low resolution' (200X200 for images, 300x300 for .pdf, at least one dimension is 200 or 300)) | * | availableThumbnail | Boolean | Thumbnail availability | * | wantThumbnailDate | Date-Time | When the thumbnail is ordered | * | size | Number | Thumbnail size | * | md5sum | String | md5 of the thumbnail get from the backend file storage | * | typeMIME | String | https://fr.wikipedia.org/wiki/Type_MIME (application/octet-stream) | * | thumbnail500 | Object | Data of the thumbnail 'High resolution' (500x500 - at least one dimension is 500) | * | availableThumbnail | Boolean | Thumbnail availability | * | wantThumbnailDate | Date-Time | When the thumbnail is ordered | * | size | Number | Thumbnail size | * | md5sum | String | md5 of the thumbnail get from the backend file storage | * | isClean | Boolean | Null when the file is not yet scanned by an anti-virus | * | typeMIME | String | https://fr.wikipedia.org/wiki/Type_MIME (application/octet-stream) | * | avReport | String | Null when the file is not yet scanned by an anti-virus | * */ retrieveReceivedFilesForRoom(bubbleId: any, ownerId: string, fileName: boolean, extension: string, typeMIME: string, isUploaded: boolean, purpose: string, roomName: string, overall: boolean, format?: string, limit?: number, offset?: number, sortField?: string, sortOrder?: number): Promise; /** * * @public * @nodered true * @method retrieveReceivedFiles * @category Files FILE MANAGEMENT / PROPERTIES * @instance * @async * @description * Method request for the list of files received by a user
* * @param {string} viewerId [required] Id of the viewer, could be either an userId or a bubbleId * @param {string} ownerId Among all files shared with the user, allow to precify a provider. Example a peerId in a face to face conversation. * @param {boolean} fileName Allows to filter file descriptors by fileName criterion. * @param {string} extension Allows to filter file descriptors by extension criterion. * @param {string} typeMIME Allows to filter file descriptors by typeMIME criterion.
* typeMIME='image/jpeg' allows to get all jpeg file
* typeMime='image' allows to get all image files whatever the extension
* typeMIME='image/jpeg'&typeMIME='image/png' allows to get all jpeg and png files
* typeMIME='image'&typeMIME='video' allows to get all image and video files whatever the extension
* @param {boolean} isUploaded Allows to filter file descriptors by isUploaded criterion. * @param {string} purpose Allows to filter file descriptors by the utility of the file (conference_record for instance).
purpose=conference_record allows to get all records of conference * @param {string} roomName A word of the conference name. When purpose=conference_record is used, allow to reduce the list of results focusing of the recording name. * @param {boolean} overall When true, allow to get all files (my files and received files) in the same paginated list * @param {string} format Allows to retrieve viewers of each file when the format is full. * small: _id fileName extension typeMIME ownerId isUploaded uploadedDate size thumbnail thumbnail500 isClean tags * medium: _id fileName extension typeMIME ownerId isUploaded uploadedDate size thumbnail thumbnail500 isClean tags * full: _id fileName extension typeMIME ownerId isUploaded uploadedDate size viewers thumbnail thumbnail500 isClean tags * Default value : full. Possibles values : small, medium, full * @param {number} limit Allow to specify the number of fileDescriptors to retrieve. Default value : 100 * @param {number} offset Allow to specify the position of first fileDescriptor to retrieve (first fileDescriptor if not specified). Warning: if offset > total, no results are returned. * @param {string} sortField Sort fileDescriptor list based on the given field. Default value : fileName * @param {number} sortOrder Specify order when sorting fileDescriptor list (1: arranged in alphabetical order, -1: reverse order). Default value : 1. Possibles values : -1, 1 * @return {Promise} : list of received files descriptors * */ retrieveReceivedFiles(viewerId: string, ownerId: string, fileName: boolean, extension: string, typeMIME: string, isUploaded: boolean, purpose: string, roomName: string, overall: boolean, format: string, limit: number, offset: number, sortField?: string, sortOrder?: number): Promise; /** * @public * @since 1.47.1 * @nodered true * @method getFilesSentInConversation * @instance * @category Files FILE MANAGEMENT / PROPERTIES * @param {Conversation} conversation The conversation where to get the files * @param {boolean} fileName Allows to filter file descriptors by fileName criterion. * @param {string} extension Allows to filter file descriptors by extension criterion. * @param {string} typeMIME Allows to filter file descriptors by typeMIME criterion.
* typeMIME='image/jpeg' allows to get all jpeg file
* typeMime='image' allows to get all image files whatever the extension
* typeMIME='image/jpeg'&typeMIME='image/png' allows to get all jpeg and png files
* typeMIME='image'&typeMIME='video' allows to get all image and video files whatever the extension
* @param {boolean} isUploaded Allows to filter file descriptors by isUploaded criterion. * @param {string} purpose Allows to filter file descriptors by the utility of the file (conference_record for instance).
purpose=conference_record allows to get all records of conference * @param {string} format Allows to retrieve viewers of each file when the format is full. * small: _id fileName extension typeMIME ownerId isUploaded uploadedDate size thumbnail thumbnail500 isClean tags * medium: _id fileName extension typeMIME ownerId isUploaded uploadedDate size thumbnail thumbnail500 isClean tags * full: _id fileName extension typeMIME ownerId isUploaded uploadedDate size viewers thumbnail thumbnail500 isClean tags * Default value : full. Possibles values : small, medium, full * @param {number} limit Allow to specify the number of fileDescriptors to retrieve. Default value : 100 * @param {number} offset Allow to specify the position of first fileDescriptor to retrieve (first fileDescriptor if not specified). Warning: if offset > total, no results are returned. * @param {string} sortField Sort fileDescriptor list based on the given field. Default value : fileName * @param {number} sortOrder Specify order when sorting fileDescriptor list (1: arranged in alphabetical order, -1: reverse order). Default value : 1. Possibles values : -1, 1 * @description * Get the list of all files sent in a conversation with a contact
* Return a promise
* @return {FileDescriptor[]} Return an array of file descriptors found or an empty array if no file descriptor has been found */ getFilesSentInConversation(conversation: any, fileName: string, extension: string, typeMIME: string, purpose: string, isUploaded: boolean, path: string, limit: number, offset: number, sortField: string, sortOrder: number, format?: string): Promise; /** * @public * @nodered true * @since 1.47.1 * @method getFilesSentInBubble * @instance * @param {Bubble} bubble The bubble where to get the files * @param {boolean} fileName Allows to filter file descriptors by fileName criterion. * @param {string} extension Allows to filter file descriptors by extension criterion. * @param {string} typeMIME Allows to filter file descriptors by typeMIME criterion.
* typeMIME='image/jpeg' allows to get all jpeg file
* typeMime='image' allows to get all image files whatever the extension
* typeMIME='image/jpeg'&typeMIME='image/png' allows to get all jpeg and png files
* typeMIME='image'&typeMIME='video' allows to get all image and video files whatever the extension
* @param {boolean} isUploaded Allows to filter file descriptors by isUploaded criterion. * @param {string} purpose Allows to filter file descriptors by the utility of the file (conference_record for instance).
purpose=conference_record allows to get all records of conference * @param {string} path For visual voice mail feature only (step1), allows to get file descriptors of each file under the given path. * @param {string} format Allows to retrieve viewers of each file when the format is full. * small: _id fileName extension typeMIME ownerId isUploaded uploadedDate size thumbnail thumbnail500 isClean tags * medium: _id fileName extension typeMIME ownerId isUploaded uploadedDate size thumbnail thumbnail500 isClean tags * full: _id fileName extension typeMIME ownerId isUploaded uploadedDate size viewers thumbnail thumbnail500 isClean tags * Default value : full. Possibles values : small, medium, full * @param {number} limit Allow to specify the number of fileDescriptors to retrieve. Default value : 100 * @param {number} offset Allow to specify the position of first fileDescriptor to retrieve (first fileDescriptor if not specified). Warning: if offset > total, no results are returned. * @param {string} sortField Sort fileDescriptor list based on the given field. Default value : fileName * @param {number} sortOrder Specify order when sorting fileDescriptor list (1: arranged in alphabetical order, -1: reverse order). Default value : 1. Possibles values : -1, 1 * @category Files FILE MANAGEMENT / PROPERTIES * @description * Get the list of all files sent in a bubble
* Return a promise
* @return {FileDescriptor[]} Return an array of file descriptors found or an empty array if no file descriptor has been found */ getFilesSentInBubble(bubble: any, fileName: string, extension: string, typeMIME: string, purpose: string, isUploaded: boolean, path: string, limit: number, offset: number, sortField: string, sortOrder: number, format?: string): Promise; /** * @public * @nodered true * @since 1.47.1 * @method getUserQuotaConsumption * @category Files FILE MANAGEMENT / PROPERTIES * @instance * @description * Get the current file storage quota and consumption for the connected user
* Return a promise
* @return {Object} Return an object containing the user quota and consumption */ getUserQuotaConsumption(): Promise; /** * @public * @nodered true * @since 1.47.1 * @method getAllFilesSent * @instance * @category Files FILE MANAGEMENT / PROPERTIES * @description * Get the list of files (represented using an array of File Descriptor objects) created and owned by the connected which is the list of file sent to all of his conversations and bubbles.
* @return {FileDescriptor[]} Return an array containing the list of FileDescriptor objects representing the files sent */ getAllFilesSent(): any; /** * @public * @nodered true * @since 1.47.1 * @method getAllFilesReceived * @instance * @category Files FILE MANAGEMENT / PROPERTIES * @description * Get the list of files (represented using an array of File Descriptor objects) received by the connected user from all of his conversations and bubbles.
* @return {FileDescriptor[]} Return an array containing a list of FileDescriptor objects representing the files received */ getAllFilesReceived(): any; /** * @private * * @category Files FILE MANAGEMENT / PROPERTIES * @description * Method retrieve the data usage of a given user
* * @return {Promise<{}>} : object data with the following properties: * - feature {string} : The feature key belonging to the user's profile * - maxValue {number} : The quota associated to this offer [octet] * - currentValue {number} : The user's current consumption [octet] * - unit {string} : The unit of this counters */ retrieveUserConsumption(): Promise; /** * @private * * @description * Method deletes a viewer from the list of viewer of a given file
* * @category Files FILE MANAGEMENT / PROPERTIES * @param {string} viewerId [required] Identifier of viewer to be removed. Could be either a user or a room * @param {string} fileId [required] Identifier of the fileDescriptor from which the viewer will be removed * @return {Promise<{}>} * */ deleteFileViewer(viewerId: any, fileId: any): Promise; /** * * @private * * @description * Method adds a viewer to a given file on server if it is not already one * * @category Files FILE MANAGEMENT / PROPERTIES * @param {string} fileId [required] Identifier of file * @param {string} viewerId [required] Identifier of viewer to be added * @param {string} viewerType [required] type of viewer to be added (user or room) * @return {Promise} file descriptor with newly added viewer * */ addFileViewer(fileId: any, viewerId: any, viewerType: any): Promise; /** * @public * @nodered true * @method retrieveOneFileDescriptor * @instance * @category Files FILE MANAGEMENT / PROPERTIES * @description * Method retrieve a specific file descriptor from server
* * @param {string} fileId [required] Identifier of file descriptor to retrieve * @return {Promise} file descriptor retrieved * */ retrieveOneFileDescriptor(fileId: any): Promise; /** * @private * * @description * Method retrieve a specific file descriptor from server and stores it in local fileDescriptors (replace existing and add if new)
* * @category Files FILE MANAGEMENT / PROPERTIES * @param {string} fileId [required] Identifier of file descriptor to retrieve * @return {Promise} file descriptor retrieved or null if none found * */ retrieveAndStoreOneFileDescriptor(fileId: any, forceRetrieve: any): Promise; /** * @public * @nodered true * @method getFileDescriptorsByCompanyId * @instance * @category Files FILE MANAGEMENT / PROPERTIES * @description * Get all file descriptors belonging to a given companyId.
* The result is paginated.
* * @param {string} companyId Company unique identifier. If no value is provided then the companyId of the connected user is used. * @param {boolean} fileName Allows to filter file descriptors by fileName criterion. * @param {string} extension Allows to filter file descriptors by extension criterion. * @param {string} typeMIME Allows to filter file descriptors by typeMIME criterion.
*
* - typeMIME=audio/wav allows to get all wav file
* - typeMime=audio allows to get all audio files whatever the extension
* - typeMIME=audio/wav&typeMIME=audio/mp3 allows to get all wav and mp3 files
*
* @param {string} purpose Allows to filter file descriptors by the utility of the file (rvcp_voice_promp, rvcp_record).
*
* - purpose=rvcp_voice_promp allows to get all voice prompt used by Rainbow Voice Communication Platform
* - purpose=rvcp_record allows to get all records generated by Rainbow Voice Communication Platform
* - purpose=rvcp allows to get all Rainbow Voice Communication Platform files
*
* @param {boolean} isUploaded Allows to filter file descriptors by isUploaded criterion. * @param {string} format Allows to retrieve viewers of each file when the format is full.
*
* - small: _id, fileName, extension, isClean
* - medium: _id, fileName, extension, typeMIME, size, isUploaded,isClean, avReport, thumbnail, thumbnail500, original_w, original_h
* - full: all descriptors fields except storageURL
*
* Default value : small
* Possible values : small, medium, full
*
* @param {number} limit Allow to specify the number of fileDescriptors to retrieve. Default value : 100 * @param {number} offset Allow to specify the position of first fileDescriptor to retrieve (first fileDescriptor if not specified). Warning: if offset > total, no results are returned. * @param {string} sortField Sort fileDescriptor list based on the given field. Default value : fileName * @param {number} sortOrder Specify order when sorting fileDescriptor list (1: arranged in alphabetical order, -1: reverse order). Default value : 1. Possible values : -1, 1 * @return {Promise} all file descriptors belonging to a given companyId. * */ getFileDescriptorsByCompanyId(companyId?: string, fileName?: boolean, extension?: string, typeMIME?: string, purpose?: string, isUploaded?: boolean, format?: string, limit?: number, offset?: number, sortField?: string, sortOrder?: number): Promise; /** * @public * @nodered true * @method copyFileInPersonalCloudSpace * @instance * @category Files FILE MANAGEMENT / PROPERTIES * @description * This API allows to keep a copy in my personal cloud space. Then: * - A new file descriptor is created. * - The viewer becomes owner. The file has not yet viewer. * - A copy of the file is put in the viewer's personal cloud space. * - A STANZA MESSAGE (type management) is sent to the owner of this new file. (tag 'file', action='update') * * To copy the file you must: * * - have enough space to store the file.(errorDetailsCode: 403630) * - not be the owner of the file.(errorDetailsCode: 403631) * - be an allowed viewer. The file is shared via a conversation or via a room.(errorDetailsCode: 403632) * - copy a file uploaded.(errorDetailsCode: 403630) * - have a personal cloud space in the same data center than the owner of the file. * * @param {string} fileId [required] Identifier of file descriptor to modify * @return {Promise} File descriptor Object * */ copyFileInPersonalCloudSpace(fileId: string): Promise; /** * @public * @nodered true * @method fileOwnershipChange * @instance * @category Files FILE MANAGEMENT / PROPERTIES * @description * As a file owner, I want to Drop the ownership to another Rainbow user of the same company.
* Then:
*
* The former owner becomes a viewer to stay allowed to get the display of the file.
* The new owner may loose his status of viewer when needed (as he becomes owner).
*
* Error cases: * * - the former owner's company must allow file ownership change (forbidFileOwnerChangeCustomisation == disabled) errorDetailCode 403156 Access denied: this API can only be called by users having the feature key forbidFileOwnerChangeCustomisation disabled * - the logged in user is not the owner (errorDetailsCode: 403629) * - the new owner must belong to the same company of the current owner. errorDetailCode 403637 User [userId] doesn't belong to the company [companyId] * - the target file is not uploaded yet. errorDetailCode 403638 File [fileId] is not uploaded yet. So it can't be re-allocated. * - the new owner must have enough space to store the file.(errorDetailsCode: 403630) * - A STANZA MESSAGE (type management) is sent to the owner and each viewers. (tag 'file', action='update', owner='xxxxxxxxxxxxx') * * @param {string} fileId [required] Identifier of file descriptor to modify * @param {string} userId ID of another user which will become owner. * @return {Promise} File descriptor Object * * * | Champ | Type | Description | * | --- | --- | --- | * | data | Object | File descriptor Object | * | id | String | File unique identifier (like 56d0277a0261b53142a5cab5) | * | fileName | String | Name of the file | * | ownerId | String | Rainbow Id of the file owner | * | md5sum | String | md5 of the file get from the backend file storage (default: "", refreshed each time the file is uploaded) | * | extension | String | File extension (jpeg, txt, ...) | * | typeMIME | String | https://fr.wikipedia.org/wiki/Type_MIME (image/jpeg,text/plain,...) | * | size | Number | Size of the file (Default: value given by Rainbow clients). Refreshed from the backend file storage each time the file is uploaded. | * | registrationDate | Date-Time | Date when the submit to upload this file was registered | * | isUploaded | Boolean | true when the file was uploaded at least one time | * | uploadedDate | Date-Time | Last time when the file was uploaded | * | viewers | Object\[\] | A set of objects including user or room Rainbow Id, type (user, room) | * | thumbnail | Object | Data of the thumbnail 'low resolution' (200X200 for images, 300x300 for .pdf, at least one dimension is 200 or 300)) | * | availableThumbnail | Boolean | Thumbnail availability | * | wantThumbnailDate | Date-Time | When the thumbnail is ordered | * | size | Number | Thumbnail size | * | md5sum | String | md5 of the thumbnail get from the backend file storage | * | typeMIME | String | https://fr.wikipedia.org/wiki/Type_MIME (application/octet-stream) | * | thumbnail500 | Object | Data of the thumbnail 'High resolution' (500x500 - at least one dimension is 500) | * | availableThumbnail | Boolean | Thumbnail availability | * | wantThumbnailDate | Date-Time | When the thumbnail is ordered | * | size | Integer | Thumbnail size | * | md5sum | String | md5 of the thumbnail get from the backend file storage | * | isClean | Boolean | Null when the file is not yet scanned by an anti-virus | * | typeMIME | String | https://fr.wikipedia.org/wiki/Type_MIME (application/octet-stream) | * | avReport | String | Null when the file is not yet scanned by an anti-virus | * | original_w | Number | For images only (jpeg, jpg, png, gif, pdf), this is the original width. It is processed at the same time as the thumbnails processing. (asynchronously) | * | original_h | Number | For images only (jpeg, jpg, png, gif, pdf), this is the original height. It is processed at the same time as the thumbnails processing. (asynchronously) | * | tags | Object | Wrap a set of data according with the file use | * | path | String | The path under which the owner will be able to classified the file. The folder management is not yet available; only a get files per path. For instance this facility is used to implement OXO visual voice mail feature on client side.

* /
* /voice-messages | * | msgId | String | When the file is generated by the Rainbow visual voice mail feature - The message Id (ex: "g0F6jhGrIXN5NQa") | * | messageType | String | When the file is generated by the Rainbow visual voice mail feature - The message type

default : `voice_message`

Possible values : `voice_message`, `conv_recording` | * | duration | Number | The message duration in second (voice message duration) | * * */ fileOwnershipChange(fileId: any, userId: any): Promise; /**********************************************************/ /** Utilities **/ /**********************************************************/ deleteFileDescriptorFromCache(id: any, forceDelete: any): void; orderDocuments(): void; orderReceivedDocuments(): void; orderDocumentsForRoom(documents: any): any[]; replaceOrderedByFilter(resultArray: any, originalArray: any, filterFct: any, flag: any, sortFct: any): void; getName(file: any): { name: string; date: string; }; getDate(file: any): any; getSize(file: any): { name: string; size: string; }; sortByName(fileA: any, fileB: any): number; sortBySize(fileA: any, fileB: any): number; sortByDate(fileA: any, fileB: any): number; /** * @private * * @description * Method extract fileId part of URL
* * @param {string} url * @return {string} * */ extractFileIdFromUrl(url: any): any; } export { FileStorage as FileStorageService, FileUpdated as FileUpdated };