#energy #openadr #lf-energy

bin+lib openleadr-client

OpenADR 3.0 client

3 releases

new 0.0.3 Nov 28, 2024
0.0.2 Nov 5, 2024
0.0.1 Oct 30, 2024

#223 in HTTP server

Download history 111/week @ 2024-10-27 133/week @ 2024-11-03 10/week @ 2024-11-10 3/week @ 2024-11-17 120/week @ 2024-11-24

275 downloads per month

Apache-2.0 OR MIT

170KB
3.5K SLoC

maintenance-status codecov Checks Crates.io Version

OpenADR 3.0 VEN client library in Rust

LF energy OpenLEADR logo

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
~450K SLoC