export type CreateApiApiV1AccountAuthIdNumbersPurchaseFromInventoryArgs = {auth_id: string, body: {e164: string, currency?: string | undefined}}; export type CreateApiApiV1AccountAuthIdNumbersPurchaseFromInventoryOptions = {baseUrl?: string | undefined, AuthID?: string | undefined, AuthToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Purchase from Inventory * * POST /api/v1/Account/{auth_id}/numbers/purchase-from-inventory */ export const createApiApiV1AccountAuthIdNumbersPurchaseFromInventory = async (args: CreateApiApiV1AccountAuthIdNumbersPurchaseFromInventoryArgs, options?: CreateApiApiV1AccountAuthIdNumbersPurchaseFromInventoryOptions) => { 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") headers.set('accept', "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/purchase-from-inventory${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 (await res.json()) as unknown };