export type CreateApiV1TasksExpungeAndArchiveHistoricalDataOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Deletes and archives historical data based on `expungeAndArchiveDataConfig`. Currently, 1. deletes historical users not attached to any service 2. deletes historical invites 3. deletes forgotten passwords 4. archives services without transactions within the configured number of days and detaches users from service * * POST /v1/tasks/expunge-and-archive-historical-data */ export const createApiV1TasksExpungeAndArchiveHistoricalData = async (options: CreateApiV1TasksExpungeAndArchiveHistoricalDataOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/v1/tasks/expunge-and-archive-historical-data${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };