export type DeleteApiApiV2MeCartIdArgs = {id: string, Authorization: string, Accept: string, 'Content-Type': string, 'User-Agent': string}; export type DeleteApiApiV2MeCartIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Remoção de itens do carrinho * * DELETE /api/v2/me/cart/{id} */ export const deleteApiApiV2MeCartId = async (args: DeleteApiApiV2MeCartIdArgs, options?: DeleteApiApiV2MeCartIdOptions) => { const {baseUrl = "https://sandbox.melhorenvio.com.br", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) if (args.Accept != null) headers.set("Accept", String(args.Accept)) if (args['Content-Type'] != null) headers.set("Content-Type", String(args['Content-Type'])) if (args['User-Agent'] != null) headers.set("User-Agent", String(args['User-Agent'])) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/me/cart/${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 (await res.json()) as unknown };