export type GetApiAgentphoneV1AgentsAgentIdCallsArgs = {agentId: string}; export type GetApiAgentphoneV1AgentsAgentIdCallsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * List calls for a specific agent. * * GET /agentphone/v1/agents/{agentId}/calls */ export const getApiAgentphoneV1AgentsAgentIdCalls = async (args: GetApiAgentphoneV1AgentsAgentIdCallsArgs, options?: GetApiAgentphoneV1AgentsAgentIdCallsOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/agentphone/v1/agents/${encodeURIComponent(String(args.agentId))}/calls${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };