import type { Client } from "./client.js"; import { type InitializationData, type Operation, type S3File, type TreeData, type TreeItemShareInfo, type TreeItemWithChildren } from "./schema.js"; import { PermissionLevel } from "./share.js"; declare class Companion { readonly client: Client; readonly itemMap: Map; readonly shortIdMap: Map; readonly shareMap: Map; readonly shareIdMap: Map; readonly expandedProjects: Set; readonly initializationData: InitializationData; private operations; private expansionsDelta; constructor(client: Client, itemMap: Map, shortIdMap: Map | undefined, shareMap: Map, shareIdMap: Map, expandedProjects: Set, initializationData: InitializationData); resolveId(id: string): string; getPendingOperations(): Record; getPendingExpansionsDelta(): Map; addOperation(treeId: string, operation: Operation): void; addExpansionDelta(id: string, expanded: boolean): void; isDirty(): boolean; save(): Promise; getRealTimestamp(timestamp: number): Date; getNow(): number; } export declare class Document { #private; /** Pointer to the root of the WorkFlowy */ readonly root: List; constructor(client: Client, data: TreeData, initializationData: InitializationData, sharedTrees?: Record); /** Lists in the root of WorkFlowy */ get items(): List[]; /** * Returns a List specified by ID or short ID. Make sure that the ID exists. * The short ID is the part of ID that is visible in Workflowy URLs. * @param id ID of the list to get * @returns A list instance with the particular ID */ getList(id: string): List; /** Returns a list of changes to be made to WorkFlowy when saving */ getPendingOperations(): Record; /** Returns a map of list expansions changes to be made when saving*/ getPendingExpansionsDelta(): Map; /** Returns true if there are unsaved changes */ isDirty(): boolean; /** Saves the document */ save(): Promise; } /** * A list corresponds to a node in a WorkFlowy document */ export declare class List { #private; readonly id: string; constructor(id: string, companion: Companion); private get source(); private get data(); private get shareData(); private get idPrefix(); private get userId(); /** List name */ get name(): string; /** List note */ get note(): string; /** File attachment metadata, or undefined if no file attached */ get file(): S3File | undefined; /** Returns true if this list has a file attachment */ get hasFile(): boolean; /** * Fetches a signed URL for a file attachment preview * * Queries `workflowy.com/file-proxy/signed-preview/` endpoint * @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 */ getPreviewUrl(maxWidth?: number, maxHeight?: number): Promise; /** * Fetches a signed URL for downloading the original file * * Queries `workflowy.com/file-proxy/signed-original/` endpoint * @returns The signed URL string for the original file */ getFileUrl(): Promise; /** Date of creation, or undefined if not available */ get createdAt(): Date | undefined; /** Date of last change, or undefined if not available */ get lastModifiedAt(): Date | undefined; /** Date of completion, or undefined if not completed */ get completedAt(): Date | undefined; /** True if completed, false otherwise */ get isCompleted(): boolean; /** True if the list is a mirror of another list */ get isMirror(): boolean; /** True if the list is expanded */ get isExpanded(): boolean; /** ID of mirrored list, if this list is a mirror; otherwise undefined */ get originalId(): string | undefined; /** Returns a parent list */ get parent(): List; /** Returns a position of the list relative to its siblings within the parent */ get priority(): number; /** Returns all items in this list */ get items(): List[]; /** Returns all item IDs in this list */ get itemIds(): string[]; /** True if the list is shared via URL */ get isSharedViaUrl(): boolean; /** True if the list is shared via email */ get isSharedViaEmail(): boolean; /** Returns shared URL or undefined if the list is not shared */ get sharedUrl(): string | undefined; /** Returns shared permission level of the list */ get sharedUrlPermissionLevel(): PermissionLevel; /** Finds an item in this list and returns it, undefined if it does not find any */ findOne(namePattern: RegExp, descriptionPattern?: RegExp): List | undefined; /** Finds all items in this list */ findAll(namePattern: RegExp, notePattern?: RegExp): List[]; /** * Creates a new sublist * @param priority position of the sublist within other sublists; * -1 appends the list to the end * @returns the new list */ createList(priority?: number): List; /** * Alias for `.createList` in case if it feels weird to call an item a list :-) * @param priority position of the item within other items in the same parent; * -1 appends the item to the end * @returns the new item */ createItem(priority?: number): List; /** * Sets a new name * @returns {List} this */ setName(name: string): List; /** * Sets a new note * @returns {List} this */ setNote(note: string): List; /** * Completes the list * @returns {List} this */ setCompleted(complete?: boolean): List; /** * Moves this list to a different list * * @param {List} target New parent of the current list * @param {number} priority Position of this list in the new parent; * -1 appends the list to the end of the target list's children */ move(target: List, priority?: number): void; /** * Deletes this list from WorkFlowy. Use with caution! */ delete(): void; /** * Enables sharing for the list and returns a shared URL * * @param permissionLevel Permission level - View, EditAndComment, or FullAccess * @returns Shared URL */ shareViaUrl(permissionLevel: PermissionLevel): string; /** * Disables sharing via URL for the list */ unshareViaUrl(): void; /** * Expands the list */ expand(): void; /** * Collapses the list */ collapse(): void; /** * Prints the list and its content as a nice string * * @param omitHeader Whether to print only the content the current list * @returns {string} stringified list */ toString(omitHeader?: boolean): string; /** * Prints the list and its content in Plain Text format * * @returns {string} list in Plain Text format */ toPlainText(): string; /** * Prints the list and its content in JSON format * * @param includeDates Whether to include creation, modification, and completion dates * @param includeFiles Whether to include file attachment metadata * @returns list in JSON format */ toJson(includeDates?: boolean, includeFiles?: boolean): any; /** * Prints the list and its content in OPML format * * @returns list in OPML format */ toOpml(): string; } export {}; //# sourceMappingURL=document.d.ts.map