[client] Relocate misplaced methods: get_device_kinds, get_measure_keys, get_authenticated_user #177

Closed
opened 2026-10-27 11:31:54 +00:00 by mat · 0 comments
Owner

Executes the method-relocation part of the #151 audit. Moving methods between private mixins is free — resolution happens on the composed ComwattClient instance, so the public API and existing tests are unaffected.

Moves:

  • get_device_kinds(site_uid) (_devices.py:107, GET /devicekinds/by-site-uid/) is a catalogue read → CataloguesMixin (_catalogues.py, which already holds get_products / get_timezones / get_modbus_configurations).
  • get_measure_keys(site_id) (_connected_objects.py:82, GET /measurekeys/...?siteId=) is a site-scoped lookup, not a connected-object subresource → SitesMixin.
  • get_authenticated_user() (_sites.py:24, GET /users/authenticated) belongs next to is_authenticated, which already probes the same URL (_auth.py:79) → AuthMixin.

Kept in place (defensible): get_modbus_configurations stays in catalogues despite the /gateways/ path; get_electricity_contract_providers stays in electricity-contracts.

Done when: three methods moved, pytest -q green, no README/signature change.

Executes the method-relocation part of the #151 audit. Moving methods between private mixins is free — resolution happens on the composed `ComwattClient` instance, so the public API and existing tests are unaffected. **Moves:** - `get_device_kinds(site_uid)` (`_devices.py:107`, GET `/devicekinds/by-site-uid/`) is a catalogue read → `CataloguesMixin` (`_catalogues.py`, which already holds `get_products` / `get_timezones` / `get_modbus_configurations`). - `get_measure_keys(site_id)` (`_connected_objects.py:82`, GET `/measurekeys/...?siteId=`) is a site-scoped lookup, not a connected-object subresource → `SitesMixin`. - `get_authenticated_user()` (`_sites.py:24`, GET `/users/authenticated`) belongs next to `is_authenticated`, which already probes the same URL (`_auth.py:79`) → `AuthMixin`. **Kept in place (defensible):** `get_modbus_configurations` stays in catalogues despite the `/gateways/` path; `get_electricity_contract_providers` stays in electricity-contracts. **Done when:** three methods moved, `pytest -q` green, no README/signature change.
mat closed this issue 2026-10-27 14:31:37 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mat/python-comwatt-client#177
No description provided.