export type DeleteApiV2LeadstatusArgs = {name: string, Authorization: string}; export type DeleteApiV2LeadstatusOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a Lead Status * * DELETE /v2/leadstatus */ export const deleteApiV2Leadstatus = async (args: DeleteApiV2LeadstatusArgs, options?: DeleteApiV2LeadstatusOptions) => { const {baseUrl = "https://api.workiz.com/crm/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.name != null) query.append("name", String(args.name)) if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) const url = `${baseUrl.replace(/\/+$/, '')}/v2/leadstatus${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 };