export type UserUpdate = {user?: ({email?: string | undefined, name?: string | undefined, username?: string | undefined, password?: string | undefined, city?: string | undefined, state?: string | undefined, country?: string | undefined, address?: string | undefined, about_me?: string | undefined, birth_date?: string | undefined, gender?: string | undefined, image_url?: string | undefined, level?: string | undefined, height?: number | undefined, height_unit?: string | undefined, weight?: number | undefined, goal_weight?: number | undefined, goal_weight_unit?: string | undefined, weight_unit?: string | undefined, max_pushups?: number | undefined, max_pullups?: number | undefined, max_dips?: number | undefined, max_squats?: number | undefined, device_id?: string | undefined, last_seen?: string | undefined, timezone?: string | undefined, send_workout_notifications?: boolean | undefined, send_social_notifications?: boolean | undefined, main_goals?: Array | undefined}) | undefined}; export type UpdateApiV1UsersCurrentArgs = {body: UserUpdate}; export type UpdateApiV1UsersCurrentOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update current user * * PUT /v1/users/current */ export const updateApiV1UsersCurrent = async (args: UpdateApiV1UsersCurrentArgs, options?: UpdateApiV1UsersCurrentOptions) => { const {baseUrl = "http://localhost:3000", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/users/current${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 };