"use client"; import * as React from "react"; import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs"; import { CodeBlock, type CodeLang } from "@/components/ui/code-block"; import { Badge } from "@/components/ui/badge"; const REQUEST_SAMPLES: Array<{ id: string; label: string; lang: CodeLang; title: string; code: string }> = [ { id: "curl", label: "cURL", lang: "bash", title: "terminal", code: `curl -X POST https://www.fetcha.co/v1/fetch \\ -H "Authorization: Bearer fch_live_..." \\ -H "Content-Type: application/json" \\ -d '{ "url": "https://example.com", "country": "CA" }'`, }, { id: "javascript", label: "JavaScript", lang: "javascript", title: "fetch.mjs", code: `import { Fetcha } from "@fetcha/sdk"; const fetcha = new Fetcha({ apiKey: process.env.FETCHA_API_KEY }); const res = await fetcha.fetch({ url: "https://example.com", country: "CA", }); console.log(res.status, res.metadata.network); // 200 "residential"`, }, { id: "python", label: "Python", lang: "python", title: "fetch.py", code: `import os from fetcha import Fetcha client = Fetcha(api_key=os.environ["FETCHA_API_KEY"]) res = client.fetch("https://example.com", country="CA") print(res.status, res.metadata.network) # 200 residential`, }, ]; const RESPONSE_SAMPLE = `{ "request_id": "req_01j8x4k2m9v7q3", "success": true, "status": 200, "url": "https://example.com", "final_url": "https://example.com/", "content_type": "text/html; charset=utf-8", "metadata": { "network": "residential", "country": "CA", "attempts": 1, "duration_ms": 842, "bytes": 1256 } }`; export function HeroCodeTabs() { return (