export type UpdateApiV1ShopsShopIdCouponsCouponIdUpdateArgs = {body: {code: string, global: boolean, discount: number, type: 'percentage' | 'fixed', max_uses?: (number | null) | undefined, max_uses_per_customer?: (number | null) | undefined, min_invoice_price?: (number | null) | undefined, start_date?: (string | null) | undefined, expiration_date?: (string | null) | undefined, allowed_emails?: Array | undefined, payment_method_ids?: (Array) | undefined, uses_count_mode?: ('pending' | 'paid' | null) | undefined, applies_to_renewals?: (boolean | null) | undefined, items?: (Array<{product_id: string, variant_ids?: (Array) | undefined}>) | undefined, disable_if_volume_discount?: (boolean | null) | undefined, disable_if_quantity_deal?: (boolean | null) | undefined, disable_if_bundle_offer?: (boolean | null) | undefined, disable_if_gateway_discount?: (boolean | null) | undefined, disable_if_affiliate_discount?: (boolean | null) | undefined, disable_if_reseller_discount?: (boolean | null) | undefined}}; export type UpdateApiV1ShopsShopIdCouponsCouponIdUpdateOptions = {baseUrl?: string | undefined, defaultValue?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Coupon * * PUT /v1/shops/{shopId}/coupons/{couponId}/update */ export const updateApiV1ShopsShopIdCouponsCouponIdUpdate = async (args: UpdateApiV1ShopsShopIdCouponsCouponIdUpdateArgs, options?: UpdateApiV1ShopsShopIdCouponsCouponIdUpdateOptions) => { 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))}/coupons/${encodeURIComponent(String(args.couponId))}/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 };