An HTTP client for the [Helvetia] API.
The [Helvetia API] is a fully documented REST API, which you can interact with via an HTTP client. For those that need a Rust interface on top of this API, they can use this client instead.
Here's an example on how you can instantiate the Helvetia client and use it to create/get/delete a secret:
```rust use url; use helvetia_client::client::{Data,Meta,HelvetiaClient};
let ownertoken = "ownertoken"; let metatoken = "metatoken"; let secret_name = "secret"; let data = "The cake is a lie"; let meta = "Aperture";
// Create a client. let serverurl = url::Url::parse("https://helvetia.example.com")?; let client = HelvetiaClient::fromurl(server_url)?;
// Create a secret. let datareq = Data::new(ownertoken, data); let metareq = Meta::new(metatoken, meta); let res = client.createsecret(secretname, datareq, Some(metareq)).await?; assert_eq!(res, ());
// Get the data of a secret. let res = client.getsecretdata(secretname, ownertoken).await?; assert_eq!(&res, data);
// Get the metadata of a secret. let res = client.getsecretmeta(secretname, metatoken).await?; assert_eq!(&res, meta);
// Delete a secret. let res = client.deletesecret(secretname, ownertoken).await?; asserteq!(res, ()); ```
You can add this crate to your Cargo.toml
with the following snippet:
toml
helvetia_client = "0.1"
You can read the [CONTRIBUTING.md
] guide for more info on how to contribute to
this project.
Licensed under MPL-2.0. Please read the [NOTICE.md
] and [LICENSE
] files for
the full copyright and license information.