export type CreateApiAppsSystemConfigComShinesolutionsAemPasswordresetActivatorArgs = {'pwdreset.authorizables'?: Array | undefined, 'pwdreset.authorizables@TypeHint'?: string | undefined}; export type CreateApiAppsSystemConfigComShinesolutionsAemPasswordresetActivatorOptions = {baseUrl: string, aemAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * POST /apps/system/config/com.shinesolutions.aem.passwordreset.Activator */ export const createApiAppsSystemConfigComShinesolutionsAemPasswordresetActivator = async (args: CreateApiAppsSystemConfigComShinesolutionsAemPasswordresetActivatorArgs, options: CreateApiAppsSystemConfigComShinesolutionsAemPasswordresetActivatorOptions) => { const {baseUrl, fetch: fetchFn = fetch, aemAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() for (const item of args['pwdreset.authorizables'] ?? []) query.append("pwdreset.authorizables", String(item)) if (args['pwdreset.authorizables@TypeHint'] != null) query.append("pwdreset.authorizables@TypeHint", String(args['pwdreset.authorizables@TypeHint'])) if (aemAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${aemAuth.username}:${aemAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/apps/system/config/com.shinesolutions.aem.passwordreset.Activator${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 };