digitalocean-rs

Crates.iodigitalocean-rs
lib.rsdigitalocean-rs
version0.1.9
sourcesrc
created_at2023-11-05 00:03:45.269279
updated_at2023-11-06 20:11:01.104823
descriptionA pure Rust digitalocean API binding.
homepagehttps://gitlab.com/deploy-robot/digitalocean
repositoryhttps://gitlab.com/deploy-robot/digitalocean
max_upload_size
id1025648
size72,730
Alex (segler-alex)

documentation

https://docs.rs/crate/digitalocean-rs/

README

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
Commit count: 18

cargo fmt