export type DeleteApiV2AddressBooksAddressBookIdContactsArgs = {addressBookId: number}; export type DeleteApiV2AddressBooksAddressBookIdContactsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deletes all contacts from a given list. * * DELETE /v2/address-books/{addressBookId}/contacts */ export const deleteApiV2AddressBooksAddressBookIdContacts = async (args: DeleteApiV2AddressBooksAddressBookIdContactsArgs, options?: DeleteApiV2AddressBooksAddressBookIdContactsOptions) => { const {baseUrl = "https://api.dotdigital.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/v2/address-books/${encodeURIComponent(String(args.addressBookId))}/contacts${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 };