import { TotalumApiResponse } from "../common/interfaces"; import { FileDeleteResponse, OcrImageResponse, OcrPdfResponse, ScanInvoiceData, TranscribeAudioResponse } from "../common/response-types"; import { FetchClient } from "../common/fetch-client"; export declare class FilesService { private client; constructor(client: FetchClient); /** * Uploads a file to Totalum. * @param {FormData} fileFormData - The form data containing the file to upload * @param {object} options - Optional upload options * @param {boolean} options.compressFile - Whether to compress the file * @returns {Promise>} - File name ID */ uploadFile(fileFormData: FormData, options?: { compressFile?: boolean; }): Promise>; /** * Deletes a file from Totalum. * @param {string} fileName - The name of the file to delete * @returns {Promise>} */ deleteFile(fileName: string): Promise>; /** * Gets a signed download URL for a file. * @param {string} fileName - The name of the file * @param {object} options - Optional configuration * @param {number} options.expirationTime - Expiration time in milliseconds (default: 128 hours) * @returns {Promise>} - The download URL wrapped in an array, extract with result.data[0] */ getDownloadUrl(fileName: string, options?: { expirationTime?: number; }): Promise>; /** * Generates a PDF from a template. * @param {string} id - Template ID * @param {Record} variables - Variables to replace in template * @param {string} name - Name for the generated PDF * @returns {Promise>} - The generated PDF filename */ generatePdfByTemplate(id: string, variables: { [variableName: string]: any; }, name: string): Promise>; /** * Creates a PDF from HTML content. * @param {object} data - PDF creation data * @param {string} data.html - HTML content to convert * @param {string} data.name - Name for the generated PDF * @returns {Promise>} - The generated PDF url */ createPdfFromHtml(data: { html: string; name: string; }): Promise>; /** * Performs OCR on an image file. * @param {string} fileName - The file name of the uploaded image * @returns {Promise>} */ ocrOfImage(fileName: string): Promise>; /** * Performs OCR on a PDF file. * @param {string} fileName - The file name of the uploaded PDF * @returns {Promise>} */ ocrOfPdf(fileName: string): Promise>; /** * Scans an invoice and extracts information. * The response includes both data and metadata with OCR details and usage tracking. * @param {string} fileName - The file name of the uploaded invoice * @param {any} options - Optional scanning options * @returns {Promise>} */ scanInvoice(fileName: string, options?: any): Promise>; /** * Scans a document and extracts specified properties. * The response includes both data (based on provided schema) and metadata with OCR details. * @param {string} fileName - The file name of the uploaded document * @param {any} properties - Properties schema to extract from the document (JSON Schema format) * @param {any} options - Optional scanning options * @returns {Promise>} */ scanDocument(fileName: string, properties: any, options?: any): Promise>; /** * Transcribes audio to text using OpenAI Whisper. * Counts against the audioTranscriptions plan limit and falls back to credits when exceeded * (1 credit per transcription). * * Supported formats: mp3, mp4, mpeg, mpga, m4a, wav, webm, ogg, opus, flac. * Max file size: 5MB. * * @param {object} body - Transcription parameters * @param {string} body.audioBase64 - Audio file content encoded in base64 (no data: prefix) * @param {string} body.filename - Original filename including extension (e.g. "recording.mp3"); used to detect format * @returns {Promise>} - { text: string } with the transcribed audio */ transcribeAudio(body: { audioBase64: string; filename: string; }): Promise>; }