import { Observable } from 'rxjs';
import { CancellationToken } from '../async/cancellation';
import { Progress } from '../async/progress';
import { AuthorizationManager } from '../security/authorization-manager';
import { GatewayConnection } from './gateway-connection';
import { NodeConnection } from './node-connection';
export interface FileOptions {
    /**
     * Indicates that audit logging for this request should be made. Default is false.
     */
    logAudit?: boolean;
    /**
     * Indicates that telemetry logging for this request should be made. Default is false.
     */
    logTelemetry?: boolean;
}
/** Represents a object that transfers files */
export declare class FileTransfer {
    private nodeConnection;
    private gatewayConnection;
    private authorizationManager;
    private moduleName;
    /**
     * Downloads a blob of data
     *
     * @param blob the blob of data to download
     * @param fileName the name of the file for the user to download.
     */
    static downloadBlob(blob: Blob, fileName: string): void;
    /**
     * Navigates to a file.
     *
     * @param filePath the file path we are navigating to.
     */
    static navigateToFile(filePath: string): void;
    /**
     * Initializes a new instance of the FileTransfer class.
     *
     * @param nodeConnection the NodeConnection class instance.
     * @param gatewayConnection the GatewayConnection class instance.
     * @param authorizationManager the AuthorizationManager class instance.
     */
    constructor(nodeConnection: NodeConnection, gatewayConnection: GatewayConnection, authorizationManager: AuthorizationManager);
    private static generateRanges;
    private static extractNode;
    /**
     * The GET call to file transfer endpoint and return a Blob of the requested file
     *
     * @param nodeName the node to transfer the file from.
     * @param sourcePath the path of the remote file to transfer.
     * @param fileOptions the file options for the action.
     * @return Observable<Blob> the observable Blob object.
     */
    transferBlob(nodeName: string, sourcePath: string, fileOptions?: FileOptions): Observable<Blob>;
    /**
     * The GET call to file transfer endpoint and manual download of stream
     *
     * @param nodeName the node to transfer the file from.
     * @param sourcePath the path of the remote file to transfer.
     * @param targetName the desired name for the downloaded file.
     * @param fileOptions the file options for the action.
     * @return Observable<Blob> the observable Blob object.
     */
    transferFile(nodeName: string, sourcePath: string, targetName: string, fileOptions?: FileOptions): Observable<Blob>;
    /**
     * Upload a file from fileObject.
     *
     * @deprecated Use upload instead.
     * @param nodeName the node to upload the file to.
     * @param path the file path to store on the target node.
     * @param fileObject the file object created on the UI.
     * @param fileOptions the file options for the action.
     * @return Observable<any> the observable object.
     */
    uploadFile(nodeName: string, path: string, fileObject: File, fileOptions?: FileOptions): Observable<any>;
    /**
     * Uploads the specified file.
     * @param node The target computer to upload the file to.
     * @param path The path on the target computer to upload the file to.
     * @param file The file to upload.
     * @param options The file upload options.
     * @param cancellationToken The token that can be used to cancel the operation.
     * @returns An observable object that contains the result of the file transfer.
     */
    upload(node: string, path: string, file: File, options?: FileUploadOptions, cancellationToken?: CancellationToken): Observable<FileTransferResult>;
    private uploadAsync;
    private uploadAllAtOnce;
    private uploadInParts;
    /**
     * Resumes a previously started file upload.
     * @param continuation The information required to continue the file transfer.
     * @param progress The object used to report the progress of the upload.
     * @param cancellationToken The token that can be used to cancel the operation.
     */
    resumeUpload(continuation: FileTransferContinuation, progress?: Progress<number>, cancellationToken?: CancellationToken): Observable<void>;
    private resumeUploadAsync;
    /**
     * Cancels a previously started file upload.
     * @param continuation The information required to cancel the file transfer.
     */
    cancelUpload(continuation: FileTransferContinuation): Observable<void>;
    private cancelUploadAsync;
    private newRequestHeaders;
    private newUpload;
    private uploadRanges;
    private uploadPartialFile;
    /**
     * Gets the name of current shell or module.
     */
    private get nameOfModule();
}
/** Represents the possible cancellation behaviors */
export declare enum FileTransferCancellationBehavior {
    /** Indicates the file transfer is cancelled or aborted on cancellation */
    Cancel = 0,
    /** Indicates the file transfer is paused on cancellation */
    Pause = 1
}
/** Represents file upload options. */
export declare class FileUploadOptions {
    /** Gets the size of transfer content. The default value is 10MB. */
    readonly transferSize: number;
    /** Indicates the behavior to perform if the operation is canceled. */
    readonly cancellationBehavior: FileTransferCancellationBehavior;
    /** A token that can be used to cancel the operation. */
    readonly progress: Progress<number>;
    /** Gets the associated logging options. */
    readonly logging: FileOptions;
    constructor(
    /** Gets the size of transfer content. The default value is 10MB. */
    transferSize?: number, 
    /** Indicates the behavior to perform if the operation is canceled. */
    cancellationBehavior?: FileTransferCancellationBehavior, 
    /** A token that can be used to cancel the operation. */
    progress?: Progress<number>, 
    /** Gets the associated logging options. */
    logging?: FileOptions);
}
/** Represents the size and progress of a file transfer. */
export declare class FileTransferInfo {
    /** Gets the size used in the file transfer. */
    readonly size: number;
    /** Gets the total number of items in the file transfer. */
    readonly count: number;
    private completed;
    constructor(
    /** Gets the size used in the file transfer. */
    size: number, 
    /** Gets the total number of items in the file transfer. */
    count: number);
    /** Gets the percentage of the file transfer completed. */
    get percentComplete(): number;
    /** Increments the number of completed items in the file transfer. */
    incrementCompleted(): void;
}
/** Represents a continuation for a file transfer */
export declare class FileTransferContinuation {
    /** Gets the URl representing the location of the file transfer */
    readonly location: string;
    /** Gets the continuation token for the file transfer */
    readonly token: string;
    /** Gets the file being transferred */
    readonly file: File;
    /** Gets the file transfer information. */
    readonly transfer: FileTransferInfo;
    /** Gets the remaining ranges in the file transfer */
    readonly ranges: ContentRange[];
    constructor(
    /** Gets the URl representing the location of the file transfer */
    location: string, 
    /** Gets the continuation token for the file transfer */
    token: string, 
    /** Gets the file being transferred */
    file: File, 
    /** Gets the file transfer information. */
    transfer: FileTransferInfo, 
    /** Gets the remaining ranges in the file transfer */
    ranges?: ContentRange[]);
}
/** Represents the result of a file transfer */
export declare class FileTransferResult {
    /** Gets the continuation token associated with the file transfer */
    readonly continuation: FileTransferContinuation;
    constructor(
    /** Gets the continuation token associated with the file transfer */
    continuation?: FileTransferContinuation);
    /** Gets a value indicating whether the file transfer is complete */
    get completed(): boolean;
    /** Gets a value indicating whether the file transfer is resumable */
    get resumable(): boolean;
}
/** Represent a range of content in a file transfer */
export declare class ContentRange {
    /** Gets the zero-based start of the content, in bytes */
    readonly from: number;
    /** Gets the zero-based end of the content, in bytes */
    readonly to: number;
    /** Gets the total size of the content in bytes */
    readonly totalSize: number;
    constructor(
    /** Gets the zero-based start of the content, in bytes */
    from: number, 
    /** Gets the zero-based end of the content, in bytes */
    to: number, 
    /** Gets the total size of the content in bytes */
    totalSize: number);
    /** Returns the string representation of the object */
    toString(): string;
}
