export type GetApiContextDevWebStyleguideOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Extract a comprehensive design system from a website including colors, typography, spacing, shadows, and UI components. * * GET /context-dev/web/styleguide */ export const getApiContextDevWebStyleguide = async (options?: GetApiContextDevWebStyleguideOptions) => { const {baseUrl = "https://mpp.orthogonal.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/context-dev/web/styleguide${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 };