/// import { AxiosInstance } from "axios"; import { BulkGetNoteMetaResp, BulkGetNoteResp, BulkWriteNotesOpts, DNodeProps, EngineDeleteOpts, EngineInfoResp, EngineWriteOptsV2, FindNotesMetaResp, GetNoteMetaResp, GetNoteResp, QueryNotesMetaResp, QueryNotesOpts, RenameNoteOpts, SchemaModuleProps, WriteNoteResp } from "."; import { ThemeTarget, ThemeType } from "./constants"; import { DendronCompositeError, DendronError } from "./error"; import { BulkWriteNotesResp, DeleteNoteResp, DeleteSchemaResp, DEngineInitResp, EngineSchemaWriteOpts, FindNotesResp, GetDecorationsResp, GetNoteBlocksResp, GetSchemaResp, QueryNotesResp, QuerySchemaResp, RenameNoteResp, RenderNoteOpts, RenderNoteResp, RespV3, VSRange, WriteSchemaResp, DendronConfig } from "./types"; import { DVault } from "./types/DVault"; import { FindNoteOpts } from "./types/FindNoteOpts"; export declare type APIRequest = { ws: string; } & T; export declare function createNoOpLogger(): { level: string; debug: (_msg: any) => void; info: (_msg: any) => void; error: (_msg: any) => void; }; interface IRequestArgs { headers: any; } export interface IAPIPayload { data: undefined | any | any[]; error: undefined | DendronError | DendronCompositeError; } interface IAPIOpts { endpoint: string; apiPath: string; _request: AxiosInstance; logger: any; statusHandlers: any; onAuth: (opts: IRequestArgs) => Promise; onBuildHeaders: (opts: IRequestArgs) => Promise; onError: (opts: { err: DendronError; body: any; resp: any; headers: any; qs: any; path: string; method: string; }) => any; } declare type IAPIConstructor = { endpoint: string; apiPath: string; } & Partial; interface IDoRequestArgs { path: string; auth?: boolean; qs?: any; body?: any; method?: "get" | "post"; json?: boolean; } export declare type WorkspaceInitRequest = { uri: string; config: { vaults: DVault[]; }; }; export declare type WorkspaceSyncRequest = WorkspaceRequest; export declare type WorkspaceRequest = { ws: string; }; export declare type EngineGetNoteRequest = { id: string; } & WorkspaceRequest; export declare type EngineBulkGetNoteRequest = { ids: string[]; } & WorkspaceRequest; export declare type EngineRenameNoteRequest = RenameNoteOpts & { ws: string; }; export declare type EngineWriteRequest = { node: DNodeProps; opts?: EngineWriteOptsV2; } & { ws: string; }; export declare type EngineDeleteRequest = { id: string; opts?: EngineDeleteOpts; } & { ws: string; }; export declare type EngineBulkAddRequest = { opts: BulkWriteNotesOpts; } & { ws: string; }; export declare type NoteQueryRequest = { opts: QueryNotesOpts; } & { ws: string; }; export declare type GetNoteBlocksRequest = { id: string; filterByAnchorType?: "header" | "block"; } & WorkspaceRequest; export declare type GetDecorationsRequest = { id: string; ranges: { range: VSRange; text: string; }[]; text: string; } & Partial; export declare type SchemaDeleteRequest = { id: string; opts?: EngineDeleteOpts; } & Partial; export declare type SchemaReadRequest = { id: string; } & Partial; export declare type SchemaQueryRequest = { qs: string; } & Partial; export declare type SchemaWriteRequest = { schema: SchemaModuleProps; opts?: EngineSchemaWriteOpts; } & WorkspaceRequest; export declare type AssetGetRequest = { fpath: string; } & WorkspaceRequest; export declare type AssetGetThemeRequest = { themeTarget: ThemeTarget; themeType: ThemeType; } & WorkspaceRequest; export declare class APIUtils { /** Generate a localhost url to this API. * * Warning! In VSCode, the generated URL won't work if the user has a remote * workspace. You'll need to use `vscode.env.asExternalUri` to make it remote. */ static getLocalEndpoint(port: number): string; } declare abstract class API { opts: IAPIOpts; constructor(opts: IAPIConstructor); _log(msg: any, lvl?: "info" | "debug" | "error" | "fatal"): void; _createPayload(data: any): { data: any; }; _doRequest({ auth, qs, path, body, method, json, }: IDoRequestArgs): Promise>; _makeRequest(args: IDoRequestArgs, payloadData?: T["data"]): Promise; _makeRequestRaw(args: IDoRequestArgs): Promise; } export declare class DendronAPI extends API { static getOrCreate(opts: IAPIConstructor): DendronAPI; static instance(): DendronAPI; assetGet(req: AssetGetRequest): Promise; assetGetTheme(req: AssetGetThemeRequest): Promise; configGet(req: WorkspaceRequest): Promise>; workspaceInit(req: WorkspaceInitRequest): Promise; workspaceSync(req: WorkspaceSyncRequest): Promise; engineBulkAdd(req: EngineBulkAddRequest): Promise; engineDelete(req: EngineDeleteRequest): Promise; engineInfo(): Promise; engineRenameNote(req: EngineRenameNoteRequest): Promise; engineWrite(req: EngineWriteRequest): Promise; noteGet(req: EngineGetNoteRequest): Promise; noteGetMeta(req: EngineGetNoteRequest): Promise; noteBulkGet(req: EngineBulkGetNoteRequest): Promise; noteBulkGetMeta(req: EngineBulkGetNoteRequest): Promise; noteFind(req: APIRequest): Promise>; noteFindMeta(req: APIRequest): Promise>; noteQuery(req: NoteQueryRequest): Promise>; noteQueryMeta(req: NoteQueryRequest): Promise>; noteRender(req: APIRequest): Promise; getNoteBlocks(req: GetNoteBlocksRequest): Promise; getDecorations(req: GetDecorationsRequest): Promise; schemaDelete(req: SchemaDeleteRequest): Promise; schemaRead(req: SchemaReadRequest): Promise; schemaQuery(req: SchemaQueryRequest): Promise; schemaWrite(req: SchemaWriteRequest): Promise; } export declare const DendronApiV2: typeof DendronAPI; export {};