Completed
Push — master ( fec96a...082b8a )
by Bas van
02:24
created

Client::leaveClub()   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 1
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 79
    public function __construct(ServiceInterface $service)
30
    {
31 79
        $this->service = $service;
32 79
    }
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
     * Retrieve athlete routes
73
     *
74
     * @link    https://strava.github.io/api/v3/routes/#list
75
     * @param   int $id
76
     * @return  array
77
     * @throws  ClientException
78
     */
79 1
    public function getAthleteRoutes($id, $type = null, $after = null, $page = null, $per_page = null)
80
    {
81
        try {
82 1
            return $this->service->getAthleteRoutes($id, $type, $after, $page, $per_page);
83
        } catch (ServiceException $e) {
84
            throw new ClientException('[SERVICE] ' . $e->getMessage());
85
        }
86
    }
87
88
    /**
89
     * List athlete clubs
90
     *
91
     * @link    https://strava.github.io/api/v3/clubs/#get-athletes
92
     * @return  array
93
     * @throws  Exception
94
     */
95 2
    public function getAthleteClubs()
96
    {
97
        try {
98 2
            return $this->service->getAthleteClubs();
99 1
        } catch (ServiceException $e) {
100 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
101
        }
102
    }
103
104
    /**
105
     * List athlete activities
106
     *
107
     * @link    https://strava.github.io/api/v3/activities/#get-activities
108
     * @param   string $before
109
     * @param   string $after
110
     * @param   int $page
111
     * @param   int $per_page
112
     * @return  array
113
     * @throws  Exception
114
     */
115 2
    public function getAthleteActivities($before = null, $after = null, $page = null, $per_page = null)
116
    {
117
        try {
118 2
            return $this->service->getAthleteActivities($before, $after, $page, $per_page);
119 1
        } catch (ServiceException $e) {
120 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
121
        }
122
    }
123
124
    /**
125
     * List athlete friends
126
     *
127
     * @link    https://strava.github.io/api/v3/follow/#friends
128
     * @param   int $id
129
     * @param   int $page
130
     * @param   int $per_page
131
     * @return  array
132
     * @throws  Exception
133
     */
134 2
    public function getAthleteFriends($id = null, $page = null, $per_page = null)
135
    {
136
        try {
137 2
            return $this->service->getAthleteFriends($id, $page, $per_page);
138 1
        } catch (ServiceException $e) {
139 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
140
        }
141
    }
142
143
    /**
144
     * List athlete followers
145
     *
146
     * @link    https://strava.github.io/api/v3/follow/#followers
147
     * @param   int $id
148
     * @param   int $page
149
     * @param   int $per_page
150
     * @return  array
151
     * @throws  Exception
152
     */
153 2
    public function getAthleteFollowers($id = null, $page = null, $per_page = null)
154
    {
155
        try {
156 2
            return $this->service->getAthleteFollowers($id, $page, $per_page);
157 1
        } catch (ServiceException $e) {
158 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
159
        }
160
    }
161
162
    /**
163
     * List both following
164
     *
165
     * @link    https://strava.github.io/api/v3/follow/#both
166
     * @param   int $id
167
     * @param   int $page
168
     * @param   int $per_page
169
     * @return  array
170
     * @throws  Exception
171
     */
172 2
    public function getAthleteBothFollowing($id, $page = null, $per_page = null)
173
    {
174
        try {
175 2
            return $this->service->getAthleteBothFollowing($id, $page, $per_page);
176 1
        } catch (ServiceException $e) {
177 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
178
        }
179
    }
180
181
    /**
182
     * List athlete K/QOMs/CRs
183
     *
184
     * @link    https://strava.github.io/api/v3/athlete/#koms
185
     * @param   int $id
186
     * @param   int $page
187
     * @param   int $per_page
188
     * @return  array
189
     * @throws  Exception
190
     */
191 2
    public function getAthleteKom($id, $page = null, $per_page = null)
192
    {
193
        try {
194 2
            return $this->service->getAthleteKom($id, $page, $per_page);
195 1
        } catch (ServiceException $e) {
196 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
197
        }
198
    }
199
200
    /**
201
     * List athlete zones
202
     *
203
     * @link    https://strava.github.io/api/v3/athlete/#zones
204
     * @return  array
205
     * @throws  Exception
206
     */
207 2
    public function getAthleteZones()
