@devries-cameron20 / composio Mirror · read-only
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 03:37 UTC

next
tsx 48 lines 1.43 KB
Raw
1 'use client';
2
3 import { useApiVersion } from '@/lib/use-api-version';
4 import { DeprecatedApiLegacyBadge } from '@/components/legacy-badge';
5 import { getApiDisplayTitle } from '@/lib/api-deprecation';
6 import type { ApiEndpoint } from '@/lib/api-endpoints-table-schema';
7
8 /**
9 * Renders an endpoint table that updates based on the selected API version.
10 * Used in auto-generated index pages.
11 *
12 * The prop shape lives in `lib/api-endpoints-table-schema.ts` — one type, one
13 * source, shared with the `.md` converter and the generator's validation.
14 */
15 export function ApiEndpointsTable({ endpoints }: { endpoints: ApiEndpoint[] }) {
16 const version = useApiVersion();
17
18 return (
19 <table>
20 <thead>
21 <tr>
22 <th>Endpoint</th>
23 <th>Quick Link</th>
24 </tr>
25 </thead>
26 <tbody>
27 {endpoints.map((ep, i) => {
28 const path = version === '3.0' ? ep.pathV3 : ep.pathV31;
29 return (
30 <tr key={i}>
31 <td><code>{ep.method} {path}</code></td>
32 <td>
33 <a href={ep.href}>
34 {getApiDisplayTitle(ep.summary, ep.legacy === true)}
35 </a>
36 {ep.legacy && (
37 <span className="ml-2 inline-flex align-middle">
38 <DeprecatedApiLegacyBadge />
39 </span>
40 )}
41 </td>
42 </tr>
43 );
44 })}
45 </tbody>
46 </table>
47 );
48 }