export type AcceptorOnlineSettingCommand = {delivery?: boolean | undefined, maxDistance?: number | undefined, pickup?: boolean | undefined, pickupGap?: number | undefined, tables?: boolean | undefined, tax?: boolean | undefined, taxRaw?: boolean | undefined}; export type UpdateApiApiAcceptorOnlineSettingCodeArgs = {code: string, body: AcceptorOnlineSettingCommand}; export type UpdateApiApiAcceptorOnlineSettingCodeOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * onlineSettingUpdate * * PUT /api/acceptor/online-setting/{code} */ export const updateApiApiAcceptorOnlineSettingCode = async (args: UpdateApiApiAcceptorOnlineSettingCodeArgs, options: UpdateApiApiAcceptorOnlineSettingCodeOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/api/acceptor/online-setting/${encodeURIComponent(String(args.code))}${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 res.blob() };