208
    {
209
        try {
210 2
            return $this->service->getAthleteZones();
211 1
        } catch (ServiceException $e) {
212 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
213
        }
214
    }
215
216
217
218
    /**
219
     * List starred segment
220
     *
221
     * @link    https://strava.github.io/api/v3/segments/#starred
222
     * @param   int $id
223
     * @param   int $page
224
     * @param   int $per_page
225
     * @return  array
226
     * @throws  Exception
227
     */
228 2
    public function getAthleteStarredSegments($id = null, $page = null, $per_page = null)
229
    {
230
        try {
231 2
            return $this->service->getAthleteStarredSegments($id, $page, $per_page);
232 1
        } catch (ServiceException $e) {
233 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
234
        }
235
    }
236
237
    /**
238
     * Update current athlete
239
     *
240
     * @link    https://strava.github.io/api/v3/athlete/#update
241
     * @param   string $city
242
     * @param   string $state
243
     * @param   string $country
244
     * @param   string $sex
245
     * @param   float $weight
246
     * @return  array
247
     * @throws  Exception
248
     */
249 2
    public function updateAthlete($city, $state, $country, $sex, $weight)
250
    {
251
        try {
252 2
            return $this->service->updateAthlete($city, $state, $country, $sex, $weight);
253 1
        } catch (ServiceException $e) {
254 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
255
        }
256
    }
257
258
    /**
259
     * Retrieve activity from user followers
260
     *
261
     * @link https://strava.github.io/api/v3/activities/#get-feed
262
     *
263
     * @param type $before
264
     * @param type $page
265
     * @param type $per_page
266
     * @return type
267
     * @throws ClientException
268
     */
269
    public function getActivityFollowing($before = null, $page = null, $per_page = null)
270
    {
271
        try {
272
            return $this->service->getActivityFollowing($before, $page, $per_page);
273
        } catch (ServiceException $e) {
274
            throw new ClientException('[SERVICE] ' . $e->getMessage());
275
        }
276
    }
277
278
279
    /**
280
     * Retrieve an activity
281
     *
282
     * @link    https://strava.github.io/api/v3/athlete/#get-details,
283
     *          https://strava.github.io/api/v3/athlete/#get-another-details
284
     * @param   int $id
285
     * @param   boolean $include_all_efforts
286
     * @return  array
287
     * @throws  Exception
288
     */
289 2
    public function getActivity($id, $include_all_efforts = null)
290
    {
291
        try {
292 2
            return $this->service->getActivity($id, $include_all_efforts);
293 1
        } catch (ServiceException $e) {
294 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
295
        }
296
    }
297
298
    /**
299
     * List activity comments
300
     *
301
     * @link    https://strava.github.io/api/v3/comments/#list
302
     * @param   int $id
303
     * @param   boolean $markdown
304
     * @param   int $page
305
     * @param   int $per_page
306
     * @return  array
307
     * @throws  Exception
308
     */
309 2
    public function getActivityComments($id, $markdown = null, $page = null, $per_page = null)
310
    {
311
        try {
312 2
            return $this->service->getActivityComments($id, $markdown, $page, $per_page);
313 1
        } catch (ServiceException $e) {
314 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
315
        }
316
    }
317
318
    /**
319
     * List activity kudoers
320
     *
321
     * @link    https://strava.github.io/api/v3/kudos/#list
322
     * @param   int $id
323
     * @param   int $page
324
     * @param   int $per_page
325
     * @return  array
326
     * @throws  Exception
327
     */
328 2
    public function getActivityKudos($id, $page = null, $per_page = null)
329
    {
330
        try {
331 2
            return $this->service->getActivityKudos($id, $page, $per_page);
332 1
        } catch (ServiceException $e) {
333 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
334
        }
335
    }
336
337
    /**
338
     * List activity photos
339
     *
340
     * @link    https://strava.github.io/api/v3/photos/#list
341
     * @param   int $id
342
     * @param   int $size In pixels.
343
     * @param   string $photo_sources Must be "true".
344
     * @return  array
345
     * @throws  Exception
346
     */
347 2
    public function getActivityPhotos($id, $size = 2048, $photo_sources = 'true')
348
    {
349
        try {
350 2
            return $this->service->getActivityPhotos($id, $size, $photo_sources);
351 1
        } catch (ServiceException $e) {
352 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
353
        }
354
    }
