export type UpdateApiV1CallcenterDialdirectnumberArgs = {dialedNumber?: string | undefined, callEndNumber?: string | undefined, externalNumber?: string | undefined, webhookUrl?: string | undefined, maxRingTimeSec?: number | undefined}; export type UpdateApiV1CallcenterDialdirectnumberOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Calls the destination number directly with the specified parameters. * * PUT /v1/callcenter/dialdirectnumber * * Also accepts auth: API Key */ export const updateApiV1CallcenterDialdirectnumber = async (args: UpdateApiV1CallcenterDialdirectnumberArgs, options: UpdateApiV1CallcenterDialdirectnumberOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.dialedNumber != null) query.append("dialedNumber", String(args.dialedNumber)) if (args.callEndNumber != null) query.append("callEndNumber", String(args.callEndNumber)) if (args.externalNumber != null) query.append("externalNumber", String(args.externalNumber)) if (args.webhookUrl != null) query.append("webhookUrl", String(args.webhookUrl)) if (args.maxRingTimeSec != null) query.append("maxRingTimeSec", String(args.maxRingTimeSec)) if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/callcenter/dialdirectnumber${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };