@0x3639/intervals-icu
    Preparing search index...

    Weather

    client.weather reads the athlete's weather forecast and manages the location used to generate it. All routes are athlete-scoped.

    Method What it does
    WeatherService.getForecast Get weather forecast for the athlete's location
    WeatherService.getWeatherConfig Get weather configuration (location)
    WeatherService.updateWeatherConfig Update weather configuration (set location)

    Fetch the athlete's weather forecast and print the first entry's fields, then fetch the weather configuration used to generate it.

    const client = new IntervalsClient({ apiKey });

    const weather = await client.weather.getForecast();
    const first = weather.forecasts?.[0];
    if (!first) {
    console.log('No forecast available for this athlete');
    } else {
    console.log(`Forecast for ${first.time ?? 'unknown time'}:`);
    console.log(` temp=${first.temp ?? 'n/a'} feels_like=${first.feels_like ?? 'n/a'} humidity=${first.humidity ?? 'n/a'}`);
    }

    const config = await client.weather.getWeatherConfig();
    console.log(`Location: ${config.location_name ?? 'not set'} (${config.latitude ?? 'n/a'}, ${config.longitude ?? 'n/a'})`);