pub async fn sync(&self) -> color_eyre::Result<()> {
        let spinner = crate::utils::get_spinner("Syncing...");
        // Sleep to make sure the previous requests are processed
        let duration = core::time::Duration::from_millis(500);
        std::thread::sleep(duration);

        let mut query = SearchQuery::builder()
            .limit(200)
            .order(Order::Asc)
            .search_after(self.get_sync_time()?)
            .user(&self.api.user.0)
            .group(self.config.hypothesis_group.as_deref().unwrap())
            .build()?;
        let (added, updated) =
            self.sync_annotations(&self.api.search_annotations_return_all(&mut query).await?)?;
        self.set_sync_time(&query.search_after)?;
        spinner.finish_with_message("Done!");
        if added > 0 {
            if added == 1 {
                println!("Added 1 annotation");
            } else {
                println!("Added {} annotations", added);
            }
        }
        if updated > 0 {
            if updated == 1 {
                println!("Updated 1 annotation");
            } else {
                println!("Updated {} annotations", updated);
            }
        }
        if added == 0 && updated == 0 {
            println!("Everything up to date!")
        }
        Ok(())
    }
/// Sync newly added / updated annotations
Sync newly added / updated annotations
Sync newly added / updated annotations
pub async fn sync(&self) -> color_eyre::Result<()> {
        let spinner = crate::utils::get_spinner("Syncing...");
        // Sleep to make sure the previous requests are processed
        let duration = core::time::Duration::from_millis(500);
        std::thread::sleep(duration);
        let mut query = SearchQuery::builder()
            .limit(200)
            .order(Order::Asc)
            .search_after(self.get_sync_time()?)
            .user(&self.api.user.0)
            .group(self.config.hypothesis_group.as_deref().unwrap())
            .build()?;
        let (added, updated) =
            self.sync_annotations(&self.api.search_annotations_return_all(&mut query).await?)?;
        self.set_sync_time(&query.search_after)?;
        spinner.finish_with_message("Done!");
        if added > 0 {
            if added == 1 {
                println!("Added 1 annotation");
            } else {
                println!("Added {} annotations", added);
            }
        }
        if updated > 0 {
            if updated == 1 {
                println!("Updated 1 annotation");
            } else {
                println!("Updated {} annotations", updated);
            }
        }
        if added == 0 && updated == 0 {
            println!("Everything up to date!")
        }
        Ok(())
    }
pub async fn sync ( & self ) -> color_eyre :: Result < ( ) > { let spinner = crate :: utils :: get_spinner ( " " ) ; // Sleep to make sure the previous requests are processed let duration = core :: time :: Duration :: from_millis ( 500 ) ; std :: thread :: sleep ( duration ) ; let mut query = SearchQuery :: builder ( ) . limit ( 200 ) . order ( Order :: Asc ) . search_after ( self . get_sync_time ( ) ? ) . user ( & self . api . user . 0 ) . group ( self . config . hypothesis_group . as_deref ( ) . unwrap ( ) ) . build ( ) ? ; let ( added , updated ) = self . sync_annotations ( & self . api . search_annotations_return_all ( & mut query ) . await ? ) ? ; self . set_sync_time ( & query . search_after ) ? ; spinner . finish_with_message ( " " ) ; if added > 0 { if added == 1 { println ! ( " " ) ; } else { println ! ( " " added ) ; } } if updated > 0 { if updated == 1 { println ! ( " " ) ; } else { println ! ( " " updated ) ; } } if added == 0 && updated == 0 { println ! ( " " ) } Ok ( ( ) ) }
Sync newly added / updated annotations
Sync newly added / updated annotations
&self
&self