export type DeleteApiApiV1RewardsIdArgs = {id: string, 'Client-ID': string, Authorization: string}; export type DeleteApiApiV1RewardsIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Cancel Reward * * DELETE /api/v1/rewards/{id} */ export const deleteApiApiV1RewardsId = async (args: DeleteApiApiV1RewardsIdArgs, options?: DeleteApiApiV1RewardsIdOptions) => { const {baseUrl = "https://merchant-api.accruesavings.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['Client-ID'] != null) headers.set("Client-ID", String(args['Client-ID'])) if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/rewards/${encodeURIComponent(String(args.id))}${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 };