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

    Folders

    client.folders manages the folders and training plans that organize an athlete's workout library, including plan sharing and imported workout files. FolderService.updatePlanWorkouts edits a range of the plan's own workouts — the API currently changes only hide_from_athlete — and FolderService.applyPlanChanges pushes the plan's changes onto the athlete's calendar, updating only workouts dated today or later.

    Method What it does
    FolderService.list List all folders/plans for an athlete
    FolderService.create Create a new folder or plan
    FolderService.update Update a folder/plan
    FolderService.delete Delete a folder/plan
    FolderService.updatePlanWorkouts Update the plan workouts in a day range (only hide_from_athlete can be changed)
    FolderService.getSharedWith Get athletes a folder is shared with
    FolderService.updateSharedWith Update sharing settings for a folder
    FolderService.importWorkout Import a workout file (.zwo, .mrc, .erg, .fit) into a folder
    FolderService.applyPlanChanges Apply plan changes to the calendar (today's and future workouts only)

    List the athlete's folders and plans, then get who the first folder is shared with.

    const client = new IntervalsClient({ apiKey });

    const folders = await client.folders.list();
    console.log(`${folders.length} folders`);
    for (const folder of folders) {
    const count = folder.num_workouts !== undefined ? `, ${folder.num_workouts} workouts` : '';
    console.log(`- ${folder.name ?? folder.id} (${folder.type ?? 'unknown type'}${count})`);
    }

    const first = folders[0];
    if (!first || first.id === undefined) {
    console.log('No folders found');
    } else {
    const sharedWith = await client.folders.getSharedWith(first.id);
    console.log(
    sharedWith.length > 0 ? `Shared with: ${sharedWith.map((s) => s.name ?? s.athlete_id).join(', ')}` : 'Not shared with anyone',
    );
    }
    • FolderService.updatePlanWorkouts takes a single { hide_from_athlete } body, not a list of workouts, and requires the oldest/newest query pair; the spec declares both as int32 plan day numbers, not dates. Per the spec, only hide_from_athlete is applied.
    • FolderService.applyPlanChanges updates only workouts dated today or in the future; earlier calendar entries are left as they are.
    • See API behaviour for the cross-service list.