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