export type DeleteApiLeadV2LeadsLeadIdArgs = {context: 'RESELLER' | 'REFERRAL' | 'DEVELOPER' | 'RESELLER_MANAGER' | 'PARTNER' | 'ANONYMOUS' | 'CHANNEL_ADMIN', leadId: string, companyId: string}; export type DeleteApiLeadV2LeadsLeadIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Discard lead * * DELETE /lead/v2/leads/{leadId} */ export const deleteApiLeadV2LeadsLeadId = async (args: DeleteApiLeadV2LeadsLeadIdArgs, options?: DeleteApiLeadV2LeadsLeadIdOptions) => { const {baseUrl = "https://marketplace.appdirect.com/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.context != null) query.append("context", String(args.context)) if (args.companyId != null) query.append("companyId", String(args.companyId)) const url = `${baseUrl.replace(/\/+$/, '')}/lead/v2/leads/${encodeURIComponent(String(args.leadId))}${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 };