import { CodeTabs } from '../views/docs/CodeTabs';
import { PropTable, NextLink } from '../views/docs/prose';

export const CLIENT_EX_PY = `import guava, os

client = guava.Client(
    api_key=os.environ["GUAVA_API_KEY"],   # or omit — reads env automatically
)`;

export const CLIENT_EX_TS = `import * as guava from "@guava-ai/guava-sdk";

const client = new guava.Client(
  process.env.GUAVA_API_KEY,  // or omit — reads env automatically
);`;

## Client

`guava.Client` complements [`guava.Agent`](./agent) by providing functions for managing account-level resources. It also provides any functions that don't fit onto [`guava.Agent`](./agent).

<CodeTabs
  python={{ code: CLIENT_EX_PY, filename: "run.py" }}
  typescript={{ code: CLIENT_EX_TS, filename: "run.ts" }}
/>

### API

<PropTable rows={[
  { name: "api_key", type: "str | None", default: "env GUAVA_API_KEY", desc: "Your Guava API key." },
  { name: "base_url", type: "str | None", default: "production", desc: "Override the API endpoint (for testing)." },
]} />

### Methods

<PropTable rows={[
  { name: "create_sip_agent()", type: "method", desc: "Generate a SIP code linked to your account for inbound SIP call handling." },
  { name: "create_webrtc_agent(ttl)", type: "method", desc: "Generate a WebRTC code for browser-based voice interaction, with optional TTL." },
  { name: "send_sms()", type: "method", desc: "Send an SMS message." },
]} />

<NextLink section="tasks" label="Tasks" />
