export type UpdateUserRequest = {lastName?: string | undefined, firstName?: string | undefined, email: string}; export type UpdateApiPublicV1UsersArgs = {body: UpdateUserRequest}; export type UpdateApiPublicV1UsersOptions = {baseUrl: string, httpAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create or update a user in the organization * * PUT /public/v1/users */ export const updateApiPublicV1Users = async (args: UpdateApiPublicV1UsersArgs, options: UpdateApiPublicV1UsersOptions) => { const {baseUrl, fetch: fetchFn = fetch, httpAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (httpAuth !== undefined) headers.set('authorization', `Bearer ${httpAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/public/v1/users${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 };