export type DeleteApiCrmV1EntitiesEntityTrashArgs = {body: {entity_ids?: Array | undefined}}; export type DeleteApiCrmV1EntitiesEntityTrashOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Permanently delete trashed items * * DELETE /crm/v1/entities/{entity}/trash */ export const deleteApiCrmV1EntitiesEntityTrash = async (args: DeleteApiCrmV1EntitiesEntityTrashArgs, options: DeleteApiCrmV1EntitiesEntityTrashOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/crm/v1/entities/${encodeURIComponent(String(args.entity))}/trash${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", 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 };