UNPKG

@agentman/chat-widget

Version:

Agentman Chat Widget for easy integration with web applications

34 lines (33 loc) 1.15 kB
import type { FileAttachment } from './types/types'; export declare class FileUploadManager { private apiUrl; private agentToken; private conversationId; constructor(apiUrl: string, agentToken: string, conversationId: string); /** * Upload a file to the runtime file service * @param file The file to upload * @param onProgress Optional callback for upload progress * @returns Promise with the file attachment data */ uploadFile(file: File, onProgress?: (progress: number) => void): Promise<FileAttachment>; /** * Delete a file from the runtime file service * @param fileId The ID of the file to delete */ deleteFile(fileId: string): Promise<void>; /** * Determine the file type category based on MIME type */ getFileType(file: File): FileAttachment['file_type']; /** * Validate file before upload * @param file The file to validate * @returns Error message if invalid, null if valid */ validateFile(file: File): string | null; /** * Format file size for display */ static formatFileSize(bytes: number): string; }