export type GetApiSnapshotsSnapshotIdC4MermaidArgs = {snapshot_id: string, level?: number | undefined, container_id?: (string | null) | undefined}; export type GetApiSnapshotsSnapshotIdC4MermaidOptions = {baseUrl: string, HTTPBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get C4 Mermaid * * GET /snapshots/{snapshot_id}/c4/mermaid */ export const getApiSnapshotsSnapshotIdC4Mermaid = async (args: GetApiSnapshotsSnapshotIdC4MermaidArgs, options: GetApiSnapshotsSnapshotIdC4MermaidOptions) => { const {baseUrl, fetch: fetchFn = fetch, HTTPBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.level != null) query.append("level", String(args.level)) if (args.container_id != null) query.append("container_id", String(args.container_id)) if (HTTPBearer !== undefined) headers.set('authorization', `Bearer ${HTTPBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/snapshots/${encodeURIComponent(String(args.snapshot_id))}/c4/mermaid${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };