import { API_PUBLIC_URL } from "./utils"; /** Ready-to-run cURL call against /v1/fetch for a freshly created key. */ export function curlSnippet(apiKey: string, opts: { url?: string; country?: string } = {}): string { const url = opts.url ?? "https://example.com"; const country = opts.country ?? "US"; return [ `curl -X POST ${API_PUBLIC_URL}/v1/fetch \\`, ` -H "Authorization: Bearer ${apiKey}" \\`, ` -H "Content-Type: application/json" \\`, ` -d '{"url": "${url}", "country": "${country}", "format": "text"}'`, ].join("\n"); } /** Masked display of a key: prefix + bullets + last 4 (never the secret). */ export function maskedKey(prefix: string, last4: string): string { return `${prefix}••••••••${last4}`; } export const SCOPE_INFO: Record = { "fetch:execute": { label: "fetch:execute", description: "Call POST /v1/fetch to retrieve pages through the network." }, "sessions:write": { label: "sessions:write", description: "Create, list and close sticky sessions (/v1/sessions)." }, "usage:read": { label: "usage:read", description: "Read usage summaries (/v1/usage) and project info (/v1/me)." }, "browser:use": { label: "browser:use", description: "Managed browser rendering. Not available yet.", comingSoon: true }, }; export const DEFAULT_SCOPES = ["fetch:execute", "sessions:write", "usage:read"];