export type Roles = {id?: number | undefined, name?: string | undefined}; export type Users = {id?: number | undefined, emailAddress?: string | undefined, password?: string | undefined, roles?: Array | undefined}; export type UpdateApiRestUsersEmailAddressArgs = {emailAddress: string, body: Users}; export type UpdateApiRestUsersEmailAddressOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * PUT /rest/users/{emailAddress} */ export const updateApiRestUsersEmailAddress = async (args: UpdateApiRestUsersEmailAddressArgs, options?: UpdateApiRestUsersEmailAddressOptions) => { const {baseUrl = "http://172.18.0.2:3333", 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(/\/+$/, '')}/rest/users/${encodeURIComponent(String(args.emailAddress))}${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 res.blob() };