2 releases
0.0.2 | Nov 5, 2024 |
---|---|
0.0.1 | Oct 30, 2024 |
#241 in HTTP server
254 downloads per month
165KB
3.5K
SLoC
OpenADR 3.0 VEN client library in Rust
This is a client library to interact with an OpenADR 3.0 complaint VTN server. It mainly wraps the HTTP REST interface into an easy-to-use Rust API.
The following contains information specific to the client library. If you are interested in information about the whole project, please visit the project level Readme.
Basic usage
For a basic example of how to use the client library, see the following. You can find detailed documentation of the library at docs.rs.
async fn main() {
let credentials = ClientCredentials::new("client_id".to_string(), "client_secret".to_string());
let client = Client::with_url("https://your-vtn.com".try_into().unwrap(), Some(credentials));
let new_program = ProgramContent::new("example-program-name".to_string());
let example_program = client.create_program(new_program).await.unwrap();
let mut new_event = example_program.new_event();
new_event.priority = Priority::new(10);
new_event.event_name = Some("Some descriptive name".to_string());
example_program.create_event(new_event).await.unwrap();
}
We plan to create a CLI binary using this library as well. See #52 for the current progress.
Dependencies
~14–29MB
~443K SLoC