export type AddContactsDto = {contactsIds?: Array | undefined}; export type CreateApiApiV1ContactsListsListAddArgs = {list: string, body: AddContactsDto}; export type CreateApiApiV1ContactsListsListAddOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add contacts to list * * POST /api/v1/contacts/lists/{list}/add */ export const createApiApiV1ContactsListsListAdd = async (args: CreateApiApiV1ContactsListsListAddArgs, options?: CreateApiApiV1ContactsListsListAddOptions) => { const {baseUrl = "https://api.getprospect.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set("apiKey", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/contacts/lists/${encodeURIComponent(String(args.list))}/add${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 };