pub async fn expand(&mut self) {
        // Create the shippo client.
        let shippo = Shippo::new_from_env();

        let mut carrier = self.carrier.to_lowercase().to_string();
        if carrier == "dhl" {
            carrier = "dhl_express".to_string();
        }

        // Get the tracking status for the shipment and fill in the details.
        let ts = shippo.get_tracking_status(&carrier, &self.tracking_number).await.unwrap_or_default();
        self.tracking_number = ts.tracking_number.to_string();
        let status = ts.tracking_status.unwrap_or_default();
        self.tracking_status = status.status.to_string();
        self.tracking_link();
        self.eta = ts.eta;

        self.oxide_tracking_link = self.oxide_tracking_link();

        self.messages = status.status_details;

        // Iterate over the tracking history and set the shipped_time.
        // Get the first date it was maked as in transit and use that as the shipped
        // time.
        for h in ts.tracking_history {
            if h.status == *"TRANSIT" {
                if let Some(shipped_time) = h.status_date {
                    let current_shipped_time = if let Some(s) = self.shipped_time { s } else { Utc::now() };

                    if shipped_time < current_shipped_time {
                        self.shipped_time = Some(shipped_time);
                    }
                }
            }
        }

        if status.status == *"DELIVERED" {
            self.delivered_time = status.status_date;
        }
    }
/// Get the details about the shipment from the tracking API.
Get the details about the shipment from the tracking API.
Get the details about the shipment from the tracking API .
pub async fn expand(&mut self) {
        // Create the shippo client.
        let shippo = Shippo::new_from_env();
        let mut carrier = self.carrier.to_lowercase().to_string();
        if carrier == "dhl" {
            carrier = "dhl_express".to_string();
        }
        // Get the tracking status for the shipment and fill in the details.
        let ts = shippo.get_tracking_status(&carrier, &self.tracking_number).await.unwrap_or_default();
        self.tracking_number = ts.tracking_number.to_string();
        let status = ts.tracking_status.unwrap_or_default();
        self.tracking_status = status.status.to_string();
        self.tracking_link();
        self.eta = ts.eta;
        self.oxide_tracking_link = self.oxide_tracking_link();
        self.messages = status.status_details;
        // Iterate over the tracking history and set the shipped_time.
        // Get the first date it was maked as in transit and use that as the shipped
        // time.
        for h in ts.tracking_history {
            if h.status == *"TRANSIT" {
                if let Some(shipped_time) = h.status_date {
                    let current_shipped_time = if let Some(s) = self.shipped_time { s } else { Utc::now() };
                    if shipped_time < current_shipped_time {
                        self.shipped_time = Some(shipped_time);
                    }
                }
            }
        }
        if status.status == *"DELIVERED" {
            self.delivered_time = status.status_date;
        }
    }
pub async fn expand ( & mut self ) { // Create the shippo client. let shippo = Shippo :: new_from_env ( ) ; let mut carrier = self . carrier . to_lowercase ( ) . to_string ( ) ; if carrier == " " { carrier = " " . to_string ( ) ; } // Get the tracking status for the shipment and fill in the details. let ts = shippo . get_tracking_status ( & carrier , & self . tracking_number ) . await . unwrap_or_default ( ) ; self . tracking_number = ts . tracking_number . to_string ( ) ; let status = ts . tracking_status . unwrap_or_default ( ) ; self . tracking_status = status . status . to_string ( ) ; self . tracking_link ( ) ; self . eta = ts . eta ; self . oxide_tracking_link = self . oxide_tracking_link ( ) ; self . messages = status . status_details ; // Iterate over the tracking history and set the shipped_time. // Get the first date it was maked as in transit and use that as the shipped // time. for h in ts . tracking_history { if h . status == * " " { if let Some ( shipped_time ) = h . status_date { let current_shipped_time = if let Some ( s ) = self . shipped_time { s } else { Utc :: now ( ) } ; if shipped_time < current_shipped_time { self . shipped_time = Some ( shipped_time ) ; } } } } if status . status == * " " { self . delivered_time = status . status_date ; } }
Get the details about the shipment from the tracking API.
Get the details about the shipment from the tracking API .
&mut self
&mut self