export type DeleteApiApiV1ProductsBySlugSlugArgs = {slug: string, fail_if_active_offers?: boolean | undefined}; export type DeleteApiApiV1ProductsBySlugSlugOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a product by slug * * DELETE /api/v1/products/by-slug/{slug}/ */ export const deleteApiApiV1ProductsBySlugSlug = async (args: DeleteApiApiV1ProductsBySlugSlugArgs, options?: DeleteApiApiV1ProductsBySlugSlugOptions) => { const {baseUrl = "https://partnerapi-staging.depop.com", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.fail_if_active_offers != null) query.append("fail_if_active_offers", String(args.fail_if_active_offers)) if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/products/by-slug/${encodeURIComponent(String(args.slug))}/${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 };