export type UserConfigurations = {'erixa.hotfolder'?: string | undefined, 'erixa.drugstore.email'?: string | undefined, 'erixa.user.email'?: string | undefined, 'erixa.user.password'?: string | undefined, 'erixa.api.key'?: string | undefined, 'extractor.template.profile'?: string | undefined, 'connector.base-url'?: string | undefined, 'connector.mandant-id'?: string | undefined, 'connector.workplace-id'?: string | undefined, 'connector.client-system-id'?: string | undefined, 'connector.user-id'?: string | undefined, 'connector.version'?: string | undefined, 'connector.tvMode'?: string | undefined, 'connector.client-certificate'?: string | undefined, 'connector.client-certificate-password'?: string | undefined, 'connector.basic-auth-username'?: string | undefined, 'connector.basic-auth-password'?: string | undefined, 'kbv.pruefnummer'?: string | undefined}; export type UpdateApiConfigArgs = {body: UserConfigurations}; export type UpdateApiConfigOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * PUT /config */ export const updateApiConfig = async (args: UpdateApiConfigArgs, options: UpdateApiConfigOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/config${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };