Crates.io | openleadr-client |
lib.rs | openleadr-client |
version | 0.0.3 |
source | src |
created_at | 2024-10-30 13:39:52.708386 |
updated_at | 2024-11-28 09:20:25.505814 |
description | OpenADR 3.0 client |
homepage | https://github.com/OpenLEADR/openleadr-rs |
repository | https://github.com/OpenLEADR/openleadr-rs |
max_upload_size | |
id | 1428533 |
size | 214,604 |
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.
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.