Skip to main content

Crate sobry_api

Crate sobry_api 

Source
Expand description

Async client for the Sobry API v2.

A Sobry API key belongs to one contract, so no contract identifier is needed.

use chrono::NaiveDate;
use sobry_api::{Client, DailyPricesRequest, Granularity, TaxMode};

let client = Client::new(std::env::var("SOBRY_API_KEY").unwrap())?;
let request = DailyPricesRequest::new()
    .day(NaiveDate::from_ymd_opt(2026, 6, 12).unwrap())
    .granularity(Granularity::QuarterHour)
    .tax_mode(TaxMode::IncludingTax);
let prices = client.daily_prices(&request).await?;
println!("received {} price points", prices.len());

Structs§

ApiError
Structured fields commonly returned by a failed API call.
Client
An asynchronous Sobry API client.
ClientBuilder
Configuration for a Client.
DailyPrice
One electricity-price time slot returned by Sobry.
DailyPricesRequest
Query options accepted by GET /user/daily-prices.

Enums§

ColorLabel
Price category relative to the French regulated tariff (TRV).
Error
Errors produced by this crate.
Granularity
Price-point granularity.
TaxMode
Tax treatment of the all-inclusive price field.

Constants§

DEFAULT_BASE_URL
Default base URL for Sobry API v2.