export type CreateApiLibsReplicationTreeactivationHtmlArgs = {ignoredeactivated: boolean, onlymodified: boolean, path: string, cmd: string}; export type CreateApiLibsReplicationTreeactivationHtmlOptions = {baseUrl: string, aemAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * POST /libs/replication/treeactivation.html */ export const createApiLibsReplicationTreeactivationHtml = async (args: CreateApiLibsReplicationTreeactivationHtmlArgs, options: CreateApiLibsReplicationTreeactivationHtmlOptions) => { const {baseUrl, fetch: fetchFn = fetch, aemAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.ignoredeactivated != null) query.append("ignoredeactivated", String(args.ignoredeactivated)) if (args.onlymodified != null) query.append("onlymodified", String(args.onlymodified)) if (args.path != null) query.append("path", String(args.path)) if (args.cmd != null) query.append("cmd", String(args.cmd)) if (aemAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${aemAuth.username}:${aemAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/libs/replication/treeactivation.html${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 };