1use crate::endpoints::{
2 ActivitiesEndpoint, AthleteEndpoint, AthletesEndpoint, ClubsEndpoint, GearEndpoint,
3 RoutesEndpoint, SegmentsEndpoint,
4};
5
6#[derive(Clone)]
7pub struct StravaAPI {
8 url: String,
9 token: String,
10}
11
12impl StravaAPI {
13 pub fn new(url: &str, token: impl Into<String>) -> Self {
14 Self {
15 url: url.into(),
16 token: token.into(),
17 }
18 }
19
20 pub fn activities(&self) -> ActivitiesEndpoint {
21 ActivitiesEndpoint::new(&self.url, &self.token)
22 }
23
24 pub fn athlete(&self) -> AthleteEndpoint {
25 AthleteEndpoint::new(&self.url, &self.token)
26 }
27
28 pub fn athletes(&self) -> AthletesEndpoint {
29 AthletesEndpoint::new(&self.url, &self.token)
30 }
31
32 pub fn clubs(&self) -> ClubsEndpoint {
33 ClubsEndpoint::new(&self.url, &self.token)
34 }
35
36 pub fn gear(&self) -> GearEndpoint {
37 GearEndpoint::new(&self.url, &self.token)
38 }
39
40 pub fn routes(&self) -> RoutesEndpoint {
41 RoutesEndpoint::new(&self.url, &self.token)
42 }
43
44 pub fn segments(&self) -> SegmentsEndpoint {
45 SegmentsEndpoint::new(&self.url, &self.token)
46 }
47}