pub(crate) async fn contact_load(&self, contact_id: String) -> Result<Contact<T>, WechatyError> {
        debug!("contact_load(query = {})", contact_id);
        let payload = self.contacts().get(&contact_id).cloned();
        match payload {
            Some(payload) => Ok(Contact::new(contact_id.clone(), self.clone(), Some(payload))),
            None => {
                let mut contact = Contact::new(contact_id.clone(), self.clone(), None);
                if let Err(e) = contact.sync().await {
                    error!("Failed to get payload of contact {}", contact_id);
                    return Err(e);
                }
                Ok(contact)
            }
        }
    }
/// Load a contact.
///
/// Use contact store first, if the contact cannot be found in the local store,
/// try to fetch from the puppet instead.
Load a contact.
Use contact store first, if the contact cannot be found in the local store,
try to fetch from the puppet instead.
Load a contact . Use contact store first if the contact cannot be found in the local store try to fetch from the puppet instead .
pub(crate) async fn contact_load(&self, contact_id: String) -> Result<Contact<T>, WechatyError> {
        debug!("contact_load(query = {})", contact_id);
        let payload = self.contacts().get(&contact_id).cloned();
        match payload {
            Some(payload) => Ok(Contact::new(contact_id.clone(), self.clone(), Some(payload))),
            None => {
                let mut contact = Contact::new(contact_id.clone(), self.clone(), None);
                if let Err(e) = contact.sync().await {
                    error!("Failed to get payload of contact {}", contact_id);
                    return Err(e);
                }
                Ok(contact)
            }
        }
    }
pub ( crate ) async fn contact_load ( & self , contact_id : String ) -> Result < Contact < T > , WechatyError > { debug ! ( " " contact_id ) ; let payload = self . contacts ( ) . get ( & contact_id ) . cloned ( ) ; match payload { Some ( payload ) => Ok ( Contact :: new ( contact_id . clone ( ) , self . clone ( ) , Some ( payload ) ) ) , None => { let mut contact = Contact :: new ( contact_id . clone ( ) , self . clone ( ) , None ) ; if let Err ( e ) = contact . sync ( ) . await { error ! ( " " contact_id ) ; return Err ( e ) ; } Ok ( contact ) } } }
Load a contact.
Load a contact .
&self
contact_id
String
&self
contact_id
String