Function imagevault::service::upload_service::upload_from_path [−][src]
pub async fn upload_from_path<T: Authentication + Sync>(
client: &Client<T>,
path: &Path
) -> Result<String, ImageVaultError>
Expand description
Calls uploadservice/upload
.
The file pointed to by path
will be uploaded in 50 kiB chunks.
Returns an AuthenticationMissing
error
if the Client
does not have any Authentication
set.
Arguments
client
- The ImageVaultClient
to use.path
- The path to the file to upload.
Examples
use std::path::Path; use imagevault::{ service::upload_service, Client, authentication::ClientCredentialsAuthentication, error::Error as ImageVaultError }; let authentication = ClientCredentialsAuthentication::default(); let client = Client::new( "identity", "secret", "https://myimagevault.local" )? .with_authentication(authentication); let file_path = Path::new("my_image.jpg"); let upload_file_id = upload_service::upload_from_path( &client, file_path ) .await?;