strava_wrapper/
endpoints.rs1use crate::filters::activities::ActivityFilter;
2use crate::filters::comments::CommentFilter;
3use crate::filters::kudos::KudosFilter;
4
5pub struct CommentsEndpoint {
49 url: String,
50 token: String,
51}
52
53impl CommentsEndpoint {
54 pub fn new(url: impl Into<String>, token: impl Into<String>) -> Self {
55 Self {
56 url: url.into(),
57 token: token.into(),
58 }
59 }
60 pub fn get(&self) -> CommentFilter {
61 CommentFilter::new(&self.url, &self.token, "v3/activities/{id}/comments")
62 }
63}
64
65pub struct ActivitiesEndpoint {
66 url: String,
67 token: String,
68}
69
70impl ActivitiesEndpoint {
71 pub fn new(url: impl Into<String>, token: impl Into<String>) -> Self {
72 Self {
73 url: url.into(),
74 token: token.into(),
75 }
76 }
77
78 pub fn comments(&self) -> CommentsEndpoint {
79 CommentsEndpoint::new(&self.url, &self.token)
80 }
81
82 pub fn kudos(&self) -> KudosEndpoint {
83 KudosEndpoint::new(&self.url, &self.token)
84 }
85
86 pub fn list(&self) -> ActivityFilter {
87 ActivityFilter::new(&self.url, &self.token, "v3/athlete/activities")
88 }
89
90 pub fn get(&self) -> ActivityFilter {
91 ActivityFilter::new(&self.url, &self.token, "v3/activities/{id}")
92 }
93
94 }
96
97pub struct KudosEndpoint {
98 url: String,
99 token: String,
100}
101
102impl KudosEndpoint {
103 pub fn new(url: impl Into<String>, token: impl Into<String>) -> Self {
104 Self {
105 url: url.into(),
106 token: token.into(),
107 }
108 }
109
110 pub fn get(&self) -> KudosFilter {
111 KudosFilter::new(&self.url, &self.token, "v3/activities/{id}/kudos")
112 }
113}