6 releases
0.1.9 | Nov 6, 2023 |
---|---|
0.1.8 | Nov 5, 2023 |
#1564 in Development tools
52 downloads per month
32KB
719 lines
digitalocean-rs
A pure Rust DigitalOcean API binding.
Examples
Example blocking
It needs to have the feature "blocking" enabled.
digitalocean-rs = { version = "*", features = ["blocking"] }
use digitalocean_rs::DigitalOceanApi;
use digitalocean_rs::DigitalOceanError;
fn main() -> Result<(), DigitalOceanError> {
let api = DigitalOceanApi::new("api key");
let images = api.list_images()?;
println!("IMAGES: {:#?}", images);
let sizes = api.list_sizes()?;
println!("SIZES: {:#?}", sizes);
Ok(())
}
Example async
digitalocean-rs = { version = "*" }
use digitalocean_rs::DigitalOceanApi;
use digitalocean_rs::DigitalOceanError;
#[async_std::main]
async fn main() -> Result<(), DigitalOceanError> {
let api = DigitalOceanApi::new("api key");
let images = api.list_images_async().await?;
println!("IMAGES: {:#?}", images);
let sizes = api.list_sizes_async().await?;
println!("SIZES: {:#?}", sizes);
Ok(())
}
Features
- "default" - use nativetls
- "default-rustls" - use rusttls
- "blocking" - enable blocking api
- "rustls" - enable rustls for reqwest
- "nativetls" - add support for nativetls DEFAULT
- "gzip" - enable gzip in reqwest
- "brotli" - enable brotli in reqwest
- "deflate" - enable deflate in reqwest
TODO
- Documentation
- Full api support
Dependencies
~4–19MB
~308K SLoC