export type CreateApiEtcReplicationAgentsRunmodeNameArgs = {runmode: string, name: string, 'jcr:content/cq:distribute'?: boolean | undefined, 'jcr:content/cq:distribute@TypeHint'?: string | undefined, 'jcr:content/cq:name'?: string | undefined, 'jcr:content/cq:template'?: string | undefined, 'jcr:content/aliasUpdate'?: boolean | undefined, 'jcr:content/enabled'?: boolean | undefined, 'jcr:content/jcr:description'?: string | undefined, 'jcr:content/jcr:lastModified'?: string | undefined, 'jcr:content/jcr:lastModifiedBy'?: string | undefined, 'jcr:content/jcr:mixinTypes'?: string | undefined, 'jcr:content/jcr:title'?: string | undefined, 'jcr:content/logLevel'?: string | undefined, 'jcr:content/noStatusUpdate'?: boolean | undefined, 'jcr:content/noVersioning'?: boolean | undefined, 'jcr:content/protocolConnectTimeout'?: number | undefined, 'jcr:content/protocolHTTPConnectionClosed'?: boolean | undefined, 'jcr:content/protocolHTTPExpired'?: string | undefined, 'jcr:content/protocolHTTPHeaders'?: Array | undefined, 'jcr:content/protocolHTTPHeaders@TypeHint'?: string | undefined, 'jcr:content/protocolHTTPMethod'?: string | undefined, 'jcr:content/protocolHTTPSRelaxed'?: boolean | undefined, 'jcr:content/protocolInterface'?: string | undefined, 'jcr:content/protocolSocketTimeout'?: number | undefined, 'jcr:content/protocolVersion'?: string | undefined, 'jcr:content/proxyNTLMDomain'?: string | undefined, 'jcr:content/proxyNTLMHost'?: string | undefined, 'jcr:content/proxyHost'?: string | undefined, 'jcr:content/proxyPassword'?: string | undefined, 'jcr:content/proxyPort'?: number | undefined, 'jcr:content/proxyUser'?: string | undefined, 'jcr:content/queueBatchMaxSize'?: number | undefined, 'jcr:content/queueBatchMode'?: string | undefined, 'jcr:content/queueBatchWaitTime'?: number | undefined, 'jcr:content/retryDelay'?: string | undefined, 'jcr:content/reverseReplication'?: boolean | undefined, 'jcr:content/serializationType'?: string | undefined, 'jcr:content/sling:resourceType'?: string | undefined, 'jcr:content/ssl'?: string | undefined, 'jcr:content/transportNTLMDomain'?: string | undefined, 'jcr:content/transportNTLMHost'?: string | undefined, 'jcr:content/transportPassword'?: string | undefined, 'jcr:content/transportUri'?: string | undefined, 'jcr:content/transportUser'?: string | undefined, 'jcr:content/triggerDistribute'?: boolean | undefined, 'jcr:content/triggerModified'?: boolean | undefined, 'jcr:content/triggerOnOffTime'?: boolean | undefined, 'jcr:content/triggerReceive'?: boolean | undefined, 'jcr:content/triggerSpecific'?: boolean | undefined, 'jcr:content/userId'?: string | undefined, 'jcr:primaryType'?: string | undefined, ':operation'?: string | undefined}; export type CreateApiEtcReplicationAgentsRunmodeNameOptions = {baseUrl: string, aemAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * POST /etc/replication/agents.{runmode}/{name} */ export const createApiEtcReplicationAgentsRunmodeName = async (args: CreateApiEtcReplicationAgentsRunmodeNameArgs, options: CreateApiEtcReplicationAgentsRunmodeNameOptions) => { const {baseUrl, fetch: fetchFn = fetch, aemAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['jcr:content/cq:distribute'] != null) query.append("jcr:content/cq:distribute", String(args['jcr:content/cq:distribute'])) if (args['jcr:content/cq:distribute@TypeHint'] != null) query.append("jcr:content/cq:distribute@TypeHint", String(args['jcr:content/cq:distribute@TypeHint'])) if (args['jcr:content/cq:name'] != null) query.append("jcr:content/cq:name", String(args['jcr:content/cq:name'])) if (args['jcr:content/cq:template'] != null) query.append("jcr:content/cq:template", String(args['jcr:content/cq:template'])) if (args['jcr:content/aliasUpdate'] != null) query.append("jcr:content/aliasUpdate", String(args['jcr:content/aliasUpdate'])) if (args['jcr:content/enabled'] != null) query.append("jcr:content/enabled", String(args['jcr:content/enabled'])) if (args['jcr:content/jcr:description'] != null) query.append("jcr:content/jcr:description", String(args['jcr:content/jcr:description'])) if (args['jcr:content/jcr:lastModified'] != null) query.append("jcr:content/jcr:lastModified", String(args['jcr:content/jcr:lastModified'])) if (args['jcr:content/jcr:lastModifiedBy'] != null) query.append("jcr:content/jcr:lastModifiedBy", String(args['jcr:content/jcr:lastModifiedBy'])) if (args['jcr:content/jcr:mixinTypes'] != null) query.append("jcr:content/jcr:mixinTypes", String(args['jcr:content/jcr:mixinTypes'])) if (args['jcr:content/jcr:title'] != null) query.append("jcr:content/jcr:title", String(args['jcr:content/jcr:title'])) if (args['jcr:content/logLevel'] != null) query.append("jcr:content/logLevel", String(args['jcr:content/logLevel'])) if (args['jcr:content/noStatusUpdate'] != null) query.append("jcr:content/noStatusUpdate", String(args['jcr:content/noStatusUpdate'])) if (args['jcr:content/noVersioning'] != null) query.append("jcr:content/noVersioning", String(args['jcr:content/noVersioning'])) if (args['jcr:content/protocolConnectTimeout'] != null) query.append("jcr:content/protocolConnectTimeout", String(args['jcr:content/protocolConnectTimeout'])) if (args['jcr:content/protocolHTTPConnectionClosed'] != null) query.append("jcr:content/protocolHTTPConnectionClosed", String(args['jcr:content/protocolHTTPConnectionClosed'])) if (args['jcr:content/protocolHTTPExpired'] != null) query.append("jcr:content/protocolHTTPExpired", String(args['jcr:content/protocolHTTPExpired'])) for (const item of args['jcr:content/protocolHTTPHeaders'] ?? []) query.append("jcr:content/protocolHTTPHeaders", String(item)) if (args['jcr:content/protocolHTTPHeaders@TypeHint'] != null) query.append("jcr:content/protocolHTTPHeaders@TypeHint", String(args['jcr:content/protocolHTTPHeaders@TypeHint'])) if (args['jcr:content/protocolHTTPMethod'] != null) query.append("jcr:content/protocolHTTPMethod", String(args['jcr:content/protocolHTTPMethod'])) if (args['jcr:content/protocolHTTPSRelaxed'] != null) query.append("jcr:content/protocolHTTPSRelaxed", String(args['jcr:content/protocolHTTPSRelaxed'])) if (args['jcr:content/protocolInterface'] != null) query.append("jcr:content/protocolInterface", String(args['jcr:content/protocolInterface'])) if (args['jcr:content/protocolSocketTimeout'] != null) query.append("jcr:content/protocolSocketTimeout", String(args['jcr:content/protocolSocketTimeout'])) if (args['jcr:content/protocolVersion'] != null) query.append("jcr:content/protocolVersion", String(args['jcr:content/protocolVersion'])) if (args['jcr:content/proxyNTLMDomain'] != null) query.append("jcr:content/proxyNTLMDomain", String(args['jcr:content/proxyNTLMDomain'])) if (args['jcr:content/proxyNTLMHost'] != null) query.append("jcr:content/proxyNTLMHost", String(args['jcr:content/proxyNTLMHost'])) if (args['jcr:content/proxyHost'] != null) query.append("jcr:content/proxyHost", String(args['jcr:content/proxyHost'])) if (args['jcr:content/proxyPassword'] != null) query.append("jcr:content/proxyPassword", String(args['jcr:content/proxyPassword'])) if (args['jcr:content/proxyPort'] != null) query.append("jcr:content/proxyPort", String(args['jcr:content/proxyPort'])) if (args['jcr:content/proxyUser'] != null) query.append("jcr:content/proxyUser", String(args['jcr:content/proxyUser'])) if (args['jcr:content/queueBatchMaxSize'] != null) query.append("jcr:content/queueBatchMaxSize", String(args['jcr:content/queueBatchMaxSize'])) if (args['jcr:content/queueBatchMode'] != null) query.append("jcr:content/queueBatchMode", String(args['jcr:content/queueBatchMode'])) if (args['jcr:content/queueBatchWaitTime'] != null) query.append("jcr:content/queueBatchWaitTime", String(args['jcr:content/queueBatchWaitTime'])) if (args['jcr:content/retryDelay'] != null) query.append("jcr:content/retryDelay", String(args['jcr:content/retryDelay'])) if (args['jcr:content/reverseReplication'] != null) query.append("jcr:content/reverseReplication", String(args['jcr:content/reverseReplication'])) if (args['jcr:content/serializationType'] != null) query.append("jcr:content/serializationType", String(args['jcr:content/serializationType'])) if (args['jcr:content/sling:resourceType'] != null) query.append("jcr:content/sling:resourceType", String(args['jcr:content/sling:resourceType'])) if (args['jcr:content/ssl'] != null) query.append("jcr:content/ssl", String(args['jcr:content/ssl'])) if (args['jcr:content/transportNTLMDomain'] != null) query.append("jcr:content/transportNTLMDomain", String(args['jcr:content/transportNTLMDomain'])) if (args['jcr:content/transportNTLMHost'] != null) query.append("jcr:content/transportNTLMHost", String(args['jcr:content/transportNTLMHost'])) if (args['jcr:content/transportPassword'] != null) query.append("jcr:content/transportPassword", String(args['jcr:content/transportPassword'])) if (args['jcr:content/transportUri'] != null) query.append("jcr:content/transportUri", String(args['jcr:content/transportUri'])) if (args['jcr:content/transportUser'] != null) query.append("jcr:content/transportUser", String(args['jcr:content/transportUser'])) if (args['jcr:content/triggerDistribute'] != null) query.append("jcr:content/triggerDistribute", String(args['jcr:content/triggerDistribute'])) if (args['jcr:content/triggerModified'] != null) query.append("jcr:content/triggerModified", String(args['jcr:content/triggerModified'])) if (args['jcr:content/triggerOnOffTime'] != null) query.append("jcr:content/triggerOnOffTime", String(args['jcr:content/triggerOnOffTime'])) if (args['jcr:content/triggerReceive'] != null) query.append("jcr:content/triggerReceive", String(args['jcr:content/triggerReceive'])) if (args['jcr:content/triggerSpecific'] != null) query.append("jcr:content/triggerSpecific", String(args['jcr:content/triggerSpecific'])) if (args['jcr:content/userId'] != null) query.append("jcr:content/userId", String(args['jcr:content/userId'])) if (args['jcr:primaryType'] != null) query.append("jcr:primaryType", String(args['jcr:primaryType'])) if (args[':operation'] != null) query.append(":operation", String(args[':operation'])) if (aemAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${aemAuth.username}:${aemAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/etc/replication/agents.${encodeURIComponent(String(args.runmode))}/${encodeURIComponent(String(args.name))}${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 };