export type DeleteApiPublicApiOffersIdArgs = {id: string}; export type DeleteApiPublicApiOffersIdOptions = {baseUrl?: string | undefined, OAuthToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Public API for managing offers, inherits from OfferAPIView, * * DELETE /public_api/offers/{id}/ */ export const deleteApiPublicApiOffersId = async (args: DeleteApiPublicApiOffersIdArgs, options?: DeleteApiPublicApiOffersIdOptions) => { const {baseUrl = "https://api.cakto.com.br", fetch: fetchFn = fetch, OAuthToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (OAuthToken !== undefined) headers.set('authorization', `Bearer ${OAuthToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/public_api/offers/${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 };