Skip to main content

Module client

Module client 

Source
Available on crate feature client only.
Expand description

HTTP clients for the two roles.

The role is a type parameter, so the compiler enforces what the specification’s scopes describe: Client<BusinessLogic> can create events, Client<VirtualEndNode> cannot, and asking for the wrong one is a compile error rather than a 403 in production.

Guide, including a VEN polling loop: https://hupe1980.github.io/openadr/docs/client/.

use openadr::client::{Client, BusinessLogic, Credentials};
let client = Client::<BusinessLogic>::builder("https://vtn.example.com/openadr3/3.1.0")?
    .credentials(Credentials::new("client-id", "client-secret"))
    .build()?;

let programs = client.programs().list().await?;

Structs§

BusinessLogic
Marks a client that acts as business logic.
Client
A VTN client.
ClientBuilder
Builds a Client.
Collection
Typed access to one collection.
Credentials
OAuth2 client-credentials, plus where to redeem them.
Query
Filters shared by every list endpoint.
RawResponse
One HTTP response, uninterpreted. See Client::exchange.
Tagged
A representation and the tag that identifies it.
VirtualEndNode
Marks a client that acts as a virtual end node.

Enums§

ClientError
Why a request failed.

Traits§

Role
Sealed marker for the two roles.