/** * API Client for RevealUI Admin Dashboard * Handles all API communication with authentication and error handling */ import type { RevealDocument } from '../../../types/index.js'; export interface APIResponse { docs?: T[]; doc?: T; totalDocs?: number; limit?: number; totalPages?: number; page?: number; pagingCounter?: number; hasPrevPage?: boolean; hasNextPage?: boolean; prevPage?: number | null; nextPage?: number | null; message?: string; errors?: Array<{ message: string; field?: string; }>; } export declare enum APIErrorType { Network = "network", Authentication = "authentication", Authorization = "authorization", Validation = "validation", NotFound = "not_found", Server = "server" } export declare class APIError extends Error { type: APIErrorType; status?: number | undefined; field?: string | undefined; constructor(type: APIErrorType, message: string, status?: number | undefined, field?: string | undefined); } export interface FindOptions { collection: string; page?: number; limit?: number; where?: Record; sort?: string; depth?: number; } export interface CreateOptions { collection: string; data: Record; } export interface UpdateOptions { collection: string; id: string; data: Record; } export interface DeleteOptions { collection: string; id: string; } export interface FindGlobalOptions { slug: string; depth?: number; } export interface UpdateGlobalOptions { slug: string; data: Record; } export interface APIClientOptions { baseURL?: string; } /** * API Client class for making authenticated requests to RevealUI admin API */ export declare class APIClient { private baseURL; constructor(options?: APIClientOptions); /** * Make an authenticated API request */ private request; /** * Find documents in a collection */ find(options: FindOptions): Promise; /** * Find a single document by ID */ findById(collection: string, id: string): Promise; /** * Create a new document */ create(options: CreateOptions): Promise; /** * Update an existing document */ update(options: UpdateOptions): Promise; /** * Delete a document */ delete(options: DeleteOptions): Promise; /** * Batch delete documents */ batchDelete(options: { collection: string; ids: string[]; }): Promise; /** * Batch update documents (e.g., bulk publish) */ batchUpdate(options: { collection: string; items: Array<{ id: string; } & Record>; }): Promise; /** * Find a global by slug */ findGlobal(options: FindGlobalOptions): Promise; /** * Update a global */ updateGlobal(options: UpdateGlobalOptions): Promise; } export declare const apiClient: APIClient; //# sourceMappingURL=apiClient.d.ts.map