export type CreateApiAppYelpBusinessesBusinessRefListingUpdateStatusArgs = {businessRef: string}; export type CreateApiAppYelpBusinessesBusinessRefListingUpdateStatusOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Poll Yelp Data Ingestion and return the latest listing update job * * POST /app/yelp/businesses/{businessRef}/listing-update/status */ export const createApiAppYelpBusinessesBusinessRefListingUpdateStatus = async (args: CreateApiAppYelpBusinessesBusinessRefListingUpdateStatusArgs, options: CreateApiAppYelpBusinessesBusinessRefListingUpdateStatusOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/app/yelp/businesses/${encodeURIComponent(String(args.businessRef))}/listing-update/status${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };