✨ feat: electricity contract endpoints #61
Loading…
Reference in a new issue
No description provided.
Delete branch "electricity-contract"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Resolves the
/api/electricitycontract/{id}TODO fromROADMAP.md§1 and ships the two read-only client methods from §3.Verified live (2026-09-06, read-only)
GET /api/electricitycontract/{site_id}— no query parameter, path param is the numeric site id, response is a JSON array:GET /api/electricitycontract/3349→200 [](probe site has no contract)The earlier TODO ("required query parameter not pinned down") was a false lead: the collection path
/api/electricitycontract?siteId=simply has no handler (404); the per-site contract lives at the{id}path segment.Caveat (documented in
misc-endpoints.md): the server does not 404 on an unknown id — on the probe account both thesiteUidand a bogus numeric id also return200 []— so "site id" semantics rest on the SPA bundle (which builds the URL from the numeric site id), not on server-side validation. The non-empty array shape is unverified: the probe site carries no contract.PUT(write path) is not verified live.Changes
comwatt_client/_electricity_contracts.py— newElectricityContractsMixin:get_electricity_contract(site_id)get_electricity_contract_providers()comwatt_client/client.py— wire the mixin intoComwattClient.tests/test_electricity_contracts.py—responseswith hand-written payloads (no captured live data, per ROADMAP §5).docs/energy.comwatt.com/misc-endpoints.md— resolve the TODO; document the caveats.ROADMAP.md— tick the §1 and §3 boxes.Tests
pytest: 139 passed (133 baseline + 6 new), 0 failures.mypy: clean.Resolve the /api/electricitycontract/{id} TODO (misc-endpoints.md): the path param is the numeric site id, the response is a JSON array ([] when the site has no contract), and no query parameter is involved — verified live 2026-09-06. The earlier 'required query parameter' note was a false lead (the collection path simply has no handler). Add two read-only client methods in a new ElectricityContractsMixin: - get_electricity_contract(site_id) - get_electricity_contract_providers() Tests use responses with hand-written payloads (no captured live data). Tick the matching ROADMAP §1 and §3 boxes.WIP: ✨ feat: electricity contract endpointsto ✨ feat: electricity contract endpoints