openleadr-client

Crates.ioopenleadr-client
lib.rsopenleadr-client
version0.0.3
sourcesrc
created_at2024-10-30 13:39:52.708386
updated_at2024-11-28 09:20:25.505814
descriptionOpenADR 3.0 client
homepagehttps://github.com/OpenLEADR/openleadr-rs
repositoryhttps://github.com/OpenLEADR/openleadr-rs
max_upload_size
id1428533
size214,604
Maximilian Pohl (pohlm01)

documentation

README

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.

Commit count: 67

cargo fmt