export type CreateApiAgentphoneV1AgentsAgentIdNumbersArgs = {agentId: string, body: {numberId: string}}; export type CreateApiAgentphoneV1AgentsAgentIdNumbersOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Attach a phone number to an agent. * * POST /agentphone/v1/agents/{agentId}/numbers */ export const createApiAgentphoneV1AgentsAgentIdNumbers = async (args: CreateApiAgentphoneV1AgentsAgentIdNumbersArgs, options?: CreateApiAgentphoneV1AgentsAgentIdNumbersOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/agentphone/v1/agents/${encodeURIComponent(String(args.agentId))}/numbers${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };