1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "calculations": [
12 {
13 "type": "pace",
14 "label": "Marathon goal pace",
15 "distance": "marathon",
16 "time": "3:45:00",
17 "splitEvery": 5,
18 "unit": "km"
19 },
20 {
21 "type": "time",
22 "label": "10K at 4:30 per km",
23 "distance": 10,
24 "unit": "km",
25 "pace": "4:30",
26 "paceUnit": "min/km",
27 "splits": false
28 },
29 {
30 "type": "splits",
31 "label": "Half marathon negative split",
32 "distance": "half marathon",
33 "time": "1:45:00",
34 "splitEvery": 5,
35 "strategy": "negative",
36 "strategyPercent": 2
37 },
38 {
39 "type": "predict",
40 "label": "Race times from a 22:30 5K",
41 "distance": "5k",
42 "time": "22:30"
43 },
44 {
45 "type": "training",
46 "label": "Training paces from a 22:30 5K",
47 "distance": "5k",
48 "time": "22:30"
49 },
50 {
51 "type": "convert",
52 "label": "8:00 per mile in other units",
53 "pace": "8:00",
54 "paceUnit": "min/mi"
55 }
56 ]
57};
58
59
60const run = await client.actor("mangudai/running-pace-calculator").call(input);
61
62
63console.log('Results from dataset');
64console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
65const { items } = await client.dataset(run.defaultDatasetId).listItems();
66items.forEach((item) => {
67 console.dir(item);
68});
69
70