Amber API
Installation
Add this to your Cargo.toml
:
[]
= "~1"
Quick Start
use Amber;
// Create a client with your API key
let client = builder
.api_key // Prefer setting AMBER_API_KEY in an environment variable
.build?;
// Get all your electricity sites
let sites = client.sites?;
println!;
// Get renewable energy data for Victoria
let renewables = client.renewables.state.call?;
println!;
Authentication
You'll need an API key from Amber Electric. You can provide it in several ways:
Environment Variable (Recommended)
Then use the default client:
let client = default;
Direct Configuration
let client = builder
.api_key
.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:
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)
# Run integration tests
License
This project is licensed under the MIT License - see the LICENSE file for details.