pub struct HingeClient<S: Storage + Clone> {
pub settings: Settings,
pub storage: S,
pub phone_number: String,
pub device_id: String,
pub install_id: String,
pub session_id: String,
pub installed: bool,
pub hinge_auth: Option<HingeAuthToken>,
pub sendbird_auth: Option<SendbirdAuthToken>,
pub sendbird_session_key: Option<String>,
pub recommendations: HashMap<String, RecommendationSubject>,
/* private fields */
}Fields§
§settings: Settings§storage: S§phone_number: String§device_id: String§install_id: String§session_id: String§installed: bool§hinge_auth: Option<HingeAuthToken>§sendbird_auth: Option<SendbirdAuthToken>§sendbird_session_key: Option<String>§recommendations: HashMap<String, RecommendationSubject>Implementations§
Source§impl<S: Storage + Clone> HingeClient<S>
impl<S: Storage + Clone> HingeClient<S>
pub fn set_recs_fetch_config(&mut self, config: RecsFetchConfig)
pub fn set_public_ids_batch_size(&mut self, batch_size: usize)
pub async fn rendered_profile_text_for_user( &mut self, user_id: &str, ) -> Result<String, HingeError>
pub fn new( phone_number: impl Into<String>, storage: S, settings: Option<Settings>, ) -> Self
pub fn with_secret_store(self, store: Arc<dyn SecretStore>) -> Self
pub async fn sendbird_list_my_group_channels( &mut self, user_id: &str, limit: usize, ) -> Result<Value, HingeError>
pub async fn sendbird_list_channels_typed( &mut self, limit: usize, ) -> Result<SendbirdChannelsResponse, HingeError>
pub async fn sendbird_get_channel( &mut self, channel_url: &str, ) -> Result<Value, HingeError>
pub async fn sendbird_get_channel_typed( &mut self, channel_url: &str, ) -> Result<SendbirdGroupChannel, HingeError>
pub async fn sendbird_get_messages( &mut self, channel_url: &str, message_ts: i64, prev_limit: usize, ) -> Result<SendbirdMessagesResponse, HingeError>
pub async fn sendbird_get_full_messages( &mut self, channel_url: &str, ) -> Result<Vec<SendbirdMessage>, HingeError>
pub async fn export_chat( &mut self, input: ExportChatInput, ) -> Result<ExportChatResult, HingeError>
pub async fn sendbird_create_distinct_dm( &mut self, self_user_id: &str, peer_user_id: &str, data_mm: i32, ) -> Result<Value, HingeError>
pub async fn sendbird_get_or_create_dm_channel( &mut self, self_user_id: &str, peer_user_id: &str, ) -> Result<String, HingeError>
pub async fn ensure_sendbird_channel_with( &mut self, peer_user_id: &str, ) -> Result<SendbirdChannelHandle, HingeError>
pub async fn sendbird_init_flow(&mut self) -> Result<Value, HingeError>
Sourcepub async fn sendbird_creds(&mut self) -> Result<Value, HingeError>
pub async fn sendbird_creds(&mut self) -> Result<Value, HingeError>
Return Sendbird credentials for the JS client (appId and token), ensuring auth
pub async fn sendbird_ws_subscribe( &mut self, ) -> Result<(UnboundedSender<String>, Receiver<String>), HingeError>
Sourcepub async fn sendbird_ws_send_command(
&mut self,
command: String,
) -> Result<(), HingeError>
pub async fn sendbird_ws_send_command( &mut self, command: String, ) -> Result<(), HingeError>
Send a raw command to the Sendbird WebSocket
Sourcepub async fn sendbird_ws_send_read(
&mut self,
channel_url: &str,
) -> Result<(), HingeError>
pub async fn sendbird_ws_send_read( &mut self, channel_url: &str, ) -> Result<(), HingeError>
Send a READ acknowledgment for a Sendbird channel (fire and forget)
Sourcepub async fn sendbird_ws_send_read_and_wait(
&mut self,
channel_url: &str,
) -> Result<SendbirdReadResponse, HingeError>
pub async fn sendbird_ws_send_read_and_wait( &mut self, channel_url: &str, ) -> Result<SendbirdReadResponse, HingeError>
Send a READ acknowledgment and wait for the response
Sourcepub async fn sendbird_ws_send_ping(&mut self) -> Result<(), HingeError>
pub async fn sendbird_ws_send_ping(&mut self) -> Result<(), HingeError>
Send a PING to keep the WebSocket alive
Sourcepub async fn sendbird_ws_send_typing_start(
&mut self,
channel_url: &str,
) -> Result<(), HingeError>
pub async fn sendbird_ws_send_typing_start( &mut self, channel_url: &str, ) -> Result<(), HingeError>
Send a TPST (Typing Start) command - fire and forget
Sourcepub async fn sendbird_ws_send_typing_end(
&mut self,
channel_url: &str,
) -> Result<(), HingeError>
pub async fn sendbird_ws_send_typing_end( &mut self, channel_url: &str, ) -> Result<(), HingeError>
Send a TPEN (Typing End) command - fire and forget
Sourcepub async fn sendbird_ws_send_enter_channel(
&mut self,
channel_url: &str,
) -> Result<(), HingeError>
pub async fn sendbird_ws_send_enter_channel( &mut self, channel_url: &str, ) -> Result<(), HingeError>
Send an ENTR (Enter Channel) command - fire and forget
Sourcepub async fn sendbird_ws_send_exit_channel(
&mut self,
channel_url: &str,
) -> Result<(), HingeError>
pub async fn sendbird_ws_send_exit_channel( &mut self, channel_url: &str, ) -> Result<(), HingeError>
Send an EXIT (Exit Channel) command - fire and forget
Sourcepub async fn sendbird_ws_send_message_ack(
&mut self,
channel_url: &str,
message_id: &str,
) -> Result<(), HingeError>
pub async fn sendbird_ws_send_message_ack( &mut self, channel_url: &str, message_id: &str, ) -> Result<(), HingeError>
Send a MACK (Message Acknowledgment) command - fire and forget
Sourcepub async fn sendbird_ws_close(
&mut self,
code: Option<u16>,
reason: Option<String>,
) -> Result<(), HingeError>
pub async fn sendbird_ws_close( &mut self, code: Option<u16>, reason: Option<String>, ) -> Result<(), HingeError>
Close the WebSocket connection with a specific code
Sourcepub async fn sendbird_ws_ensure_connected(&mut self) -> Result<bool, HingeError>
pub async fn sendbird_ws_ensure_connected(&mut self) -> Result<bool, HingeError>
Check if WebSocket is connected and reconnect if needed
pub async fn initiate_login(&mut self) -> Result<(), HingeError>
pub async fn submit_otp(&mut self, otp: &str) -> Result<LoginTokens, HingeError>
pub async fn submit_email_code( &mut self, case_id: &str, email_code: &str, ) -> Result<LoginTokens, HingeError>
pub fn save_session(&self, path: &str) -> Result<(), HingeError>
pub fn load_session(&mut self, path: &str) -> Result<(), HingeError>
pub fn load_tokens_secure(&mut self) -> Result<(), HingeError>
pub fn with_persistence( self, session_path: Option<String>, cache_dir: Option<PathBuf>, auto_persist: bool, ) -> Self
pub async fn fetch_prompts(&mut self) -> Result<PromptsResponse, HingeError>
pub async fn fetch_prompts_manager( &mut self, ) -> Result<HingePromptsManager, HingeError>
pub async fn get_prompt_text( &mut self, prompt_id: &str, ) -> Result<String, HingeError>
pub async fn search_prompts( &mut self, query: &str, ) -> Result<Vec<Prompt>, HingeError>
pub async fn get_prompts_by_category( &mut self, category_slug: &str, ) -> Result<Vec<Prompt>, HingeError>
pub async fn get_recommendations( &mut self, ) -> Result<RecommendationsResponse, HingeError>
pub async fn get_recommendations_v2_params( &mut self, params: RecsV2Params, ) -> Result<RecommendationsResponse, HingeError>
pub fn apply_recommendations_and_save( &mut self, recs: &mut RecommendationsResponse, path: Option<&str>, ) -> Result<(), HingeError>
pub async fn get_self_profile(&self) -> Result<SelfProfileResponse, HingeError>
pub async fn get_self_content(&self) -> Result<SelfContentResponse, HingeError>
pub async fn get_self_preferences( &self, ) -> Result<PreferencesResponse, HingeError>
pub async fn get_like_limit(&self) -> Result<LikeLimit, HingeError>
pub async fn get_likes_v2(&self) -> Result<LikesV2Response, HingeError>
pub async fn get_like_subject( &self, subject_id: &str, ) -> Result<LikeItemV2, HingeError>
pub async fn get_match_note( &self, subject_id: &str, ) -> Result<MatchNoteResponse, HingeError>
Sourcepub async fn get_likes_v2_raw(&self) -> Result<Value, HingeError>
pub async fn get_likes_v2_raw(&self) -> Result<Value, HingeError>
Fetch the raw JSON response for likes v2 without mapping to typed structs
Sourcepub async fn get_profiles_public_raw_unfiltered(
&self,
ids: Vec<String>,
) -> Result<Value, HingeError>
pub async fn get_profiles_public_raw_unfiltered( &self, ids: Vec<String>, ) -> Result<Value, HingeError>
Raw, unfiltered request to user/v3/public for explicit ids
Sourcepub async fn get_content_public_raw_unfiltered(
&self,
ids: Vec<String>,
) -> Result<Value, HingeError>
pub async fn get_content_public_raw_unfiltered( &self, ids: Vec<String>, ) -> Result<Value, HingeError>
Raw, unfiltered request to content/v2/public for explicit ids