Completed
Push — master ( 6a30a3...8c0277 )
by Bas van
02:47
created

Client::getAthleteZones()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
cc 2
eloc 5
nc 2
nop 0
crap 2
1
<?php
2
namespace Strava\API;
3
4
use Strava\API\Service\ServiceInterface;
5
use Strava\API\Exception as ClientException;
6
use Strava\API\Service\Exception as ServiceException;
7
8
/**
9
 * Strava API Client
10
 *
11
 * @author Bas van Dorst
12
 * @package StravaPHP
13
 */
14
class Client
15
{
16
    /**
17
     * @var ServiceInterface $service
18
     */
19
    protected $service;
20
21
    /**
22
     * Initiate this class with a subclass of ServiceInterface. There are two
23
     * service subclasses available:
24
     * - Service\REST: Service which makes calls to the live Strava API
25
     * - Service\Stub: Service stub for test purposes (unit tests)
26
     *
27
     * @param ServiceInterface $service
28
     */
29 74
    public function __construct(ServiceInterface $service)
30
    {
31 74
        $this->service = $service;
32 74
    }
33
34
    /**
35
     * Retrieve current athlete
36
     *
37
     * @link    https://strava.github.io/api/v3/athlete/#get-details,
38
     *          https://strava.github.io/api/v3/athlete/#get-another-details
39
     * @param   int $id
40
     * @return  array
41
     * @throws  Exception
42
     */
43 2
    public function getAthlete($id = null)
44
    {
45
        try {
46 2
            return $this->service->getAthlete($id);
47 1
        } catch (ServiceException $e) {
48 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
49
        }
50
    }
51
52
    /**
53
     * Retrieve athlete stats
54
     *
55
     * Only available for the authenticated athlete.
56
     *
57
     * @link    https://strava.github.io/api/v3/athlete/#stats
58
     * @param   int $id
59
     * @return  array
60
     * @throws  ClientException
61
     */
62 1
    public function getAthleteStats($id)
63
    {
64
        try {
65 1
            return $this->service->getAthleteStats($id);
66
        } catch (ServiceException $e) {
67
            throw new ClientException('[SERVICE] ' . $e->getMessage());
68
        }
69
    }
70
71
    /**
72
     * List athlete clubs
73
     *
74
     * @link    https://strava.github.io/api/v3/clubs/#get-athletes
75
     * @return  array
76
     * @throws  Exception
77
     */
78 2
    public function getAthleteClubs()
79
    {
80
        try {
81 2
            return $this->service->getAthleteClubs();
82 1
        } catch (ServiceException $e) {
83 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
84
        }
85
    }
86
87
    /**
88
     * List athlete activities
89
     *
90
     * @link    https://strava.github.io/api/v3/activities/#get-activities
91
     * @param   string $before
92
     * @param   string $after
93
     * @param   int $page
94
     * @param   int $per_page
95
     * @return  array
96
     * @throws  Exception
97
     */
98 2
    public function getAthleteActivities($before = null, $after = null, $page = null, $per_page = null)
99
    {
100
        try {
101 2
            return $this->service->getAthleteActivities($before, $after, $page, $per_page);
102 1
        } catch (ServiceException $e) {
103 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
104
        }
105
    }
106
107
    /**
108
     * List athlete friends
109
     *
110
     * @link    https://strava.github.io/api/v3/follow/#friends
111
     * @param   int $id
112
     * @param   int $page
113
     * @param   int $per_page
114
     * @return  array
115
     * @throws  Exception
116
     */
117 2
    public function getAthleteFriends($id = null, $page = null, $per_page = null)
118
    {
119
        try {
120 2
            return $this->service->getAthleteFriends($id, $page, $per_page);
121 1
        } catch (ServiceException $e) {
122 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
123
        }
124
    }
125
126
    /**
127
     * List athlete followers
128
     *
129
     * @link    https://strava.github.io/api/v3/follow/#followers
130
     * @param   int $id
131
     * @param   int $page
132
     * @param   int $per_page
133
     * @return  array
134
     * @throws  Exception
135
     */
136 2
    public function getAthleteFollowers($id = null, $page = null, $per_page = null)
137
    {
138
        try {
139 2
            return $this->service->getAthleteFollowers($id, $page, $per_page);
140 1
        } catch (ServiceException $e) {
141 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
142
        }
143
    }
144
145
    /**
146
     * List both following
147
     *
148
     * @link    https://strava.github.io/api/v3/follow/#both
149
     * @param   int $id
150
     * @param   int $page
151
     * @param   int $per_page
152
     * @return  array
153
     * @throws  Exception
154
     */
155 2
    public function getAthleteBothFollowing($id, $page = null, $per_page = null)
156
    {
157
        try {
158 2
            return $this->service->getAthleteBothFollowing($id, $page, $per_page);
159 1
        } catch (ServiceException $e) {
160 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
161
        }
162
    }
163
164
    /**
165
     * List athlete K/QOMs/CRs
166
     *
167
     * @link    https://strava.github.io/api/v3/athlete/#koms
168
     * @param   int $id
169
     * @param   int $page
170
     * @param   int $per_page
171
     * @return  array
172
     * @throws  Exception
173
     */
174 2
    public function getAthleteKom($id, $page = null, $per_page = null)
175
    {
176
        try {
177 2
            return $this->service->getAthleteKom($id, $page, $per_page);
178 1
        } catch (ServiceException $e) {
179 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
180
        }
181
    }
182
183
    /**
184
     * List athlete zones
185
     *
186
     * @link    https://strava.github.io/api/v3/athlete/#zones
187
     * @return  array
188
     * @throws  Exception
189
     */
190 2
    public function getAthleteZones()
191
    {
192
        try {
193 2
            return $this->service->getAthleteZones();
194 1
        } catch (ServiceException $e) {
195 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
196
        }
197
    }
198
199
200
201
    /**
202
     * List starred segment
203
     *
204
     * @link    https://strava.github.io/api/v3/segments/#starred
205
     * @param   int $id
206
     * @param   int $page
207
     * @param   int $per_page
208
     * @return  array
209
     * @throws  Exception
210
     */
211 2
    public function getAthleteStarredSegments($id = null, $page = null, $per_page = null)
212
    {
213
        try {
214 2
            return $this->service->getAthleteStarredSegments($id, $page, $per_page);
215 1
        } catch (ServiceException $e) {
216 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
217
        }
218
    }
219
220
    /**
221
     * Update current athlete
222
     *
223
     * @link    https://strava.github.io/api/v3/athlete/#update
224
     * @param   string $city
225
     * @param   string $state
226
     * @param   string $country
227
     * @param   string $sex
228
     * @param   float $weight
229
     * @return  array
230
     * @throws  Exception
231
     */
232 2
    public function updateAthlete($city, $state, $country, $sex, $weight)
233
    {
234
        try {
235 2
            return $this->service->updateAthlete($city, $state, $country, $sex, $weight);
236 1
        } catch (ServiceException $e) {
237 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
238
        }
239
    }
240
241
    /**
242
     * Retrieve activity from user followers
243
     *
244
     * @link https://strava.github.io/api/v3/activities/#get-feed
245
     *
246
     * @param type $before
247
     * @param type $page
248
     * @param type $per_page
249
     * @return type
250
     * @throws ClientException
251
     */
252
    public function getActivityFollowing($before = null, $page = null, $per_page = null)
253
    {
254
        try {
255
            return $this->service->getActivityFollowing($before, $page, $per_page);
256
        } catch (ServiceException $e) {
257
            throw new ClientException('[SERVICE] ' . $e->getMessage());
258
        }
259
    }
260
261
262
    /**
263
     * Retrieve an activity
264
     *
265
     * @link    https://strava.github.io/api/v3/athlete/#get-details,
266
     *          https://strava.github.io/api/v3/athlete/#get-another-details
267
     * @param   int $id
268
     * @param   boolean $include_all_efforts
269
     * @return  array
270
     * @throws  Exception
271
     */
272 2
    public function getActivity($id, $include_all_efforts = null)
273
    {
274
        try {
275 2
            return $this->service->getActivity($id, $include_all_efforts);
276 1
        } catch (ServiceException $e) {
277 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
278
        }
279
    }
280
281
    /**
282
     * List activity comments
283
     *
284
     * @link    https://strava.github.io/api/v3/comments/#list
285
     * @param   int $id
286
     * @param   boolean $markdown
287
     * @param   int $page
288
     * @param   int $per_page
289
     * @return  array
290
     * @throws  Exception
291
     */
292 2
    public function getActivityComments($id, $markdown = null, $page = null, $per_page = null)
293
    {
294
        try {
295 2
            return $this->service->getActivityComments($id, $markdown, $page, $per_page);
296 1
        } catch (ServiceException $e) {
297 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
298
        }
299
    }
300
301
    /**
302
     * List activity kudoers
303
     *
304
     * @link    https://strava.github.io/api/v3/kudos/#list
305
     * @param   int $id
306
     * @param   int $page
307
     * @param   int $per_page
308
     * @return  array
309
     * @throws  Exception
310
     */
311 2
    public function getActivityKudos($id, $page = null, $per_page = null)
312
    {
313
        try {
314 2
            return $this->service->getActivityKudos($id, $page, $per_page);
315 1
        } catch (ServiceException $e) {
316 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
317
        }
318
    }
319
320
    /**
321
     * List activity photos
322
     *
323
     * @link    https://strava.github.io/api/v3/photos/#list
324
     * @param   int $id
325
     * @param   int $size In pixels.
326
     * @param   string $photo_sources Must be "true".
327
     * @return  array
328
     * @throws  Exception
329
     */
330 2
    public function getActivityPhotos($id, $size = 2048, $photo_sources = 'true')
331
    {
332
        try {
333 2
            return $this->service->getActivityPhotos($id, $size, $photo_sources);
334 1
        } catch (ServiceException $e) {
335 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
336
        }
337
    }
338
339
    /**
340
     * List activity zones
341
     *
342
     * @link    https://strava.github.io/api/v3/activities/#zones
343
     * @param   int $id
344
     * @return  array
345
     * @throws  Exception
346
     */
347 2
    public function getActivityZones($id)
348
    {
349
        try {
350 2
            return $this->service->getActivityZones($id);
351 1
        } catch (ServiceException $e) {
352 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
353
        }
354
    }
355
356
    /**
357
     * List activity laps
358
     *
359
     * @link    https://strava.github.io/api/v3/activities/#laps
360
     * @param   int $id
361
     * @return  array
362
     * @throws  Exception
363
     */
364 2
    public function getActivityLaps($id)
365
    {
366
        try {
367 2
            return $this->service->getActivityLaps($id);
368 1
        } catch (ServiceException $e) {
369 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
370
        }
371
    }
372
373
    /**
374
     * Check upload status
375
     *
376
     * @link    https://strava.github.io/api/v3/uploads/#get-status
377
     * @param   int $id
378
     * @return  array
379
     * @throws  Exception
380
     */
381 2
    public function getActivityUploadStatus($id)
382
    {
383
        try {
384 2
            return $this->service->getActivityUploadStatus($id);
385 1
        } catch (ServiceException $e) {
386 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
387
        }
388
    }
389
390
    /**
391
     * Create an activity
392
     *
393
     * @link    https://strava.github.io/api/v3/activities/#create
394
     * @param   string $name
395
     * @param   string $type
396
     * @param   string $start_date_local
397
     * @param   int $elapsed_time
398
     * @param   string $description
399
     * @param   float $distance
400
     * @param   int $private
401
     * @param   int $trainer
402
     * @return  array
403
     * @throws  Exception
404
     */
405 2
    public function createActivity($name, $type, $start_date_local, $elapsed_time, $description = null, $distance = null, $private = null, $trainer = null)
406
    {
407
        try {
408 2
            return $this->service->createActivity($name, $type, $start_date_local, $elapsed_time, $description, $distance, $private, $trainer);
0 ignored issues
show
Unused Code introduced by
The call to ServiceInterface::createActivity() has too many arguments starting with $private.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
409 1
        } catch (ServiceException $e) {
410 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
411
        }
412
    }
413
414
    /**
415
     * Upload an activity
416
     *
417
     * @link    https://strava.github.io/api/v3/uploads/#post-file
418
     * @param   mixed $file
419
     * @param   string $activity_type
420
     * @param   string $name
421
     * @param   string $description
422
     * @param   int $private
423
     * @param   int $trainer
424
     * @param   int $commute
425
     * @param   string $data_type
426
     * @param   string $external_id
427
     * @return  array
428
     * @throws  Exception
429
     */
430 2
    public function uploadActivity($file, $activity_type = null, $name = null, $description = null, $private = null, $trainer = null, $commute = null, $data_type = null, $external_id = null)
431
    {
432
        try {
433 2
            return $this->service->uploadActivity($file, $activity_type, $name, $description, $private, $trainer, $commute, $data_type, $external_id);
0 ignored issues
show
Unused Code introduced by
The call to ServiceInterface::uploadActivity() has too many arguments starting with $external_id.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
434 1
        } catch (ServiceException $e) {
435 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
436
        }
437
    }
438
439
    /**
440
     * Update an activity
441
     *
442
     * @link    https://strava.github.io/api/v3/activities/#put-updates
443
     * @param   int $id
444
     * @param   string $name
445
     * @param   string $type
446
     * @param   boolean $private
447
     * @param   boolean $commute
448
     * @param   boolean $trainer
449
     * @param   string $gear_id
450
     * @param   string $description
451
     * @return  array
452
     * @throws  Exception
453
     */
454 2
    public function updateActivity($id, $name = null, $type = null, $private = false, $commute = false, $trainer = false, $gear_id = null, $description = null)
455
    {
456
        try {
457 2
            return $this->service->updateActivity($id, $name, $type, $private, $commute, $trainer, $gear_id, $description);
458 1
        } catch (ServiceException $e) {
459 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
460
        }
461
    }
462
463
    /**
464
     * Delete an activity
465
     *
466
     * @link    https://strava.github.io/api/v3/activities/#delete
467
     * @param   int $id
468
     * @return  array
469
     * @throws  Exception
470
     */
471 2
    public function deleteActivity($id)
472
    {
473
        try {
474 2
            return $this->service->deleteActivity($id);
475 1
        } catch (ServiceException $e) {
476 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
477
        }
478
    }
479
480
    /**
481
     * Retrieve gear
482
     *
483
     * @link    https://strava.github.io/api/v3/gear/
484
     * @param   int $id
485
     * @return  array
486
     * @throws  Exception
487
     */
488 2
    public function getGear($id)
489
    {
490
        try {
491 2
            return $this->service->getGear($id);
492 1
        } catch (ServiceException $e) {
493 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
494
        }
495
    }
496
497
    /**
498
     * Retrieve a club
499
     *
500
     * @link    https://strava.github.io/api/v3/clubs/#get-details
501
     * @param   int $id
502
     * @return  array
503
     * @throws  Exception
504
     */
505 2
    public function getClub($id)
506
    {
507
        try {
508 2
            return $this->service->getClub($id);
509 1
        } catch (ServiceException $e) {
510 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
511
        }
512
    }
513
514
    /**
515
     * List club members
516
     *
517
     * @link    https://strava.github.io/api/v3/clubs/#get-members
518
     * @param   int $id
519
     * @param   int $page
520
     * @param   int $per_page
521
     * @return  array
522
     * @throws  Exception
523
     */
524 2
    public function getClubMembers($id, $page = null, $per_page = null)
525
    {
526
        try {
527 2
            return $this->service->getClubMembers($id, $page, $per_page);
528 1
        } catch (ServiceException $e) {
529 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
530
        }
531
    }
532
533
    /**
534
     * List club activities
535
     *
536
     * @link    https://strava.github.io/api/v3/clubs/#get-activities
537
     * @param   int $id
538
     * @param   int $page
539
     * @param   int $per_page
540
     * @return  array
541
     * @throws  Exception
542
     */
543 2
    public function getClubActivities($id, $page = null, $per_page = null)
544
    {
545
        try {
546 2
            return $this->service->getClubActivities($id, $page, $per_page);
547 1
        } catch (ServiceException $e) {
548 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
549
        }
550
    }
551
552
    /**
553
     * List club announcements
554
     *
555
     * @link    https://strava.github.io/api/v3/clubs/#get-announcements
556
     * @param   int $id
557
     * @return  array
558
     * @throws  Exception
559
     */
560 2
    public function getClubAnnouncements($id)
561
    {
562
        try {
563 2
            return $this->service->getClubAnnouncements($id);
564 1
        } catch (ServiceException $e) {
565 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
566
        }
567
    }
568
569
    /**
570
     * List club group events
571
     *
572
     * @link    https://strava.github.io/api/v3/clubs/#get-group-events
573
     * @param   int $id
574
     * @return  array
575
     * @throws  Exception
576
     */
577 2
    public function getClubGroupEvents($id)
578
    {
579
        try {
580 2
            return $this->service->getClubGroupEvents($id);
581 1
        } catch (ServiceException $e) {
582 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
583
        }
584
    }
585
586
    /**
587
     * Join a club
588
     *
589
     * @link    https://strava.github.io/api/v3/clubs/#join
590
     * @param   int $id
591
     * @return  array
592
     * @throws  Exception
593
     */
594 2
    public function joinClub($id)
595
    {
596
        try {
597 2
            return $this->service->joinClub($id);
598 1
        } catch (ServiceException $e) {
599 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
600
        }
601
    }
602
603
    /**
604
     * Leave a club
605
     *
606
     * @link    https://strava.github.io/api/v3/clubs/#leave
607
     * @param   int $id
608
     * @return  array
609
     * @throws  Exception
610
     */
611 2
    public function leaveClub($id)
612
    {
613
        try {
614 2
            return $this->service->leaveClub($id);
615 1
        } catch (ServiceException $e) {
616 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
617
        }
618
    }
619
620
    /**
621
     * Retrieve a segment
622
     *
623
     * @link    https://strava.github.io/api/v3/segments/#retrieve
624
     * @param   int $id
625
     * @return  array
626
     * @throws  Exception
627
     */
628 2
    public function getSegment($id)
629
    {
630
        try {
631 2
            return $this->service->getSegment($id);
632 1
        } catch (ServiceException $e) {
633 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
634
        }
635
    }
636
637
    /**
638
     * Segment leaderboards
639
     *
640
     * @link    https://strava.github.io/api/v3/segments/#leaderboard
641
     * @param   int $id
642
     * @param   string $gender
643
     * @param   string $age_group
644
     * @param   string $weight_class
645
     * @param   boolean $following
646
     * @param   int $club_id
647
     * @param   string $date_range
648
     * @param   int $context_entries
649
     * @param   int $page
650
     * @param   int $per_page
651
     * @return  array
652
     * @throws  Exception
653
     */
654 2
    public function getSegmentLeaderboard($id, $gender = null, $age_group = null, $weight_class = null, $following = null, $club_id = null, $date_range = null, $context_entries = null, $page = null, $per_page = null)
655
    {
656
        try {
657 2
            return $this->service->getSegmentLeaderboard($id, $gender, $age_group, $weight_class, $following, $club_id, $date_range, $context_entries, $page, $per_page);
658 1
        } catch (ServiceException $e) {
659 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
660
        }
661
    }
662
663
    /**
664
     * Segment explorer
665
     *
666
     * @link    https://strava.github.io/api/v3/segments/#explore
667
     * @param   string $bounds
668
     * @param   string $activity_type
669
     * @param   int $min_cat
670
     * @param   int $max_cat
671
     * @return  array
672
     * @throws  Exception
673
     */
674 2
    public function getSegmentExplorer($bounds, $activity_type = 'riding', $min_cat = null, $max_cat = null)
675
    {
676
        try {
677 2
            return $this->service->getSegmentExplorer($bounds, $activity_type, $min_cat, $max_cat);
678 1
        } catch (ServiceException $e) {
679 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
680
        }
681
    }
682
683
    /**
684
     * List efforts filtered by athlete and/or a date range
685
     *
686
     * @link    https://strava.github.io/api/v3/segments/#efforts
687
     * @param   int $id
688
     * @param   int $athlete_id
689
     * @param   string $start_date_local
690
     * @param   string $end_date_local
691
     * @param   int $page
692
     * @param   int $per_page
693
     * @return  array
694
     * @throws  Exception
695
     */
696 2
    public function getSegmentEffort($id, $athlete_id = null, $start_date_local = null, $end_date_local = null, $page = null, $per_page = null)
697
    {
698
        try {
699 2
            return $this->service->getSegmentEffort($id, $athlete_id, $start_date_local, $end_date_local, $page, $per_page);
700 1
        } catch (ServiceException $e) {
701 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
702
        }
703
    }
704
705
    /**
706
     * Retrieve activity streams
707
     *
708
     * @link    https://strava.github.io/api/v3/streams/#activity
709
     * @param   int $id
710
     * @param   string $types
711
     * @param   string $resolution
712
     * @param   string $series_type
713
     * @return  array
714
     * @throws  Exception
715
     */
716 2
    public function getStreamsActivity($id, $types, $resolution = null, $series_type = 'distance')
717
    {
718
        try {
719 2
            return $this->service->getStreamsActivity($id, $types, $resolution, $series_type);
720 1
        } catch (ServiceException $e) {
721 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
722
        }
723
    }
724
725
    /**
726
     * Retrieve effort streams
727
     *
728
     * @link    https://strava.github.io/api/v3/streams/#effort
729
     * @param   int $id
730
     * @param   string $types
731
     * @param   string $resolution
732
     * @param   string $series_type
733
     * @return  array
734
     * @throws  Exception
735
     */
736 2
    public function getStreamsEffort($id, $types, $resolution = null, $series_type = 'distance')
737
    {
738
        try {
739 2
            return $this->service->getStreamsEffort($id, $types, $resolution, $series_type);
740 1
        } catch (ServiceException $e) {
741 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
742
        }
743
    }
744
745
    /**
746
     * Retrieve segment streams
747
     * @link    https://strava.github.io/api/v3/streams/#segment
748
     * @param   int $id
749
     * @param   string $types
750
     * @param   string $resolution
751
     * @param   string $series_type
752
     * @return  array
753
     * @throws  Exception
754
     */
755 2
    public function getStreamsSegment($id, $types, $resolution = null, $series_type = 'distance')
756
    {
757
        try {
758 2
            return $this->service->getStreamsSegment($id, $types, $resolution, $series_type);
759 1
        } catch (ServiceException $e) {
760 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
761
        }
762
    }
763
}
764