import { HttpClient } from '@angular/common/http'; import { BehaviorSubject, Observable } from 'rxjs'; import { FileInfo, FileUploadError, GalaxyBaseUploaderServiceInterface, UploadResponse } from './uploader.interface'; import * as i0 from "@angular/core"; export declare class GalaxyUploaderService implements GalaxyBaseUploaderServiceInterface { protected http: HttpClient; /** List of current files in the upload queue */ protected files: FileInfo[]; /** Max number of files allowed for upload */ private maxFiles; /** Max size of the files allowed for upload. Bytes. */ private maxFileSize; /** Max number of files to upload in parallel. 0 means no limit */ private numParallel; /** Whether or not to auto upload files when added to the queue */ private autoUpload; /** URL to upload files to */ uploadUrl: string; /** Emits the current list of file info objects in the queue */ files$$: BehaviorSubject; /** Emits when a file has been uploaded successfully */ fileUploaded$$: BehaviorSubject; /** Emits when a file has failed to upload */ fileErrored$$: BehaviorSubject; constructor(http: HttpClient); /** Trigger an upload the provided file */ private uploadFile; /** Check queue to see if we can upload the next queued file */ private checkQueue; /** * Get the index of a file, in the queue * * @param fileInfo - The file info to lookup the index of */ private getFileIndex; /** * Mark a file as successfully uploaded * * @param fileInfo - File info object that has been uploaded * @param resp - API response data */ private onSuccess; /** * Mark a file as failed to upload * * @param fileInfo - File info object that has failed * @param error - Reason for the failure */ private onError; /** * Remove a file from the queue, making sure to stop any that are currently being uploaded * * @param index - index of the file to stop uploading and remove */ private removeFileAtIndex; /** * If the url is missing a protocol, add it. * * @param url - URL to add protocol to */ private prependProtocol; /** * Make a file info object and add it to the queue, and make sure it adheres to constraints. * Note that file type is checked by the html input via "accept" list * * @param file - File to add to the queue */ addFile(file: File): void; /** * Remove a file from the queue * * @param fileInfo - File to remove from the queue */ removeFile(fileInfo: FileInfo): void; /** Clear out the queue */ clear(): void; /** * Public interface for kicking off the entire queue to be uploaded */ uploadQueuedFiles(): void; setFiles(files: FileInfo[]): void; setMaxFiles(limit: number): void; setMaxFileSize(limit: number): void; setUploadUrl(url: string): void; setParallelUploads(limit: number): void; setAutoUpload(allowAuto: boolean): void; /** * Used to build an api request object for uploading files. * Note: This is to be overridden if adding own requeset functionality, testing, etc. * * @param fileInfo - File to upload */ buildRequest(fileInfo: FileInfo): Observable; /** * Refresh the file list for consumers */ protected refreshFiles(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; }