import type { EliceCDK } from './EliceCDK'; import type { FileMetadata } from './typings'; export interface EliceCDKFilestoreGetResponse extends FileMetadata { url: string; } /** * File storage interface for uploading and managing user files. * * Files are uploaded to Azure Blob Storage and tracked via the key-value store. * Maximum file size is 50 MB. */ export declare class EliceCDKFilestore { #private; private readonly ctx; constructor(ctx: EliceCDK); /** * Retrieves a file's metadata and download URL. * * @param key - The key used when uploading the file. * @returns File metadata (`name`, `size`, `mime`) and download `url`, or `null` if not found. * @throws {EliceCDKError} If the server response is invalid. * * @example * ```ts * import { EliceCDK } from '@eliceio/cdk'; * * const sdk = new EliceCDK(); * await sdk.init(); * * const file = await sdk.filestore.get('myDocument'); * if (file) { * console.log(file.name); // 'document.pdf' * console.log(file.url); // Download URL * } * ``` */ get(key: string): Promise; /** * Uploads a file to the file store. * * The file is uploaded to Azure Blob Storage and the reference is saved with the given key. * * @param key - Unique key to identify this file (camelCase, alphanumeric). * @param file - The `File` object to upload. * @throws {EliceCDKError} If file is not a `File` instance, exceeds 50 MB, or upload fails. * * @example * ```ts * import { EliceCDK } from '@eliceio/cdk'; * * const sdk = new EliceCDK(); * await sdk.init(); * * const fileInput = document.querySelector('#file-input'); * const file = fileInput?.files?.[0]; * * if (file) { * await sdk.filestore.post('userUpload', file); * } * ``` */ post(key: string, file: File): Promise; /** * Deletes a file reference from the file store. * * Note: This removes the key-value mapping; the underlying blob may be retained. * * @param key - The key of the file to delete. * @throws {EliceCDKError} If deletion fails. * * @example * ```ts * import { EliceCDK } from '@eliceio/cdk'; * * const sdk = new EliceCDK(); * await sdk.init(); * * await sdk.filestore.delete('userUpload'); * const file = await sdk.filestore.get('userUpload'); // null * ``` */ delete(key: string): Promise; }