Uploadcare-Rust

Test

Rust library for accessing Uploadcare API https://uploadcare.com/

Cargo.toml

toml [dependencies] uploadcare = "0.1.0"

REST API example

```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); ```

Upload API example

```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);

```

Feature Flags

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

Example: REST API only

uploadare = { version = "*", default-features = false, features = ["rest"] } ```


MIT License