export type DeleteApiBasketsIdentPackagesRowsIdArgs = {ident: string, 'rows.id': number}; export type DeleteApiBasketsIdentPackagesRowsIdOptions = {baseUrl?: string | undefined, tebexCheckoutAuthBasic?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Remove a row from the basket * * DELETE /baskets/{ident}/packages/{rows.id} */ export const deleteApiBasketsIdentPackagesRowsId = async (args: DeleteApiBasketsIdentPackagesRowsIdArgs, options?: DeleteApiBasketsIdentPackagesRowsIdOptions) => { const {baseUrl = "https://checkout.tebex.io/api", fetch: fetchFn = fetch, tebexCheckoutAuthBasic} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (tebexCheckoutAuthBasic !== undefined) headers.set('authorization', `Basic ${btoa(`${tebexCheckoutAuthBasic.username}:${tebexCheckoutAuthBasic.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/baskets/${encodeURIComponent(String(args.ident))}/packages/${encodeURIComponent(String(args['rows.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 };