@scalar/api-client
Version:
the open source API testing client
30 lines • 1.32 kB
TypeScript
import type { WorkspaceStore } from '@scalar/workspace-store/client';
import type { InMemoryWorkspace } from '@scalar/workspace-store/schemas/inmemory-workspace';
/**
* Imports a single document from a workspace state into the current workspace.
*
* This function handles the complete import process including slug generation,
* document loading, and sidebar updates. It ensures the imported document does not
* conflict with existing documents by generating a unique slug.
*
* The meta from the importing workspace is intentionally excluded to preserve
* the current workspace settings and avoid unintended configuration changes.
*
* @param workspaceStore - The active workspace store where the document will be imported
* @param workspaceState - The in-memory workspace containing the document to import
* @param name - The original slug/name of the document in the source workspace state
*
* @returns Promise that resolves to the slug of the imported document
*/
export declare const importDocumentToWorkspace: ({ workspaceStore, workspaceState, name, }: {
workspaceStore: WorkspaceStore | null;
workspaceState: InMemoryWorkspace;
name: string;
}) => Promise<{
ok: true;
slug: string;
} | {
ok: false;
error: string;
}>;
//# sourceMappingURL=import-document-to-workspace.d.ts.map