355
356
    /**
357
     * List activity zones
358
     *
359
     * @link    https://strava.github.io/api/v3/activities/#zones
360
     * @param   int $id
361
     * @return  array
362
     * @throws  Exception
363
     */
364 2
    public function getActivityZones($id)
365
    {
366
        try {
367 2
            return $this->service->getActivityZones($id);
368 1
        } catch (ServiceException $e) {
369 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
370
        }
371
    }
372
373
    /**
374
     * List activity laps
375
     *
376
     * @link    https://strava.github.io/api/v3/activities/#laps
377
     * @param   int $id
378
     * @return  array
379
     * @throws  Exception
380
     */
381 2
    public function getActivityLaps($id)
382
    {
383
        try {
384 2
            return $this->service->getActivityLaps($id);
385 1
        } catch (ServiceException $e) {
386 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
387
        }
388
    }
389
390
    /**
391
     * Check upload status
392
     *
393
     * @link    https://strava.github.io/api/v3/uploads/#get-status
394
     * @param   int $id
395
     * @return  array
396
     * @throws  Exception
397
     */
398 2
    public function getActivityUploadStatus($id)
399
    {
400
        try {
401 2
            return $this->service->getActivityUploadStatus($id);
402 1
        } catch (ServiceException $e) {
403 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
404
        }
405
    }
406
407
    /**
408
     * Create an activity
409
     *
410
     * @link    https://strava.github.io/api/v3/activities/#create
411
     * @param   string $name
412
     * @param   string $type
413
     * @param   string $start_date_local
414
     * @param   int $elapsed_time
415
     * @param   string $description
416
     * @param   float $distance
417
     * @param   int $private
418
     * @param   int $trainer
419
     * @return  array
420
     * @throws  Exception
421
     */
422 2
    public function createActivity($name, $type, $start_date_local, $elapsed_time, $description = null, $distance = null, $private = null, $trainer = null)
423
    {
424
        try {
425 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...
426 1
        } catch (ServiceException $e) {
427 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
428
        }
429
    }
430
431
    /**
432
     * Upload an activity
433
     *
434
     * @link    https://strava.github.io/api/v3/uploads/#post-file
435
     * @param   mixed $file
436
     * @param   string $activity_type
437
     * @param   string $name
438
     * @param   string $description
439
     * @param   int $private
440
     * @param   int $trainer
441
     * @param   int $commute
442
     * @param   string $data_type
443
     * @param   string $external_id
444
     * @return  array
445
     * @throws  Exception
446
     */
447 2
    public function uploadActivity($file, $activity_type = null, $name = null, $description = null, $private = null, $trainer = null, $commute = null, $data_type = null, $external_id = null)
448
    {
449
        try {
450 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...
451 1
        } catch (ServiceException $e) {
452 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
453
        }
454
    }
455
456
    /**
457
     * Update an activity
458
     *
459
     * @link    https://strava.github.io/api/v3/activities/#put-updates
460
     * @param   int $id
461
     * @param   string $name
462
     * @param   string $type
463
     * @param   boolean $private
464
     * @param   boolean $commute
465
     * @param   boolean $trainer
466
     * @param   string $gear_id
467
     * @param   string $description
468
     * @return  array
469
     * @throws  Exception
470
     */
471 2
    public function updateActivity($id, $name = null, $type = null, $private = false, $commute = false, $trainer = false, $gear_id = null, $description = null)
472
    {
473
        try {
474 2
            return $this->service->updateActivity($id, $name, $type, $private, $commute, $trainer, $gear_id, $description);
475 1
        } catch (ServiceException $e) {
476 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
477
        }
478
    }
479
480
    /**
481
     * Delete an activity
482
     *
483
     * @link    https://strava.github.io/api/v3/activities/#delete
484
     * @param   int $id
485
     * @return  array
486
     * @throws  Exception
487
     */
488 2
    public function deleteActivity($id)
489
    {
490
        try {
491 2
            return $this->service->deleteActivity($id);
492 1
        } catch (ServiceException $e) {
493 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
494
        }
495
    }
496
497
    /**
498
     * Retrieve gear
499
     *
500
     * @link    https://strava.github.io/api/v3/gear/
501
     * @param   int $id
502
     * @return  array
503
     * @throws  Exception
504
     */
505 2
    public function getGear($id)
506
    {
507
        try {
508 2
            return $this->service->getGear($id);
509 1
        } catch (ServiceException $e) {
510 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
511
        }
512
    }
