Uploadcare Rust API client that handles uploads and further operations with files by wrapping Uploadcare Upload and REST APIs.
rustc 1.43
cargo 1.43
toml
[dependencies]
uploadcare = "^0.1"
By default the full
is enabled (REST and Upload API).
To reduce code size, disable default features and enable just the APIs you use:
```toml
uploadcare = { version = "*", default-features = false, features = ["rest"] } ```
```rust use ucare; use ucare::file; use ucare::upload;
let creds = ucare::apicreds { secretkey: "yourprojectsecretkey", pubkey: "yourprojectpubkey", };
// creating rest client let config = ucare::RestConfig { signbasedauth: true, apiversion: ucare::RestApiVersion::v06, }; let restclient = ucare::RestClient::new(config, creds).unwrap();
// creating upload client let config = ucare::UploadConfig { signbasedupload: true, }; let upload_client = ucare::UploadClient::new(config, creds).unwrap(); ```
For a comprehensive list of examples, check out the API documentation. Below are a few usage examples:
```rust let filesvc = file::newsvc(&rest_client);
let fileid = "b7c1bf20-0f4c-4ba4-b3a8-a74ebc663752"; let fileinfo = filesvc.info(fileid).unwrap(); println!("{}: {:?}", fileid, fileinfo);
let uploadsvc = upload::newsvc(&upload_client);
let params = upload::FileParams { path: "/path/to/file".tostring(), name: "filename".tostring(), tostore: Some(upload::ToStore::Auto), }; let file = uploadsvc.file(params).unwrap(); println!("uploaded: {:?}", file.id);
```
Rust API client documentation
Uploadcare documentation
Upload API reference
REST API reference
Changelog
Contributing guide
Security policy
Support