async fn upload_dataset_file(
        &self,
        file: impl AsRef<Path>,
        file_name: impl AsRef<str>,
        item: Option<&Resource>,
    ) -> anyhow::Result<DatasetUploadFile> {
        let file = file.as_ref();
        let (content_length, last_modified) = Self::get_file_metadata(file)?;
        // get the token first
        let info = self
            .datasets_upload_file(file_name.as_ref(), content_length, last_modified)
            .await?;

        // complete the upload to retrieve a path from the url parameter
        self.upload_complete(file, &info.create_url).await?;

        let mut upload_file = DatasetUploadFile::new(info.token);
        if let Some(item) = item {
            if let Some(desc) = &item.description {
                upload_file.set_description(desc.clone());
            }
            if let Some(schema) = &item.schema {
                upload_file.set_columns(schema.get_processed_columns());
            }
            if let Some(schema) = &item.schema {
                upload_file.set_columns(schema.get_processed_columns());
            }
        }

        Ok(upload_file)
    }
/// Upload a single dataset file.
Upload a single dataset file.
Upload a single dataset file .
async fn upload_dataset_file(
        &self,
        file: impl AsRef<Path>,
        file_name: impl AsRef<str>,
        item: Option<&Resource>,
    ) -> anyhow::Result<DatasetUploadFile> {
        let file = file.as_ref();
        let (content_length, last_modified) = Self::get_file_metadata(file)?;
        // get the token first
        let info = self
            .datasets_upload_file(file_name.as_ref(), content_length, last_modified)
            .await?;
        // complete the upload to retrieve a path from the url parameter
        self.upload_complete(file, &info.create_url).await?;
        let mut upload_file = DatasetUploadFile::new(info.token);
        if let Some(item) = item {
            if let Some(desc) = &item.description {
                upload_file.set_description(desc.clone());
            }
            if let Some(schema) = &item.schema {
                upload_file.set_columns(schema.get_processed_columns());
            }
            if let Some(schema) = &item.schema {
                upload_file.set_columns(schema.get_processed_columns());
            }
        }
        Ok(upload_file)
    }
async fn upload_dataset_file ( & self , file : impl AsRef < Path > , file_name : impl AsRef < str > , item : Option < & Resource > , ) -> anyhow :: Result < DatasetUploadFile > { let file = file . as_ref ( ) ; let ( content_length , last_modified ) = Self :: get_file_metadata ( file ) ? ; // get the token first let info = self . datasets_upload_file ( file_name . as_ref ( ) , content_length , last_modified ) . await ? ; // complete the upload to retrieve a path from the url parameter self . upload_complete ( file , & info . create_url ) . await ? ; let mut upload_file = DatasetUploadFile :: new ( info . token ) ; if let Some ( item ) = item { if let Some ( desc ) = & item . description { upload_file . set_description ( desc . clone ( ) ) ; } if let Some ( schema ) = & item . schema { upload_file . set_columns ( schema . get_processed_columns ( ) ) ; } if let Some ( schema ) = & item . schema { upload_file . set_columns ( schema . get_processed_columns ( ) ) ; } } Ok ( upload_file ) }
Upload a single dataset file.
Upload a single dataset file .
&self
file
impl AsRef<Path>
file_name
impl AsRef<str>
item
Option<&Resource>
&self
file
impl AsRef<Path>
file_name
impl AsRef<str>
item
Option<&Resource>