UNPKG

@scalar/api-client

Version:

the open source API testing client

53 lines 1.86 kB
import type { WorkspaceStore } from '@scalar/workspace-store/client'; export type CreateApiClientModalOptions = { /** Element to mount the client modal to */ el: HTMLElement | null; /** * Will attempt to mount the references immediately * For SSR this may need to be disabled and handled manually on the client side */ mountOnInitialize?: boolean; /** The workspace store must be initialized and passed in */ workspaceStore: WorkspaceStore; }; /** Payload for routing and opening the API client modal */ type RoutePayload = { path: string; method: string; example?: string; documentSlug?: string; }; export type ActiveEntities = Required<RoutePayload>; /** * Create the API Client Modal * * The new API Client Modal doesn't require a router, instead we can "route" by setting the active entities directly */ export declare const createApiClientModal: ({ el, workspaceStore, mountOnInitialize }: CreateApiClientModalOptions) => { /** The vue app instance for the modal, be careful with this */ app: import("vue").App<Element>; /** Open the API client modal and optionally route to an example */ open: (payload?: RoutePayload) => void; /** Mount the client to a given element */ mount: (mountingEl?: HTMLElement | null) => void; /** "Route" to the specified path, method and example */ route: (payload: RoutePayload) => { path: string; method: string; example: string; documentSlug: string; } & { path: string; method: string; example: string; documentSlug: string; } & RoutePayload; /** Controls the visibility of the modal */ modalState: { open: boolean; show: () => void; hide: () => void; }; }; export {}; //# sourceMappingURL=create-api-client-modal.d.ts.map