Expand description
§OpenADR 3.0 VEN client
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.
Basic usage
let credentials =
ClientCredentials::new("client_id".to_string(), "client_secret".to_string());
let client = Client::with_url(
"https://your-vtn.com".parse().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(vec![EventInterval {
id: 0,
interval_period: None,
payloads: vec![EventValuesMap {
value_type: EventType::Price,
values: vec![Value::Number(1.23)],
}],
}]);
new_event.priority = Priority::new(10);
new_event.event_name = Some("Some descriptive name".to_string());
example_program.create_event(new_event).await.unwrap();
If you want to use a separate OAuth provider that is not built into the VTN server, you can do so as well.
// optionally, you can build special configuration into the reqwest client here as well
let reqwest_client = reqwest::Client::new();
let client = Client::with_details(
"https://your-vtn.com".parse().unwrap(),
"https://your-oauth-provider.com".parse().unwrap(),
reqwest_client,
Some(credentials),
);
Structs§
- Client
- Client for managing top-level entities on a VTN, i.e., programs and VENs.
- Client
Credentials - Credentials necessary for authentication at the VTN
- Event
Client - Client to manage the data of a specific event and the reports contained in that event
- Interval
- Holds the data stored in a
Timeline
. - Iter
- Iterator over
Timeline
. - Pagination
Options - Allows setting specific
skip
andlimit
values for list queries. - Program
Client - A client for interacting with the data in a specific program and the events contained in the program.
- Report
Client - Client to manage the data of a specific report
- Resource
Client - A client for interacting with the data in a specific resource stored as a child element of a VEN on the VTN.
- Timeline
- A sequence of ordered, non-overlapping intervals and associated values.
- VenClient
- A client for interacting with the data in a specific VEN and the resources contained in the VEN.
Enums§
- Error
- Errors that can occur using the
Client
- Filter
- Filter based on TargetType and TargetValues as specified for various items.
- Target
- Target for a query to the VTN
Traits§
- Http
Client - Abstracts the implementation used for actual requests.