Skip to main content

HingeClient

Struct HingeClient 

Source
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>

Source

pub async fn initiate_login(&mut self) -> Result<(), HingeError>

Source

pub async fn submit_otp(&mut self, otp: &str) -> Result<LoginTokens, HingeError>

Source

pub async fn submit_email_code( &mut self, case_id: &str, email_code: &str, ) -> Result<LoginTokens, HingeError>

Source

pub async fn is_session_valid(&mut self) -> Result<bool, HingeError>

Source§

impl<S: Storage + Clone> HingeClient<S>

Source

pub async fn send_message( &self, payload: SendMessagePayload, ) -> Result<Value, HingeError>

Source§

impl<S: Storage + Clone> HingeClient<S>

Source§

impl<S: Storage + Clone> HingeClient<S>

Source

pub async fn get_like_limit(&self) -> Result<LikeLimit, HingeError>

Source

pub async fn get_likes_v2(&self) -> Result<LikesV2Response, HingeError>

Source

pub async fn get_like_subject( &self, subject_id: &str, ) -> Result<LikeItemV2, HingeError>

Source

pub async fn get_match_note( &self, subject_id: &str, ) -> Result<MatchNoteResponse, HingeError>

Source

pub async fn get_likes_v2_raw(&self) -> Result<Value, HingeError>

Source§

impl<S: Storage + Clone> HingeClient<S>

Source

pub fn save_session(&self, path: &str) -> Result<(), HingeError>

Source

pub fn load_session(&mut self, path: &str) -> Result<(), HingeError>

Source

pub fn load_tokens_secure(&mut self) -> Result<(), HingeError>

Source

pub fn with_persistence( self, session_path: Option<String>, cache_dir: Option<PathBuf>, auto_persist: bool, ) -> Self

Source§

impl<S: Storage + Clone> HingeClient<S>

Source

pub async fn rendered_profile_text_for_user( &mut self, user_id: &str, ) -> Result<String, HingeError>

Source

pub async fn get_self_profile(&self) -> Result<SelfProfileResponse, HingeError>

Source

pub async fn get_self_content(&self) -> Result<SelfContentResponse, HingeError>

Source

pub async fn get_self_preferences( &self, ) -> Result<PreferencesResponse, HingeError>

Source

pub async fn get_profiles_public_raw_unfiltered( &self, ids: Vec<String>, ) -> Result<Value, HingeError>

Source

pub async fn get_content_public_raw_unfiltered( &self, ids: Vec<String>, ) -> Result<Value, HingeError>

Source

pub async fn get_profiles( &self, user_ids: Vec<String>, ) -> Result<Vec<PublicUserProfile>, HingeError>

Source

pub async fn get_profile_content( &self, user_ids: Vec<String>, ) -> Result<Vec<ProfileContentFull>, HingeError>

Source

pub async fn update_self_preferences( &self, preferences: Preferences, ) -> Result<Value, HingeError>

Source

pub async fn update_self_profile( &self, profile_updates: ProfileUpdate, ) -> Result<Value, HingeError>

Source

pub async fn update_answers( &self, answers: Vec<AnswerContentPayload>, ) -> Result<Value, HingeError>

Source

pub async fn delete_content( &self, content_ids: Vec<String>, ) -> Result<(), HingeError>

Source§

impl<S: Storage + Clone> HingeClient<S>

Source

pub async fn fetch_prompts(&mut self) -> Result<PromptsResponse, HingeError>

Source

pub async fn fetch_prompts_manager( &mut self, ) -> Result<HingePromptsManager, HingeError>

Source

pub async fn get_prompt_text( &mut self, prompt_id: &str, ) -> Result<String, HingeError>

Source

pub async fn search_prompts( &mut self, query: &str, ) -> Result<Vec<Prompt>, HingeError>

Source

pub async fn get_prompts_by_category( &mut self, category_slug: &str, ) -> Result<Vec<Prompt>, HingeError>

Source

pub async fn prompt_payload(&mut self) -> Value

Source

pub async fn evaluate_answer( &self, payload: AnswerEvaluateRequest, ) -> Result<Value, HingeError>

Source

pub async fn create_prompt_poll( &self, payload: CreatePromptPollRequest, ) -> Result<CreatePromptPollResponse, HingeError>

Source

pub async fn create_video_prompt( &self, payload: CreateVideoPromptRequest, ) -> Result<CreateVideoPromptResponse, HingeError>

Source§

impl<S: Storage + Clone> HingeClient<S>

Source

pub async fn skip(&mut self, input: SkipInput) -> Result<Value, HingeError>

Source

pub async fn rate_user( &mut self, input: RateInput, ) -> Result<LikeResponse, HingeError>

Source

pub async fn respond_rate( &self, payload: RateRespondRequest, ) -> Result<RateRespondResponse, HingeError>

Source§

impl<S: Storage + Clone> HingeClient<S>

Source

pub async fn raw_hinge_json( &self, method: Method, path_or_url: &str, body: Option<Value>, ) -> Result<Value, HingeError>

Source

pub async fn raw_sendbird_json( &self, method: Method, path_or_url: &str, body: Option<Value>, ) -> Result<Value, HingeError>

Source§

impl<S: Storage + Clone> HingeClient<S>

Source§

impl<S: Storage + Clone> HingeClient<S>

Source

pub async fn sendbird_list_my_group_channels( &mut self, user_id: &str, limit: usize, ) -> Result<Value, HingeError>

Source

pub async fn sendbird_list_channels_typed( &mut self, limit: usize, ) -> Result<SendbirdChannelsResponse, HingeError>

Source

pub async fn sendbird_get_channel( &mut self, channel_url: &str, ) -> Result<Value, HingeError>

Source

pub async fn sendbird_get_channel_typed( &mut self, channel_url: &str, ) -> Result<SendbirdGroupChannel, HingeError>

Source

pub async fn sendbird_get_messages( &mut self, channel_url: &str, message_ts: i64, prev_limit: usize, ) -> Result<SendbirdMessagesResponse, HingeError>

Source

pub async fn sendbird_get_full_messages( &mut self, channel_url: &str, ) -> Result<Vec<SendbirdMessage>, HingeError>

Source

pub async fn export_chat( &mut self, input: ExportChatInput, ) -> Result<ExportChatResult, HingeError>

Source

pub async fn sendbird_create_distinct_dm( &mut self, self_user_id: &str, peer_user_id: &str, data_mm: i32, ) -> Result<Value, HingeError>

Source

pub async fn sendbird_get_or_create_dm_channel( &mut self, self_user_id: &str, peer_user_id: &str, ) -> Result<String, HingeError>

Source

pub async fn ensure_sendbird_channel_with( &mut self, peer_user_id: &str, ) -> Result<SendbirdChannelHandle, HingeError>

Source

pub async fn sendbird_init_flow(&mut self) -> Result<Value, HingeError>

Source

pub async fn sendbird_creds(&mut self) -> Result<Value, HingeError>

Return Sendbird credentials for the JS client (appId and token), ensuring auth

Source

pub async fn sendbird_ws_subscribe( &mut self, ) -> Result<(UnboundedSender<String>, Receiver<String>), HingeError>

Source

pub async fn sendbird_ws_send_command( &mut self, command: String, ) -> Result<(), HingeError>

Send a raw command to the Sendbird WebSocket

Source

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)

Source

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

Source

pub async fn sendbird_ws_send_ping(&mut self) -> Result<(), HingeError>

Send a PING to keep the WebSocket alive

Source

pub async fn sendbird_ws_send_typing_start( &mut self, channel_url: &str, ) -> Result<(), HingeError>

Send a TPST (Typing Start) command - fire and forget

Source

pub async fn sendbird_ws_send_typing_end( &mut self, channel_url: &str, ) -> Result<(), HingeError>

Send a TPEN (Typing End) command - fire and forget

Source

pub async fn sendbird_ws_send_enter_channel( &mut self, channel_url: &str, ) -> Result<(), HingeError>

Send an ENTR (Enter Channel) command - fire and forget

Source

pub async fn sendbird_ws_send_exit_channel( &mut self, channel_url: &str, ) -> Result<(), HingeError>

Send an EXIT (Exit Channel) command - fire and forget

Source

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

Source

pub async fn sendbird_ws_close( &mut self, code: Option<u16>, reason: Option<String>, ) -> Result<(), HingeError>

Close the WebSocket connection with a specific code

Source

pub async fn sendbird_ws_ensure_connected(&mut self) -> Result<bool, HingeError>

Check if WebSocket is connected and reconnect if needed

Source§

impl<S: Storage + Clone> HingeClient<S>

Source§

impl<S: Storage + Clone> HingeClient<S>

Source

pub fn set_recs_fetch_config(&mut self, config: RecsFetchConfig)

Source

pub fn set_public_ids_batch_size(&mut self, batch_size: usize)

Source

pub fn new( phone_number: impl Into<String>, storage: S, settings: Option<Settings>, ) -> Self

Source

pub fn with_secret_store(self, store: Arc<dyn SecretStore>) -> Self

Trait Implementations§

Source§

impl<S: Clone + Storage + Clone> Clone for HingeClient<S>

Source§

fn clone(&self) -> HingeClient<S>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<S> Freeze for HingeClient<S>
where S: Freeze,

§

impl<S> !RefUnwindSafe for HingeClient<S>

§

impl<S> Send for HingeClient<S>
where S: Send,

§

impl<S> Sync for HingeClient<S>
where S: Sync,

§

impl<S> Unpin for HingeClient<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for HingeClient<S>
where S: UnsafeUnpin,

§

impl<S> !UnwindSafe for HingeClient<S>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more