export type GetApiV1UsersUserIdUserWeightsArgs = {user_id: number, page?: number | undefined}; export type GetApiV1UsersUserIdUserWeightsOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * List user weights * * GET /v1/users/{user_id}/user_weights */ export const getApiV1UsersUserIdUserWeights = async (args: GetApiV1UsersUserIdUserWeightsArgs, options?: GetApiV1UsersUserIdUserWeightsOptions) => { const {baseUrl = "http://localhost:3000", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.page != null) query.append("page", String(args.page)) if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/users/${encodeURIComponent(String(args.user_id))}/user_weights${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };