export type DeleteApiOcapiV1OrdersOrderIdVouchersVoucherIdArgs = {orderId: string, voucherId: string, 'Connect-Region-Code'?: string | undefined}; export type DeleteApiOcapiV1OrdersOrderIdVouchersVoucherIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Removes a voucher from an in progress order base * * DELETE /ocapi/v1/orders/{orderId}/vouchers/{voucherId} */ export const deleteApiOcapiV1OrdersOrderIdVouchersVoucherId = async (args: DeleteApiOcapiV1OrdersOrderIdVouchersVoucherIdArgs, options: DeleteApiOcapiV1OrdersOrderIdVouchersVoucherIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['Connect-Region-Code'] != null) headers.set("Connect-Region-Code", String(args['Connect-Region-Code'])) const url = `${baseUrl.replace(/\/+$/, '')}/ocapi/v1/orders/${encodeURIComponent(String(args.orderId))}/vouchers/${encodeURIComponent(String(args.voucherId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };