import { cn } from '@/lib/utils' import { colors } from '@/lib/theme' import type { APIEndpoint } from '@/lib/docs/types' import CodeBlock from './CodeBlock' import { LuLock } from 'react-icons/lu' interface APIEndpointDocProps { endpoint: APIEndpoint className?: string } const methodStyles = { GET: { backgroundColor: 'rgba(16, 185, 129, 0.1)', color: colors.accents.success, borderColor: 'rgba(16, 185, 129, 0.3)', }, POST: { backgroundColor: 'rgba(59, 130, 246, 0.1)', color: colors.accents.info, borderColor: 'rgba(59, 130, 246, 0.3)', }, PUT: { backgroundColor: colors.accents.warningBg, color: colors.accents.warning, borderColor: 'rgba(245, 158, 11, 0.3)', }, DELETE: { backgroundColor: 'rgba(239, 68, 68, 0.1)', color: colors.accents.error, borderColor: 'rgba(239, 68, 68, 0.3)', }, PATCH: { backgroundColor: 'rgba(168, 85, 247, 0.1)', color: '#a855f7', borderColor: 'rgba(168, 85, 247, 0.3)', }, } as const export default function APIEndpointDoc({ endpoint, className, }: APIEndpointDocProps) { return (
{endpoint.path}
{endpoint.description}
{endpoint.auth?.required && (| Name | Type | Description |
|---|---|---|
| {param.name} {!param.optional && ( * )} | {param.type} | {param.description} |
| Field | Type | Description |
|---|---|---|
| {param.name} {!param.optional && ( * )} | {param.type} | {param.description} |