Skip to main content

hinge_rs/client/
connections.rs

1use super::HingeClient;
2use crate::errors::HingeError;
3use crate::models::{
4    ConnectionDetailApi, ConnectionsResponse, MatchNoteResponse, StandoutsResponse,
5};
6use crate::storage::Storage;
7
8impl<S: Storage + Clone> HingeClient<S> {
9    pub async fn get_connections_v2(&self) -> Result<ConnectionsResponse, HingeError> {
10        let url = format!("{}/connection/v2", self.settings.base_url);
11        let res = self.http_get(&url).await?;
12        self.parse_response(res).await
13    }
14
15    pub async fn get_connection_detail(
16        &self,
17        subject_id: &str,
18    ) -> Result<ConnectionDetailApi, HingeError> {
19        let url = format!(
20            "{}/connection/subject/{}",
21            self.settings.base_url, subject_id
22        );
23        let res = self.http_get(&url).await?;
24        self.parse_response(res).await
25    }
26
27    pub async fn get_connection_match_note(
28        &self,
29        subject_id: &str,
30    ) -> Result<MatchNoteResponse, HingeError> {
31        let url = format!(
32            "{}/connection/v2/matchnote/{}",
33            self.settings.base_url, subject_id
34        );
35        let res = self.http_get(&url).await?;
36        self.parse_response(res).await
37    }
38
39    pub async fn get_standouts(&self) -> Result<StandoutsResponse, HingeError> {
40        let url = format!("{}/standouts/v3", self.settings.base_url);
41        let res = self.http_get(&url).await?;
42        self.parse_response(res).await
43    }
44}