export type PatchApiV1ShopsShopIdShippingZonesZoneIdArgs = {body: {name?: string | undefined, price?: number | undefined, currency?: string | undefined, countries?: Array | undefined, free_shipping_threshold?: (number | null) | undefined}}; export type PatchApiV1ShopsShopIdShippingZonesZoneIdOptions = {baseUrl?: string | undefined, defaultValue?: string | undefined, fetch?: typeof fetch | undefined}; /** * Patch Shipping Zone * * PATCH /v1/shops/{shopId}/shipping-zones/{zoneId} */ export const patchApiV1ShopsShopIdShippingZonesZoneId = async (args: PatchApiV1ShopsShopIdShippingZonesZoneIdArgs, options?: PatchApiV1ShopsShopIdShippingZonesZoneIdOptions) => { 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))}/shipping-zones/${encodeURIComponent(String(args.zoneId))}${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 };