export type DeleteApiApiV1ContactsPkArgs = {pk: string}; export type DeleteApiApiV1ContactsPkOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Delete a contact * * DELETE /api/v1/contacts/{pk}/ */ export const deleteApiApiV1ContactsPk = async (args: DeleteApiApiV1ContactsPkArgs, options: DeleteApiApiV1ContactsPkOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/contacts/${encodeURIComponent(String(args.pk))}/${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 };