import { type InitializationData, type LoginResult, type Operation, type OperationResult, type TreeData } from "./schema.js"; /** * A class that facilitates authentication, fetching and updating data from * WorkFlowy internal API, using the same methods as WorkFlowy application. * * ### Basic example * * ```ts * import { Client, type TreeItem, type Operation } from "workflowy" * * const client = new Client("username", "password"); * const items: TreeItem[] = await client.getTreeData(); * * const updateOperations: Operation[] = []; * const updateResult = await client.pushAndPull(updateOperations); * ``` */ export declare class Client { #private; /** * Cretes a new Client instance using WorkFlowy username and password * @param username WorkFlowy username * @param password WorkFlowy password */ constructor(username: string, password: string); private createClientId; /** * Authenticates the user. Methods like `.getTreeData()` and `.getInicializationData()` * call this method if the user is not yet authenticated. * * Queries `workflowy.com/ajax_login` endpoint * @returns `{ success: true }` if the autentication was successful * @throws Error if the authentication failed */ login(): Promise; /** * Fetches initialization data from WorkFlowy, needed to further query * WorkFlowy endpoints in order to fetch and update WorkFlowy document * * Queries `workflowy.com/get_initialization_data` endpoint * @returns Some initialization information about the user */ getInitializationData(): Promise; /** * Fetches the whole WorkFlowy document * * Queries `workflowy.com/get_tree_data` endpoint * @returns List of all items in WorkFlowy document */ getTreeData(): Promise; /** * Fetches the shared WorkFlowy subdocument * * Queries `workflowy.com/get_tree_data/?share_id=` endpoint * @returns List of all items in WorkFlowy shared document */ getSharedTreeData(shareId: string): Promise; /** * Fetches a signed URL for a file attachment preview * Internal use only - prefer using List.getPreviewUrl() instead * * Queries `workflowy.com/file-proxy/signed-preview/` endpoint * @param userId The user ID * @param nodeId The node ID containing the file * @param maxWidth Maximum width for image preview (default: 800) * @param maxHeight Maximum height for image preview (default: 800) * @returns The signed URL string for the file preview */ getFilePreviewUrl(userId: number | string, nodeId: string, maxWidth?: number, maxHeight?: number): Promise; /** * Fetches a signed URL for downloading the original file * Internal use only - prefer using List.getFileUrl() instead * * Queries `workflowy.com/file-proxy/signed-original/` endpoint * @param userId The user ID * @param nodeId The node ID containing the file * @returns The signed URL string for the original file */ getOriginalFileUrl(userId: number | string, nodeId: string): Promise; /** * Applies a list of operations to WorkFlowy document * * Queries `workflowy.com/push_and_pull` endpoint * @param operations List of operations to perform in WorkFlowy * @param expansionsDelta Record of list expansions to perform in WorkFlowy * @returns List of operations ran on WorkFlowy since last push and pull */ pushAndPull(operations: Operation[] | Record, expansionsDelta?: Record): Promise; /** Returns the client ID that this instance uses to query WorkFlowy */ get clientId(): string; /** Returns the session headers with authentication cookie to query WorkFlowy */ get sessionHeaders(): Headers; } //# sourceMappingURL=client.d.ts.map