| 1 | --- |
| 2 | // The API explorer, for trying calls from the browser: Scalar's explorer over g1t's OpenAPI |
| 3 | // document. It is a standalone page because the explorer brings its own |
| 4 | // layout. The reference itself is the Starlight pages under /reference/api/. |
| 5 | import '@g1t/theme/fonts.css'; |
| 6 | import '@g1t/theme/tokens.css'; |
| 7 | import '../../styles/light.css'; |
| 8 | import sans from '@g1t/theme/fonts/hanken-grotesk-latin.woff2?url'; |
| 9 | |
| 10 | // The wordmark: G1T in pixel capitals, the 1 in lavender, as in |
| 11 | // src/components/SiteTitle.astro. |
| 12 | const G = ['.###.', '#...#', '#....', '#.###', '#...#', '#...#', '.###.']; |
| 13 | const ONE = ['..#..', '.##..', '#.#..', '..#..', '..#..', '..#..', '#####']; |
| 14 | const T = ['#####', '..#..', '..#..', '..#..', '..#..', '..#..', '..#..']; |
| 15 | const pixels = (rows: string[], dx: number, one: boolean) => |
| 16 | rows.flatMap((row, y) => [...row].flatMap((c, x) => (c === '#' ? [{ x: dx + x, y, one }] : []))); |
| 17 | const word = [...pixels(G, 0, false), ...pixels(ONE, 6, true), ...pixels(T, 10, false)]; |
| 18 | |
| 19 | // Light or dark as the rest of the docs: the head's script below sets |
| 20 | // forceDarkModeState from the reader's choice before the explorer loads. |
| 21 | const configuration = { |
| 22 | theme: 'none', |
| 23 | darkMode: true, |
| 24 | hideDarkModeToggle: true, |
| 25 | hideClientButton: true, |
| 26 | hideModels: true, |
| 27 | defaultHttpClient: { targetKey: 'shell', clientKey: 'curl' }, |
| 28 | }; |
| 29 | --- |
| 30 | |
| 31 | <!doctype html> |
| 32 | <html lang="en"> |
| 33 | <head> |
| 34 | <meta charset="utf-8" /> |
| 35 | <meta name="viewport" content="width=device-width, initial-scale=1" /> |
| 36 | <title>API explorer · g1t docs</title> |
| 37 | <meta |
| 38 | name="description" |
| 39 | content="Every g1t API endpoint, with an explorer to call them from the page." |
| 40 | /> |
| 41 | <link rel="icon" href="/favicon.ico" sizes="32x32" /> |
| 42 | <link rel="icon" type="image/svg+xml" href="/favicon.svg" /> |
| 43 | <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" /> |
| 44 | <link rel="manifest" href="/site.webmanifest" /> |
| 45 | <link rel="canonical" href="https://docs.g1t.sh/api/reference/" /> |
| 46 | <link rel="preload" href={sans} as="font" type="font/woff2" crossorigin /> |
| 47 | <meta name="theme-color" content="#0f0f11" media="(prefers-color-scheme: dark)" /> |
| 48 | <meta name="theme-color" content="#fbfbfa" media="(prefers-color-scheme: light)" /> |
| 49 | {/* The theme chosen in the docs' theme select (kept in this browser by |
| 50 | Starlight), or the system's on Auto; set before the first paint. */} |
| 51 | <script is:inline> |
| 52 | (() => { |
| 53 | let stored = ''; |
| 54 | try { |
| 55 | stored = localStorage.getItem('starlight-theme') || ''; |
| 56 | } catch {} |
| 57 | const theme = |
| 58 | stored === 'light' || stored === 'dark' |
| 59 | ? stored |
| 60 | : matchMedia('(prefers-color-scheme: light)').matches |
| 61 | ? 'light' |
| 62 | : 'dark'; |
| 63 | document.documentElement.dataset.theme = theme; |
| 64 | window.g1tTheme = theme; |
| 65 | })(); |
| 66 | </script> |
| 67 | </head> |
| 68 | <body> |
| 69 | <header class="bar"> |
| 70 | <a class="brand" href="/" aria-label="g1t docs home"> |
| 71 | <svg viewBox="1 1 148 68" role="img" aria-label="g1t"> |
| 72 | {word.map((p) => ( |
| 73 | <rect |
| 74 | x={p.x * 10 + 1} |
| 75 | y={p.y * 10 + 1} |
| 76 | width="8" |
| 77 | height="8" |
| 78 | fill={p.one ? 'var(--g1t-accent)' : 'currentColor'} |
| 79 | /> |
| 80 | ))} |
| 81 | </svg> |
| 82 | <span class="pill">Docs</span> |
| 83 | </a> |
| 84 | <nav> |
| 85 | <a href="/">Guides</a> |
| 86 | <a href="/reference/api/">API reference</a> |
| 87 | <a href="/reference/mcp/">MCP tools</a> |
| 88 | <a href="https://api.g1t.sh/openapi.json">OpenAPI</a> |
| 89 | <a href="https://g1t.sh/register" class="cta">Sign up</a> |
| 90 | </nav> |
| 91 | </header> |
| 92 | <script |
| 93 | is:inline |
| 94 | id="api-reference" |
| 95 | data-url="https://api.g1t.sh/openapi.json" |
| 96 | data-configuration={JSON.stringify(configuration)}></script> |
| 97 | <script is:inline> |
| 98 | (() => { |
| 99 | const el = document.getElementById('api-reference'); |
| 100 | const config = JSON.parse(el.dataset.configuration); |
| 101 | config.darkMode = window.g1tTheme !== 'light'; |
| 102 | config.forceDarkModeState = window.g1tTheme === 'light' ? 'light' : 'dark'; |
| 103 | el.dataset.configuration = JSON.stringify(config); |
| 104 | })(); |
| 105 | </script> |
| 106 | <script is:inline src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script> |
| 107 | </body> |
| 108 | </html> |
| 109 | |
| 110 | <style is:global> |
| 111 | body { |
| 112 | margin: 0; |
| 113 | background: var(--g1t-bg); |
| 114 | } |
| 115 | |
| 116 | /* Scalar's names for the shared g1t tokens. */ |
| 117 | :root { |
| 118 | /* The g1t header above: Scalar's sticky sidebar starts below it. */ |
| 119 | --scalar-custom-header-height: 56px; |
| 120 | --scalar-font: var(--g1t-font-sans); |
| 121 | --scalar-font-code: var(--g1t-font-mono); |
| 122 | } |
| 123 | .dark-mode, |
| 124 | .light-mode { |
| 125 | --scalar-background-1: var(--g1t-bg); |
| 126 | --scalar-background-2: var(--g1t-surface); |
| 127 | --scalar-background-3: var(--g1t-raised); |
| 128 | --scalar-border-color: var(--g1t-line); |
| 129 | --scalar-color-1: var(--g1t-fg); |
| 130 | --scalar-color-2: var(--g1t-muted); |
| 131 | --scalar-color-3: var(--g1t-faint); |
| 132 | --scalar-color-accent: var(--g1t-docs-link); |
| 133 | --scalar-background-accent: color-mix(in srgb, var(--g1t-accent) 12%, transparent); |
| 134 | --scalar-button-1: var(--g1t-fg); |
| 135 | --scalar-button-1-color: var(--g1t-bg); |
| 136 | --scalar-button-1-hover: var(--g1t-docs-fg-hover); |
| 137 | --scalar-color-green: var(--g1t-success); |
| 138 | --scalar-color-blue: var(--g1t-info); |
| 139 | --scalar-color-red: var(--g1t-danger); |
| 140 | --scalar-color-orange: var(--g1t-warn); |
| 141 | --scalar-sidebar-background-1: var(--g1t-bg); |
| 142 | --scalar-sidebar-color-1: var(--g1t-fg); |
| 143 | --scalar-sidebar-color-2: var(--g1t-muted); |
| 144 | --scalar-sidebar-border-color: var(--g1t-line); |
| 145 | --scalar-sidebar-item-hover-background: var(--g1t-surface); |
| 146 | --scalar-sidebar-item-active-background: var(--g1t-raised); |
| 147 | --scalar-sidebar-color-active: var(--g1t-fg); |
| 148 | } |
| 149 | |
| 150 | .bar { |
| 151 | position: sticky; |
| 152 | top: 0; |
| 153 | z-index: 10; |
| 154 | display: flex; |
| 155 | align-items: center; |
| 156 | justify-content: space-between; |
| 157 | height: 56px; |
| 158 | padding: 0 20px; |
| 159 | background: color-mix(in srgb, var(--g1t-bg) 88%, transparent); |
| 160 | backdrop-filter: blur(10px); |
| 161 | border-bottom: 1px solid var(--g1t-line); |
| 162 | font: 14px var(--g1t-font-sans); |
| 163 | } |
| 164 | .bar a { |
| 165 | color: var(--g1t-muted); |
| 166 | text-decoration: none; |
| 167 | } |
| 168 | .bar .brand { |
| 169 | display: inline-flex; |
| 170 | align-items: center; |
| 171 | gap: 9px; |
| 172 | color: var(--g1t-fg); |
| 173 | } |
| 174 | .bar .brand svg { |
| 175 | width: auto; |
| 176 | height: 20px; |
| 177 | } |
| 178 | .bar .pill { |
| 179 | border-radius: 999px; |
| 180 | padding: 1px 8px; |
| 181 | font-size: 11.5px; |
| 182 | color: var(--g1t-muted); |
| 183 | box-shadow: inset 0 0 0 1px var(--g1t-line-strong); |
| 184 | } |
| 185 | .bar nav { |
| 186 | display: flex; |
| 187 | align-items: center; |
| 188 | gap: 4px; |
| 189 | } |
| 190 | .bar nav a { |
| 191 | border-radius: 6px; |
| 192 | padding: 5px 10px; |
| 193 | font-size: 13.5px; |
| 194 | } |
| 195 | .bar nav a:hover { |
| 196 | background: var(--g1t-raised); |
| 197 | color: var(--g1t-fg); |
| 198 | } |
| 199 | .bar nav a.cta { |
| 200 | margin-left: 4px; |
| 201 | background: var(--g1t-fg); |
| 202 | color: var(--g1t-bg); |
| 203 | font-weight: 500; |
| 204 | } |
| 205 | @media (max-width: 760px) { |
| 206 | .bar nav a:not(.cta) { |
| 207 | display: none; |
| 208 | } |
| 209 | } |
| 210 | </style> |