export type CreateApiApiV1AccountAuthIdNumbersE164AssignSubaccountArgs = {auth_id: string, e164: string, body: {sub_account_id: string}}; export type CreateApiApiV1AccountAuthIdNumbersE164AssignSubaccountOptions = {baseUrl?: string | undefined, AuthID?: string | undefined, AuthToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Assign DID to a sub-account * * POST /api/v1/account/{auth_id}/numbers/{e164}/assign-subaccount */ export const createApiApiV1AccountAuthIdNumbersE164AssignSubaccount = async (args: CreateApiApiV1AccountAuthIdNumbersE164AssignSubaccountArgs, options?: CreateApiApiV1AccountAuthIdNumbersE164AssignSubaccountOptions) => { 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.e164))}/assign-subaccount${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 };