export type ClientContactIncludedIdsDto = {include: Array}; export type ClientContactIncludedSelectionDto = {type: 'included', ids: ClientContactIncludedIdsDto}; export type UnlinkClientContactsFromListDto = {selection: ClientContactIncludedSelectionDto}; export type CreateApiListsIdClientContactsUnlinkArgs = {id: string, body: UnlinkClientContactsFromListDto}; export type CreateApiListsIdClientContactsUnlinkOptions = {baseUrl: string, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Unlink client contacts from a list * * POST /lists/{id}/client-contacts/_unlink */ export const createApiListsIdClientContactsUnlink = async (args: CreateApiListsIdClientContactsUnlinkArgs, options: CreateApiListsIdClientContactsUnlinkOptions) => { const {baseUrl, fetch: fetchFn = fetch, xApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (xApiKey !== undefined) headers.set("x-api-key", xApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/lists/${encodeURIComponent(String(args.id))}/client-contacts/_unlink${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };