export type ChangePasswordRequest = {data?: ({pass?: string | undefined, newPass?: string | undefined}) | undefined}; export type CreateApiLdapUserUserPasswordArgs = {user: string, body: ChangePasswordRequest}; export type CreateApiLdapUserUserPasswordOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * ChangePassword * * POST /ldap/user/{user}/password */ export const createApiLdapUserUserPassword = async (args: CreateApiLdapUserUserPasswordArgs, options?: CreateApiLdapUserUserPasswordOptions) => { const {baseUrl = "http://:8085/gbds/v2", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/ldap/user/${encodeURIComponent(String(args.user))}/password${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 res.blob() };