export type Method = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; const METHOD_FG: Record = { GET: 'var(--wf-ok)', POST: 'var(--wf-accent)', PUT: 'var(--wf-warn)', PATCH: 'var(--wf-warn)', DELETE: 'var(--wf-del)', }; /** * HTTP endpoint contract: method + path, optional summary, and request / * response example bodies. `change` flags a new or modified endpoint. */ export function ApiEndpoint({ method, path, summary, request, response, change, }: { method: Method; path: string; summary?: string; request?: string; response?: string; change?: 'added' | 'changed'; }) { return (
{method} {path} {change && {change}} {summary && {summary}}
{request && } {response && }
); } function Body({ label, code }: { label: string; code: string }) { return (
{label}
{code}
); }