export type GetApiV1GuidanceCapacityProjectionArgs = {targetDate: string, recoveryRideCount: number, enduranceRideCount: number, intensityRideCount: number, capacityRideCount: number}; export type GetApiV1GuidanceCapacityProjectionOptions = {baseUrl: string, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /v1/guidance/capacity-projection */ export const getApiV1GuidanceCapacityProjection = async (args: GetApiV1GuidanceCapacityProjectionArgs, options: GetApiV1GuidanceCapacityProjectionOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.targetDate != null) query.append("targetDate", String(args.targetDate)) if (args.recoveryRideCount != null) query.append("recoveryRideCount", String(args.recoveryRideCount)) if (args.enduranceRideCount != null) query.append("enduranceRideCount", String(args.enduranceRideCount)) if (args.intensityRideCount != null) query.append("intensityRideCount", String(args.intensityRideCount)) if (args.capacityRideCount != null) query.append("capacityRideCount", String(args.capacityRideCount)) if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/guidance/capacity-projection${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 };