@scalar/api-client
Version:
the open source API testing client
20 lines • 1.22 kB
TypeScript
import type { WorkspaceStore } from '@scalar/workspace-store/client';
export type ImportEventData = {
source: string;
type: 'url' | 'file' | 'raw';
};
/**
* Attempts to add a document to the workspace from a given source, which may be a URL or raw content.
*
* - If the source is a URL, adds the document by its URL and includes a watch mode flag as metadata.
* - If the source is a Postman collection, transforms it to OpenAPI and adds it as a document.
* - For other raw sources (such as pasted JSON or YAML), attempts to normalize and add them as a document.
*
* @param workspaceStore The workspace store where the document will be added.
* @param source The document source (URL, Postman Collection, JSON, or YAML string).
* @param name The display name for the new document.
* @param watchMode Whether to enable watch mode (applies only to URL sources).
* @returns Promise resolving to true if the document was successfully added, or false if the operation failed.
*/
export declare const loadDocumentFromSource: (workspaceStore: WorkspaceStore, importEventData: ImportEventData, name: string, watchMode: boolean) => Promise<boolean>;
//# sourceMappingURL=load-document-from-source.d.ts.map