amber-api 1.0.0

Rust client for Amber Electric's API
Documentation

Amber API

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