export type CreateApiApiV1AccountAuthIdNumbersPhoneNumberAssignArgs = {auth_id: string, phone_number: string, body: {trunk_group_id: string}}; export type CreateApiApiV1AccountAuthIdNumbersPhoneNumberAssignOptions = {baseUrl?: string | undefined, AuthID?: string | undefined, AuthToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Assign Number to Trunk * * POST /api/v1/Account/{auth_id}/numbers/{phone_number}/assign */ export const createApiApiV1AccountAuthIdNumbersPhoneNumberAssign = async (args: CreateApiApiV1AccountAuthIdNumbersPhoneNumberAssignArgs, options?: CreateApiApiV1AccountAuthIdNumbersPhoneNumberAssignOptions) => { const {baseUrl = "https://api.vobiz.ai", fetch: fetchFn = fetch, AuthID, AuthToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (AuthID !== undefined) headers.set("X-Auth-ID", AuthID) if (AuthToken !== undefined) headers.set("X-Auth-Token", AuthToken) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/Account/${encodeURIComponent(String(args.auth_id))}/numbers/${encodeURIComponent(String(args.phone_number))}/assign${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 };