// Changes the phone number of the user and sends an authentication code to the user's new phone number. On success, returns information about the sent code
Changes the phone number of the user and sends an authentication code to the user's new phone number. On success, returns information about the sent code
Changes the phone number of the user and sends an authentication code to the user ' s new phone number . On success returns information about the sent code
pub async fn change_phone_number<C: AsRef<ChangePhoneNumber>>(
        &self,
        change_phone_number: C,
    ) -> RTDResult<AuthenticationCodeInfo> {
        let extra = change_phone_number.as_ref().extra().ok_or(NO_EXTRA)?;
        let signal = OBSERVER.subscribe(&extra);
        self.tdlib_client
            .send(self.get_client_id()?, change_phone_number.as_ref())?;
        let received = signal.await;
        OBSERVER.unsubscribe(&extra);
        match received {
            Err(_) => Err(CLOSED_RECEIVER_ERROR),
            Ok(v) => match v {
                TdType::AuthenticationCodeInfo(v) => Ok(v),
                TdType::Error(v) => Err(RTDError::TDLibError(v)),
                _ => {
                    log::error!("invalid response received: {:?}", v);
                    Err(INVALID_RESPONSE_ERROR)
                }
            },
        }
    }
pub async fn change_phone_number < C : AsRef < ChangePhoneNumber > > ( & self , change_phone_number : C , ) -> RTDResult < AuthenticationCodeInfo > { let extra = change_phone_number . as_ref ( ) . extra ( ) . ok_or ( NO_EXTRA ) ? ; let signal = OBSERVER . subscribe ( & extra ) ; self . tdlib_client . send ( self . get_client_id ( ) ? , change_phone_number . as_ref ( ) ) ? ; let received = signal . await ; OBSERVER . unsubscribe ( & extra ) ; match received { Err ( _ ) => Err ( CLOSED_RECEIVER_ERROR ) , Ok ( v ) => match v { TdType :: AuthenticationCodeInfo ( v ) => Ok ( v ) , TdType :: Error ( v ) => Err ( RTDError :: TDLibError ( v ) ) , _ => { log :: error ! ( " " v ) ; Err ( INVALID_RESPONSE_ERROR ) } } , } }
Changes the phone number of the user and sends an authentication code to the user's new phone number.
Changes the phone number of the user and sends an authentication code to the user ' s new phone number .
&self
change_phone_number
C