Skip to main content

hinge_rs/api/
connections.rs

1use crate::client::HingeClient;
2use crate::errors::HingeError;
3use crate::models::{
4    ConnectionDetailApi, ConnectionsResponse, MatchNoteResponse, StandoutsResponse,
5};
6use crate::storage::Storage;
7
8pub struct ConnectionsApi<'a, S: Storage + Clone> {
9    pub(super) client: &'a mut HingeClient<S>,
10}
11
12impl<S: Storage + Clone> ConnectionsApi<'_, S> {
13    pub async fn list(&self) -> Result<ConnectionsResponse, HingeError> {
14        self.client.get_connections_v2().await
15    }
16
17    pub async fn detail(&self, subject_id: &str) -> Result<ConnectionDetailApi, HingeError> {
18        self.client.get_connection_detail(subject_id).await
19    }
20
21    pub async fn match_note(&self, subject_id: &str) -> Result<MatchNoteResponse, HingeError> {
22        self.client.get_connection_match_note(subject_id).await
23    }
24
25    pub async fn standouts(&self) -> Result<StandoutsResponse, HingeError> {
26        self.client.get_standouts().await
27    }
28}