export type UpdateApiV1ShopsShopIdBundleOffersOfferIdUpdateArgs = {body: {name: string, type: 'percentage' | 'fixed', discount: number, max_uses_per_cart?: (number | null) | undefined, priority?: (number | null) | undefined, starts_at?: (string | null) | undefined, ends_at?: (string | null) | undefined, enabled: boolean, items: Array<{product_id: number, variant_ids?: Array | undefined, quantity: number}>}}; export type UpdateApiV1ShopsShopIdBundleOffersOfferIdUpdateOptions = {baseUrl?: string | undefined, defaultValue?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Bundle Offer * * PUT /v1/shops/{shopId}/bundle-offers/{offerId}/update */ export const updateApiV1ShopsShopIdBundleOffersOfferIdUpdate = async (args: UpdateApiV1ShopsShopIdBundleOffersOfferIdUpdateArgs, options?: UpdateApiV1ShopsShopIdBundleOffersOfferIdUpdateOptions) => { const {baseUrl = "https://api.sellauth.com", fetch: fetchFn = fetch, defaultValue} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (defaultValue !== undefined) headers.set('authorization', `Bearer ${defaultValue}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/shops/${encodeURIComponent(String(args.shopId))}/bundle-offers/${encodeURIComponent(String(args.offerId))}/update${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };