export type GetApiScrapecreatorsV1GoogleSearchArgs = {query: string, region?: string | undefined}; export type GetApiScrapecreatorsV1GoogleSearchOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Google * * GET /scrapecreators/v1/google/search */ export const getApiScrapecreatorsV1GoogleSearch = async (args: GetApiScrapecreatorsV1GoogleSearchArgs, options?: GetApiScrapecreatorsV1GoogleSearchOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.query != null) query.append("query", String(args.query)) if (args.region != null) query.append("region", String(args.region)) const url = `${baseUrl.replace(/\/+$/, '')}/scrapecreators/v1/google/search${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };