export type CreateApiSerperReviewsArgs = {body: {fid?: string | undefined, cid?: string | undefined, placeId?: string | undefined, gl?: string | undefined, hl?: string | undefined, num?: number | undefined, page?: number | undefined, sortBy?: string | undefined, topicId?: string | undefined}}; export type CreateApiSerperReviewsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Google Reviews - returns reviews for a specific business/place including review text, ratings, authors, dates, and likes. Requires a place identifier (cid, fid, or placeId) obtained from Places or Maps search results. Use sortBy to order by relevance, newest, highest, or lowest rating. Pagination billing: call the first page normally and save billing.requestId from the Orthogonal /v1/run response. For later page, offset, or cursor calls on the same logical search, pass parentRequestId with unchanged non-pagination parameters. Valid continuation calls still get their own request IDs and quoted price, but are charged 0. Changing filters starts a new billable request. * * POST /serper/reviews */ export const createApiSerperReviews = async (args: CreateApiSerperReviewsArgs, options?: CreateApiSerperReviewsOptions) => { 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(/\/+$/, '')}/serper/reviews${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 };