client.customItems manages custom dashboard items such as charts, fields and histograms, including their sort order and images. All routes are athlete-scoped.
| Method | What it does |
|---|---|
| CustomItemService.list | List all custom items for an athlete |
| CustomItemService.get | Get a specific custom item |
| CustomItemService.create | Create a new custom item |
| CustomItemService.update | Update a custom item |
| CustomItemService.delete | Delete a custom item |
| CustomItemService.reorder | Reorder custom items (update sort indexes) |
| CustomItemService.uploadImage | Upload an image for a custom item |
List the athlete's custom items, then reorder them into their current order — a no-op that exercises the route.
CI never runs this example; running it by hand writes to the authenticated account (harmlessly, since the order does not change).
// maxRetries: 0 — a create that committed before a 5xx would be repeated by a retry, and only the last response's id would be cleaned up.
const client = new IntervalsClient({ apiKey, maxRetries: 0 });
const items = await client.customItems.list();
console.log(`${items.length} custom items`);
for (const item of items) {
console.log(`- ${item.id} ${item.type ?? 'unknown type'} ${item.name ?? ''}`);
}
// flatMap drops (and narrows away) any item the API returned without an id.
const order = items.flatMap((item, index) => (typeof item.id === 'number' ? [{ id: item.id, index }] : []));
if (order.length !== items.length || order.length === 0) {
console.log('No custom items (or one is missing an id); skipping reorder');
} else {
await client.customItems.reorder(order);
console.log(`Reordered ${order.length} custom items (no-op: same order)`);
}