/** * Zotero Web API 客户端 */ import type { ZoteroConfig, ZoteroItem, ZoteroCollection, ZoteroItemData, SearchParams, TagSummary, ZoteroSavedSearch } from './types.js'; export declare class ZoteroClient { private config; private libraryVersion; private lastRequestTime; private backoffUntil; private requestInterval; private cacheManager; constructor(config: ZoteroConfig); /** * 主动限流:等待直到可以发送下一个请求 */ private throttle; /** * 睡眠指定毫秒 */ private sleep; /** * 获取库的基础路径 */ private getLibraryPath; /** * 解析响应头 */ private parseHeaders; /** * 发送 API 请求 */ private request; /** * 搜索文献 * @param params.qmode - 'everything' 可搜索笔记内容和全文 * @param params.includeChildren - true 时包含子项目(笔记、附件) * @param params.includeTrashed - true 时包含垃圾箱项目 */ searchItems(params?: SearchParams): Promise<{ items: ZoteroItem[]; totalResults: number; }>; /** * 获取单个文献详情 */ getItem(itemKey: string): Promise; /** * 获取所有分组 */ getCollections(parentKey?: string): Promise; /** * 获取单个分组详情 */ getCollection(collectionKey: string): Promise; /** * 创建分组 */ createCollection(name: string, parentCollection?: string): Promise; /** * 更新分组 */ updateCollection(collectionKey: string, updates: { name?: string; parentCollection?: string | false; }): Promise; /** * 删除分组 */ deleteCollection(collectionKey: string): Promise; /** * 获取所有标签 */ getTags(limit?: number): Promise; /** * 创建文献 */ createItem(itemData: ZoteroItemData): Promise; /** * 获取库版本 */ private getLibraryVersion; /** * 获取项目模板 */ getItemTemplate(itemType: string): Promise; /** * 导出文献为指定格式 */ exportItems(itemKeys: string[], format: string, style?: string): Promise; /** * 更新文献 */ updateItem(itemKey: string, updates: Partial): Promise; /** * 删除文献(移到垃圾箱) * 通过设置 deleted: 1 将文献移到垃圾箱,而不是永久删除 */ deleteItem(itemKey: string): Promise; /** * 获取最近添加的文献 */ getRecentItems(limit?: number): Promise; /** * 获取文献的子项目(附件、笔记等) */ getItemChildren(itemKey: string): Promise; /** * 获取文献的全文内容(支持分段) * @param itemKey 文献 key * @param offset 起始字符位置(默认 0) * @param limit 返回字符数(默认 10000,最大 50000) */ getItemFulltext(itemKey: string, offset?: number, limit?: number): Promise<{ content: string; offset: number; length: number; totalChars: number; hasMore: boolean; nextOffset: number | null; indexedPages?: number; totalPages?: number; } | null>; /** * 为文献添加标签 */ addTagsToItem(itemKey: string, tags: string[]): Promise; /** * 将文献添加到分组 */ addItemToCollection(itemKey: string, collectionKey: string): Promise; /** * 获取垃圾箱中的文献 */ getTrashItems(limit?: number): Promise; /** * 获取保存的搜索 */ getSavedSearches(): Promise; /** * 下载附件文件(支持缓存) * @param itemKey 附件的 key * @param options.force 强制重新下载,忽略缓存 * @returns 本地文件路径和元数据 */ downloadAttachment(itemKey: string, options?: { force?: boolean; maxRetries?: number; }): Promise<{ path: string; filename: string; contentType: string; size: number; fromCache: boolean; }>; /** * 清除附件缓存 * @param itemKey 可选,指定则只清除该项目的缓存,否则清除所有 */ clearAttachmentCache(itemKey?: string): Promise; } //# sourceMappingURL=zotero-client.d.ts.map