513
514
    /**
515
     * Retrieve a club
516
     *
517
     * @link    https://strava.github.io/api/v3/clubs/#get-details
518
     * @param   int $id
519
     * @return  array
520
     * @throws  Exception
521
     */
522 2
    public function getClub($id)
523
    {
524
        try {
525 2
            return $this->service->getClub($id);
526 1
        } catch (ServiceException $e) {
527 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
528
        }
529
    }
530
531
    /**
532
     * List club members
533
     *
534
     * @link    https://strava.github.io/api/v3/clubs/#get-members
535
     * @param   int $id
536
     * @param   int $page
537
     * @param   int $per_page
538
     * @return  array
539
     * @throws  Exception
540
     */
541 2
    public function getClubMembers($id, $page = null, $per_page = null)
542
    {
543
        try {
544 2
            return $this->service->getClubMembers($id, $page, $per_page);
545 1
        } catch (ServiceException $e) {
546 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
547
        }
548
    }
549
550
    /**
551
     * List club activities
552
     *
553
     * @link    https://strava.github.io/api/v3/clubs/#get-activities
554
     * @param   int $id
555
     * @param   int $page
556
     * @param   int $per_page
557
     * @return  array
558
     * @throws  Exception
559
     */
560 2
    public function getClubActivities($id, $page = null, $per_page = null)
561
    {
562
        try {
563 2
            return $this->service->getClubActivities($id, $page, $per_page);
564 1
        } catch (ServiceException $e) {
565 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
566
        }
567
    }
568
569
    /**
570
     * List club announcements
571
     *
572
     * @link    https://strava.github.io/api/v3/clubs/#get-announcements
573
     * @param   int $id
574
     * @return  array
575
     * @throws  Exception
576
     */
577 2
    public function getClubAnnouncements($id)
578
    {
579
        try {
580 2
            return $this->service->getClubAnnouncements($id);
581 1
        } catch (ServiceException $e) {
582 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
583
        }
584
    }
585
586
    /**
587
     * List club group events
588
     *
589
     * @link    https://strava.github.io/api/v3/clubs/#get-group-events
590
     * @param   int $id
591
     * @return  array
592
     * @throws  Exception
593
     */
594 2
    public function getClubGroupEvents($id)
595
    {
596
        try {
597 2
            return $this->service->getClubGroupEvents($id);
598 1
        } catch (ServiceException $e) {
599 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
600
        }
601
    }
602
603
    /**
604
     * Join a club
605
     *
606
     * @link    https://strava.github.io/api/v3/clubs/#join
607
     * @param   int $id
608
     * @return  array
609
     * @throws  Exception
610
     */
611 2
    public function joinClub($id)
612
    {
613
        try {
614 2
            return $this->service->joinClub($id);
615 1
        } catch (ServiceException $e) {
616 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
617
        }
618
    }
619
620
    /**
621
     * Leave a club
622
     *
623
     * @link    https://strava.github.io/api/v3/clubs/#leave
624
     * @param   int $id
625
     * @return  array
626
     * @throws  Exception
627
     */
628 2
    public function leaveClub($id)
629
    {
630
        try {
631 2
            return $this->service->leaveClub($id);
632 1
        } catch (ServiceException $e) {
633 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
634
        }
635
    }
636
637
    /**
638
     * Get route details
639
     *
640
     * @link    https://strava.github.io/api/v3/routes/#list
641
     * @param   int $id
642
     * @return  array
643
     * @throws  Exception
644
     */
645 2
    public function getRoute($id)
646
    {
647
        try {
648 2
            return $this->service->getRoute($id);
649 1
        } catch (ServiceException $e) {
650 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
651
        }
652
    }
653
654
    /**
655
     * Retrieve a segment
656
     *
657
     * @link    https://strava.github.io/api/v3/segments/#retrieve
658
     * @param   int $id
659
     * @return  array
660
     * @throws  Exception
661
     */
662 2
    public function getSegment($id)
663
    {
664
        try {
665 2
            return $this->service->getSegment($id);
666 1
        } catch (ServiceException $e) {
667 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
668
        }
669
    }
670
671
    /**
672
     * Segment leaderboards
673
     *
674
     * @link    https://strava.github.io/api/v3/segments/#leaderboard
675
     * @param   int $id
676
     * @param   string $gender
677
     * @param   string $age_group
678
     * @param   string $weight_class
679
     * @param   boolean $following
680
     * @param   int $club_id
681
     * @param   string $date_range
682
     * @param   int $context_entries
683
     * @param   int $page
684
     * @param   int $per_page
685
     * @return  array
686
     * @throws  Exception
687
     */
