Skip to main content

hinge_rs/api/
likes.rs

1use crate::client::HingeClient;
2use crate::errors::HingeError;
3use crate::models::{LikeItemV2, LikeLimit, LikesV2Response, MatchNoteResponse};
4use crate::storage::Storage;
5
6pub struct LikesApi<'a, S: Storage + Clone> {
7    pub(super) client: &'a mut HingeClient<S>,
8}
9
10impl<S: Storage + Clone> LikesApi<'_, S> {
11    pub async fn limit(&self) -> Result<LikeLimit, HingeError> {
12        self.client.get_like_limit().await
13    }
14
15    pub async fn list(&self) -> Result<LikesV2Response, HingeError> {
16        self.client.get_likes_v2().await
17    }
18
19    pub async fn list_raw(&self) -> Result<serde_json::Value, HingeError> {
20        self.client.get_likes_v2_raw().await
21    }
22
23    pub async fn subject(&self, subject_id: &str) -> Result<LikeItemV2, HingeError> {
24        self.client.get_like_subject(subject_id).await
25    }
26
27    pub async fn match_note(&self, subject_id: &str) -> Result<MatchNoteResponse, HingeError> {
28        self.client.get_match_note(subject_id).await
29    }
30}