Skip to content

Comments

feat: Refactor GraphQL and REST API clients for EnergyZero#935

Merged
klaasnicolaas merged 3 commits intomainfrom
klaas-2025-018
Dec 21, 2025
Merged

feat: Refactor GraphQL and REST API clients for EnergyZero#935
klaasnicolaas merged 3 commits intomainfrom
klaas-2025-018

Conversation

@klaasnicolaas
Copy link
Owner

Proposed change

  • Added GraphQLClient for fetching electricity and gas prices via GraphQL API.
  • Introduced RESTClient for retrieving electricity and gas prices through REST API.
  • Updated const.py to define PriceType and Interval enums.
  • Refactored EnergyZero class to support backend selection (REST or GraphQL).
  • Enhanced error handling in exceptions.py for better clarity and data management.
  • Updated models.py to streamline price data handling and introduced from_rest_dict method for REST API responses.
  • Removed legacy methods for fetching prices, consolidating functionality into new API clients.

Additional information

  • This PR fixes or closes issue: fixes #

Checklist

  • I have updated the documentation if needed.
  • I have updated the tests if needed.

- Added GraphQLClient for fetching electricity and gas prices via GraphQL API.
- Introduced RESTClient for retrieving electricity and gas prices through REST API.
- Updated const.py to define PriceType and Interval enums.
- Refactored EnergyZero class to support backend selection (REST or GraphQL).
- Enhanced error handling in exceptions.py for better clarity and data management.
- Updated models.py to streamline price data handling and introduced from_rest_dict method for REST API responses.
- Removed legacy methods for fetching prices, consolidating functionality into new API clients.
@klaasnicolaas klaasnicolaas added breaking-change A breaking change for existing users. refactor Improvement of existing code, not introducing new features. labels Dec 18, 2025
@codecov
Copy link

codecov bot commented Dec 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (3fec3f9) to head (958e54c).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #935   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         9    +4     
  Lines          305       385   +80     
  Branches        25        44   +19     
=========================================
+ Hits           305       385   +80     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@klaasnicolaas klaasnicolaas merged commit 610d801 into main Dec 21, 2025
32 checks passed
@klaasnicolaas klaasnicolaas deleted the klaas-2025-018 branch December 21, 2025 16:52
@github-actions github-actions bot locked and limited conversation to collaborators Dec 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

breaking-change A breaking change for existing users. refactor Improvement of existing code, not introducing new features.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant