Expand description
§OpenADR 3.1 VEN client
This is a client library to interact with an OpenADR 3.1 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::<BusinessLogic>::with_url(
"https://your-vtn.com".parse().unwrap(),
Some(credentials),
);
let new_program = ProgramRequest::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::<BusinessLogic>::with_details(
"https://your-vtn.com".parse().unwrap(),
"https://your-oauth-provider.com".parse().unwrap(),
reqwest_client,
Some(credentials),
);Structs§
- Business
Logic - Used to mark the kind of
Client, see alsoClientKind - 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
skipandlimitvalues 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.
- Virtual
EndNode - Used to mark the kind of
Client, see alsoClientKind
Enums§
- Error
- Errors that can occur using the
Client - Filter
- Filter based on Target as specified for various items.
Traits§
- Client
Kind - This trait is used to mark the kind of
Clientto use, either aBusinessLogic, or aVirtualEndNode - Http
Client - Abstracts the implementation used for actual requests.