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

    Sport settings

    client.sportSettings manages per-sport-type-group settings such as thresholds, zones and load calculation for an athlete. Settings can be applied retroactively to matching activities and queried for pace-curve distance defaults.

    Method What it does
    SportSettingsService.list List all sport settings for an athlete
    SportSettingsService.get Get a single sport settings entry by ID
    SportSettingsService.create Create a new sport settings entry
    SportSettingsService.update Update a single sport settings entry
    SportSettingsService.updateMultiple Update multiple sport settings at once
    SportSettingsService.delete Delete a sport settings entry
    SportSettingsService.applyToActivities Apply sport settings to existing activities
    SportSettingsService.listMatchingActivities Activities whose type falls under these sport settings
    SportSettingsService.getPaceDistances Pace-curve distances and best-effort defaults for the sport

    List the athlete's sport settings and print each one's activity types and key thresholds (FTP, threshold pace, threshold heart rate).

    const client = new IntervalsClient({ apiKey });

    const settings = await client.sportSettings.list();
    if (settings.length === 0) {
    console.log('No sport settings found');
    } else {
    for (const entry of settings) {
    const types = entry.types?.join(', ') ?? 'n/a';
    console.log(`${types}: ftp=${entry.ftp ?? 'n/a'} threshold_pace=${entry.threshold_pace ?? 'n/a'} lthr=${entry.lthr ?? 'n/a'}`);
    }
    }

    Take the athlete's first sport settings entry, count activities that match it, then print its pace-curve distances and best-effort defaults.

    const client = new IntervalsClient({ apiKey });

    const settings = await client.sportSettings.list();
    const first = settings[0];

    if (!first || first.id === undefined) {
    console.log('No sport settings found');
    } else {
    const matching = await client.sportSettings.listMatchingActivities(first.id);
    console.log(`${matching.length} activities match ${first.types?.join(', ') ?? 'these settings'}`);

    const paceDistances = await client.sportSettings.getPaceDistances(first.id);
    console.log(`Distances: ${paceDistances.distances?.join(', ') ?? 'n/a'}`);
    console.log(`Defaults: ${paceDistances.defaults?.join(', ') ?? 'n/a'}`);
    }