Rust library for accessing Uploadcare API https://uploadcare.com/
toml
[dependencies]
uploadcare = "0.1.2"
```rust use ucare; use ucare::file;
let creds = ucare::ApiCreds { secretkey: "yourprojectsecretkey", pubkey: "yourprojectpubkey", }; let config = ucare::RestConfig { signbasedauth: true, apiversion: ucare::RestApiVersion::V06, }; let restclient = ucare::RestClient::new(config, creds).unwrap();
let filesvc = file::newsvc(&rest_client);
let fileid = "b7c1bf20-0f4c-4ba4-b3a8-a74ebc663752"; let fileinfo = filesvc.info(fileid).unwrap(); println!("{}: {:?}", fileid, fileinfo); ```
```rust use ucare::upload;
let config = ucare::UploadConfig { signbasedupload: true, }; let upload_client = ucare::UploadClient::new(config, creds).unwrap();
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);
```
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"] } ```
MIT License