export type GetApiV2BackupTasksArgs = {source?: ('GMAIL' | 'GDOC' | 'GDRIVETEAM' | 'SFC' | 'GOOGLEAPPS' | 'GCALENDAR' | 'GTASK' | 'GCONTACTS' | 'YMAIL' | 'GACCOUNTS' | 'GSITES' | 'SDB' | 'O365MAIL' | 'O365CONTACTS' | 'DDB' | 'MS365' | 'O365CALENDAR' | 'O365TASKS' | 'SHAREPOINT' | 'SHAREPOINT_MULTI' | 'ONEDRIVE' | 'IMAP' | 'BOX' | 'PUBLICWORDPRESS' | 'DROPBOX' | 'MS365GROUPS' | 'MS365GROUP_CONVERSATIONS' | 'MS365GROUP_CALENDAR' | 'MS365GROUP_SITE' | 'MS365GROUP_META' | 'O365NOTES' | 'MS365TEAM_CHANNELS' | 'MS365TEAM_APPS' | 'MSTEAMS' | 'MSGROUPS' | 'INTERNAL' | 'DYNAMICS365' | 'ENTRAID') | undefined, page?: number | undefined, pageSize?: number | undefined, type?: ('BACKUP' | 'RESTORE' | 'EXPORT') | undefined}; export type GetApiV2BackupTasksOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * getTasks * * GET /v2/backup-tasks */ export const getApiV2BackupTasks = async (args: GetApiV2BackupTasksArgs, options?: GetApiV2BackupTasksOptions) => { const {baseUrl = "https://api.cloudally.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.source != null) query.append("source", String(args.source)) if (args.page != null) query.append("page", String(args.page)) if (args.pageSize != null) query.append("pageSize", String(args.pageSize)) if (args.type != null) query.append("type", String(args.type)) const url = `${baseUrl.replace(/\/+$/, '')}/v2/backup-tasks${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };