pub async fn friendship_search(
        &self,
        query: FriendshipSearchQueryFilter,
    ) -> Result<Option<Contact<T>>, WechatyError> {
        debug!("friendship_search(query = {:?}", query);
        if !self.is_logged_in() {
            return Err(WechatyError::NotLoggedIn);
        }
        if query.phone.is_none() && query.weixin.is_none() {
            return Err(WechatyError::InvalidOperation(
                "Must specify either phone or weixin".to_owned(),
            ));
        }
        match self.puppet().friendship_search(query).await {
            Ok(Some(contact_id)) => {
                let mut contact = Contact::new(contact_id, self.clone(), None);
                contact.sync().await.unwrap_or_default();
                Ok(Some(contact))
            }
            Ok(None) => Ok(None),
            Err(e) => Err(WechatyError::from(e)),
        }
    }
/// Search a friendship.
///
/// First search by phone, then search by weixin.
Search a friendship.
First search by phone, then search by weixin.
Search a friendship . First search by phone then search by weixin .
pub async fn friendship_search(
        &self,
        query: FriendshipSearchQueryFilter,
    ) -> Result<Option<Contact<T>>, WechatyError> {
        debug!("friendship_search(query = {:?}", query);
        if !self.is_logged_in() {
            return Err(WechatyError::NotLoggedIn);
        }
        if query.phone.is_none() && query.weixin.is_none() {
            return Err(WechatyError::InvalidOperation(
                "Must specify either phone or weixin".to_owned(),
            ));
        }
        match self.puppet().friendship_search(query).await {
            Ok(Some(contact_id)) => {
                let mut contact = Contact::new(contact_id, self.clone(), None);
                contact.sync().await.unwrap_or_default();
                Ok(Some(contact))
            }
            Ok(None) => Ok(None),
            Err(e) => Err(WechatyError::from(e)),
        }
    }
pub async fn friendship_search ( & self , query : FriendshipSearchQueryFilter , ) -> Result < Option < Contact < T > > , WechatyError > { debug ! ( " " query ) ; if ! self . is_logged_in ( ) { return Err ( WechatyError :: NotLoggedIn ) ; } if query . phone . is_none ( ) && query . weixin . is_none ( ) { return Err ( WechatyError :: InvalidOperation ( " " . to_owned ( ) , ) ) ; } match self . puppet ( ) . friendship_search ( query ) . await { Ok ( Some ( contact_id ) ) => { let mut contact = Contact :: new ( contact_id , self . clone ( ) , None ) ; contact . sync ( ) . await . unwrap_or_default ( ) ; Ok ( Some ( contact ) ) } Ok ( None ) => Ok ( None ) , Err ( e ) => Err ( WechatyError :: from ( e ) ) , } }
Search a friendship.
Search a friendship .
&self
query
FriendshipSearchQueryFilter
&self
query
FriendshipSearchQueryFilter