688 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)
689
    {
690
        try {
691 2
            return $this->service->getSegmentLeaderboard($id, $gender, $age_group, $weight_class, $following, $club_id, $date_range, $context_entries, $page, $per_page);
692 1
        } catch (ServiceException $e) {
693 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
694
        }
695
    }
696
697
    /**
698
     * Segment explorer
699
     *
700
     * @link    https://strava.github.io/api/v3/segments/#explore
701
     * @param   string $bounds
702
     * @param   string $activity_type
703
     * @param   int $min_cat
704
     * @param   int $max_cat
705
     * @return  array
706
     * @throws  Exception
707
     */
708 2
    public function getSegmentExplorer($bounds, $activity_type = 'riding', $min_cat = null, $max_cat = null)
709
    {
710
        try {
711 2
            return $this->service->getSegmentExplorer($bounds, $activity_type, $min_cat, $max_cat);
712 1
        } catch (ServiceException $e) {
713 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
714
        }
715
    }
716
717
    /**
718
     * List efforts filtered by athlete and/or a date range
719
     *
720
     * @link    https://strava.github.io/api/v3/segments/#efforts
721
     * @param   int $id
722
     * @param   int $athlete_id
723
     * @param   string $start_date_local
724
     * @param   string $end_date_local
725
     * @param   int $page
726
     * @param   int $per_page
727
     * @return  array
728
     * @throws  Exception
729
     */
730 2
    public function getSegmentEffort($id, $athlete_id = null, $start_date_local = null, $end_date_local = null, $page = null, $per_page = null)
731
    {
732
        try {
733 2
            return $this->service->getSegmentEffort($id, $athlete_id, $start_date_local, $end_date_local, $page, $per_page);
734 1
        } catch (ServiceException $e) {
735 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
736
        }
737
    }
738
739
    /**
740
     * Retrieve activity streams
741
     *
742
     * @link    https://strava.github.io/api/v3/streams/#activity
743
     * @param   int $id
744
     * @param   string $types
745
     * @param   string $resolution
746
     * @param   string $series_type
747
     * @return  array
748
     * @throws  Exception
749
     */
750 2
    public function getStreamsActivity($id, $types, $resolution = null, $series_type = 'distance')
751
    {
752
        try {
753 2
            return $this->service->getStreamsActivity($id, $types, $resolution, $series_type);
754 1
        } catch (ServiceException $e) {
755 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
756
        }
757
    }
758
759
    /**
760
     * Retrieve effort streams
761
     *
762
     * @link    https://strava.github.io/api/v3/streams/#effort
763
     * @param   int $id
764
     * @param   string $types
765
     * @param   string $resolution
766
     * @param   string $series_type
767
     * @return  array
768
     * @throws  Exception
769
     */
770 2
    public function getStreamsEffort($id, $types, $resolution = null, $series_type = 'distance')
771
    {
772
        try {
773 2
            return $this->service->getStreamsEffort($id, $types, $resolution, $series_type);
774 1
        } catch (ServiceException $e) {
775 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
776
        }
777
    }
778
779
    /**
780
     * Retrieve segment streams
781
     * @link    https://strava.github.io/api/v3/streams/#segment
782
     * @param   int $id
783
     * @param   string $types
784
     * @param   string $resolution
785
     * @param   string $series_type
786
     * @return  array
787
     * @throws  Exception
788
     */
789 2
    public function getStreamsSegment($id, $types, $resolution = null, $series_type = 'distance')
790
    {
791
        try {
792 2
            return $this->service->getStreamsSegment($id, $types, $resolution, $series_type);
793 1
        } catch (ServiceException $e) {
794 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
795
        }
796
    }
797
798
    /**
799
     * Retrieve route streams
800
     *
801
     * @link    https://strava.github.io/api/v3/streams/#routes
802
     * @param   int $id
803
     * @return  array
804
     * @throws  Exception
805
     */
806 2
    public function getStreamsRoute($id)
807
    {
808
        try {
809 2
            return $this->service->getStreamsRoute($id);
810 1
        } catch (ServiceException $e) {
811 1
            throw new ClientException('[SERVICE] ' . $e->getMessage());
812
        }
813
    }
814
}
815