export type CreateApiBusinessAddBusinessArgs = {'content-language': string, body: {email: string, deviceType: 'WEB' | 'ANDROID' | 'IOS', deviceToken?: string | undefined, mobile: string, countryCode: string, companyName: string, imageLogo?: Record | undefined, imageFront?: Record | undefined, fullAddress: string, addressReference?: string | undefined, exterior?: string | undefined, interior?: string | undefined, zipCode?: string | undefined, country?: string | undefined, city?: string | undefined, latitude?: number | undefined, longitude?: number | undefined, businessCategories?: Array | undefined, schedule?: (Array<{day: number, open?: string | undefined, close?: string | undefined, isOpen: boolean}>) | undefined, tags?: Array | undefined}}; export type CreateApiBusinessAddBusinessOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Register a new business via Email * * POST /business/addBusiness */ export const createApiBusinessAddBusiness = async (args: CreateApiBusinessAddBusinessArgs, options?: CreateApiBusinessAddBusinessOptions) => { const {baseUrl = "http://api.pickerexpress.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/x-www-form-urlencoded") headers.set('accept', "*/*") if (args['content-language'] != null) headers.set("content-language", String(args['content-language'])) const url = `${baseUrl.replace(/\/+$/, '')}/business/addBusiness${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: new URLSearchParams(Object.entries(args.body).flatMap(([key, value]) => (value == null ? [] : [[key, String(value)]])))}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };