export type UpdateAdminuserPayload = {email?: string | undefined, first_name?: string | undefined, id?: number | undefined, last_name?: string | undefined, password?: string | undefined, role?: string | undefined, validated?: boolean | undefined, validation_code?: string | undefined}; export type PatchApiAdminUsersUserIDArgs = {userID: number, body: UpdateAdminuserPayload}; export type PatchApiAdminUsersUserIDOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * PATCH /admin/users/{userID} */ export const patchApiAdminUsersUserID = async (args: PatchApiAdminUsersUserIDArgs, options?: PatchApiAdminUsersUserIDOptions) => { const {baseUrl = "https://congo.gopheracademy.com/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/admin/users/${encodeURIComponent(String(args.userID))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };