export type CreateApiBytemineB2bSearchArgs = {body: {query?: string | undefined, industry?: string | undefined, naics_code?: string | undefined, keywords?: string | undefined, state?: string | undefined, city?: string | undefined, country?: string | undefined, min_employees?: number | undefined, max_employees?: number | undefined, has_website?: boolean | undefined, page?: number | undefined, page_size?: number | undefined}}; export type CreateApiBytemineB2bSearchOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Search companies by name, industry, NAICS code, keywords, location, employee count. 1 credit per company returned. * * POST /bytemine/b2b-search */ export const createApiBytemineB2bSearch = async (args: CreateApiBytemineB2bSearchArgs, options?: CreateApiBytemineB2bSearchOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/bytemine/b2b-search${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 };