export type PatchApiV1ShopsShopIdQuantityDealsDealIdArgs = {body: {name?: string | undefined, product_id?: number | undefined, variant_id?: (number | null) | undefined, buy_quantity?: number | undefined, discounted_quantity?: number | undefined, percentage?: number | undefined, max_uses_per_cart?: (number | null) | undefined, priority?: (number | null) | undefined, starts_at?: (string | null) | undefined, ends_at?: (string | null) | undefined, enabled?: boolean | undefined}}; export type PatchApiV1ShopsShopIdQuantityDealsDealIdOptions = {baseUrl?: string | undefined, defaultValue?: string | undefined, fetch?: typeof fetch | undefined}; /** * Patch Quantity Deal * * PATCH /v1/shops/{shopId}/quantity-deals/{dealId} */ export const patchApiV1ShopsShopIdQuantityDealsDealId = async (args: PatchApiV1ShopsShopIdQuantityDealsDealIdArgs, options?: PatchApiV1ShopsShopIdQuantityDealsDealIdOptions) => { 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))}/quantity-deals/${encodeURIComponent(String(args.dealId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };