export type GetApiShopifyWebhooksArgs = {SiteId?: number | undefined, CustomerExternalId?: string | undefined}; export type GetApiShopifyWebhooksOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /ShopifyWebhooks */ export const getApiShopifyWebhooks = async (args: GetApiShopifyWebhooksArgs, options?: GetApiShopifyWebhooksOptions) => { const {baseUrl = "https://api.qpilot.cloud", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.SiteId != null) query.append("SiteId", String(args.SiteId)) if (args.CustomerExternalId != null) query.append("CustomerExternalId", String(args.CustomerExternalId)) if (Bearer !== undefined) headers.set("Authorization", Bearer) const url = `${baseUrl.replace(/\/+$/, '')}/ShopifyWebhooks${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 };