export interface ZveltioClientConfig { baseUrl: string; apiKey?: string; headers?: Record; } export interface ListParams { page?: number; limit?: number; sort?: string; order?: 'asc' | 'desc'; search?: string; filter?: Record; cursor?: string; } export interface ListResult { data: T[]; total: number; page: number; limit: number; next_cursor?: string; } declare class CollectionRef> { private readonly name; private readonly client; constructor(name: string, client: ZveltioClient); list(params?: ListParams): Promise>; getMany(params?: ListParams): Promise>; get(id: string): Promise; getOne(id: string): Promise; create(data: Omit): Promise; update(id: string, data: Partial>): Promise; delete(id: string): Promise<{ success: boolean; }>; } /** * ZveltioClient — generic over your schema type. * * Usage with generated types (run `zveltio generate-types` once): * * import type { ZveltioSchema } from './zveltio-types'; * const client = createZveltioClient({ baseUrl: '...' }); * const { data } = await client.collection('products').list(); * // ^-- typed as your Products interface * * Usage without types (untyped, same as before): * const client = createZveltioClient({ baseUrl: '...' }); */ export declare class ZveltioClient = Record> { private baseUrl; private headers; constructor(config: ZveltioClientConfig); private request; get(path: string): Promise; post(path: string, body?: unknown): Promise; patch(path: string, body?: unknown): Promise; delete(path: string): Promise; upload(path: string, formData: FormData): Promise; /** * Returns a fully-typed collection reference. * If Schema is provided (via createZveltioClient()), * the return type reflects the collection's record shape. */ collection(name: K): CollectionRef; collection(name: string): CollectionRef>; /** Auth helpers */ readonly auth: { readonly login: (email: string, password: string) => Promise; readonly signup: (email: string, password: string, name: string) => Promise; readonly logout: () => Promise; readonly session: () => Promise; }; /** Storage helpers */ readonly storage: { readonly upload: (file: File, folder?: string) => Promise; readonly list: (folder?: string) => Promise; readonly delete: (key: string) => Promise; }; } export declare function createZveltioClient = Record>(config: ZveltioClientConfig): ZveltioClient; export {}; //# sourceMappingURL=client.d.ts.map