export type CreateApiLoyaltyV1RewardsBurnArgs = {body: {elements?: (Array<{card_code: string, reason_msg?: string | undefined, burned_date?: string | undefined, store_id?: string | undefined, attribution_ids?: Array | undefined}>) | undefined}}; export type CreateApiLoyaltyV1RewardsBurnOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Use a list of granted rewards * * POST /loyalty/v1/rewards/burn */ export const createApiLoyaltyV1RewardsBurn = async (args: CreateApiLoyaltyV1RewardsBurnArgs, options?: CreateApiLoyaltyV1RewardsBurnOptions) => { const {baseUrl = "https://api.splio.com", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/loyalty/v1/rewards/burn${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 (await res.json()) as unknown };