amber-api

Crates.ioamber-api
lib.rsamber-api
version1.0.0
created_at2025-08-06 23:22:58.49773+00
updated_at2025-08-06 23:22:58.49773+00
descriptionRust client for Amber Electric's API
homepage
repositoryhttps://github.com/JP-Ellis/amber-api
max_upload_size
id1784438
size268,687
JP-Ellis (JP-Ellis)

documentation

README

Amber API

Amber API Logo A Rust client library for the Amber Electric API, providing easy access to renewable energy data and pricing information.
Package Version Downloads Documentation
CI/CD CI Status Test Status
Meta Cargo project Code style - rustfmt Linting - Clippy License
Community Issues Discussions GitHub Stars

Installation

Add this to your Cargo.toml:

[dependencies]
amber-api = "~1"

Quick Start

use amber_api::Amber;

// Create a client with your API key
let client = Amber::builder()
    .api_key("your-api-key-here") // Prefer setting AMBER_API_KEY in an environment variable
    .build()?;

// Get all your electricity sites
let sites = client.sites()?;
println!("Found {} sites", sites.len());

// Get renewable energy data for Victoria
let renewables = client.renewables().state("vic").call()?;
println!("Current renewable: {}%", renewables.percentage);

Authentication

You'll need an API key from Amber Electric. You can provide it in several ways:

Environment Variable (Recommended)

export AMBER_API_KEY="your-api-key-here"

Then use the default client:

let client = Amber::default();

Direct Configuration

let client = Amber::builder()
    .api_key("your-api-key-here")
    .build()?;

Examples

Check out the examples directory for comprehensive usage examples. You can run them directly using Cargo and they will demonstrate various API features.

Most of the examples require that the AMBER_API_KEY environment be set, with the exception of the renewables:

cargo run --example renewables

API Coverage

This library provides access to:

  • Sites API: Manage your electricity sites
  • Renewables API: Access renewable energy data with configurable resolution
  • Pricing API: Real-time and forecast pricing information
  • Usage API: Historical and current usage data

For detailed API documentation, visit the Amber Electric API docs.

Documentation

Contributing

We welcome contributions! Please see our Contributing Guide for details on:

  • Setting up the development environment
  • Running tests and examples
  • Code style and formatting guidelines
  • Submitting pull requests

Testing

Run the test suite:

# Run tests with nextest (faster)
cargo nextest run

# Run integration tests
cargo test --test integration

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Commit count: 0

cargo fmt