export type CreateApiOrdersV3HarvestArgs = {storeId?: unknown | undefined}; export type CreateApiOrdersV3HarvestOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Send harvest request to all your marketplaces * * POST /orders/v3//harvest */ export const createApiOrdersV3Harvest = async (args: CreateApiOrdersV3HarvestArgs, options?: CreateApiOrdersV3HarvestOptions) => { const {baseUrl = "https://api.beezup.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.storeId != null) query.append("storeId", String(args.storeId)) const url = `${baseUrl.replace(/\/+$/, '')}/orders/v3//harvest${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 };