2424from pyoverkiz .action_queue import ActionQueue , ActionQueueSettings
2525from pyoverkiz .auth import AuthStrategy , Credentials , build_auth_strategy
2626from pyoverkiz .const import SUPPORTED_SERVERS , USER_AGENT
27- from pyoverkiz .converter import converter , structure_response
27+ from pyoverkiz .converter import converter
2828from pyoverkiz .enums import APIType , ExecutionMode , Protocol , Server
2929from pyoverkiz .exceptions import (
3030 ExecutionQueueFullError ,
@@ -333,7 +333,7 @@ async def get_setup(self, refresh: bool = False) -> Setup:
333333
334334 response = await self ._get ("setup" )
335335
336- setup = structure_response (response , Setup )
336+ setup = converter . structure (response , Setup )
337337
338338 # Cache response
339339 self .setup = setup
@@ -381,7 +381,7 @@ async def get_devices(self, refresh: bool = False) -> list[Device]:
381381 return self .devices
382382
383383 response = await self ._get ("setup/devices" )
384- devices = structure_response (response , list [Device ])
384+ devices = converter . structure (response , list [Device ])
385385
386386 # Cache response
387387 self .devices = devices
@@ -400,7 +400,7 @@ async def get_gateways(self, refresh: bool = False) -> list[Gateway]:
400400 return self .gateways
401401
402402 response = await self ._get ("setup/gateways" )
403- gateways = structure_response (response , list [Gateway ])
403+ gateways = converter . structure (response , list [Gateway ])
404404
405405 # Cache response
406406 self .gateways = gateways
@@ -413,7 +413,7 @@ async def get_gateways(self, refresh: bool = False) -> list[Gateway]:
413413 async def get_execution_history (self ) -> list [HistoryExecution ]:
414414 """List past executions and their outcomes."""
415415 response = await self ._get ("history/executions" )
416- return structure_response (response , list [HistoryExecution ])
416+ return converter . structure (response , list [HistoryExecution ])
417417
418418 @retry_on_auth_error
419419 async def get_device_definition (self , device_url : str ) -> Definition | None :
@@ -426,15 +426,15 @@ async def get_device_definition(self, device_url: str) -> Definition | None:
426426 if raw is None :
427427 return None
428428
429- return structure_response (raw , Definition )
429+ return converter . structure (raw , Definition )
430430
431431 @retry_on_auth_error
432432 async def get_state (self , device_url : str ) -> list [State ]:
433433 """Retrieve states of requested device."""
434434 response = await self ._get (
435435 f"setup/devices/{ urllib .parse .quote_plus (device_url )} /states"
436436 )
437- return structure_response (response , list [State ])
437+ return converter . structure (response , list [State ])
438438
439439 @retry_on_auth_error
440440 async def refresh_states (self ) -> None :
@@ -477,7 +477,7 @@ async def fetch_events(self) -> list[Event]:
477477 operation (polling).
478478 """
479479 response = await self ._post (f"events/{ self .event_listener_id } /fetch" )
480- return structure_response (response , list [Event ])
480+ return converter . structure (response , list [Event ])
481481
482482 async def unregister_event_listener (self ) -> None :
483483 """Unregister an event listener.
@@ -497,13 +497,13 @@ async def get_current_execution(self, exec_id: str) -> Execution | None:
497497 if not response or not isinstance (response , dict ):
498498 return None
499499
500- return structure_response (response , Execution )
500+ return converter . structure (response , Execution )
501501
502502 @retry_on_auth_error
503503 async def get_current_executions (self ) -> list [Execution ]:
504504 """Get all currently running executions."""
505505 response = await self ._get ("exec/current" )
506- return structure_response (response , list [Execution ])
506+ return converter . structure (response , list [Execution ])
507507
508508 @retry_on_auth_error
509509 async def get_api_version (self ) -> str :
@@ -641,7 +641,7 @@ async def cancel_execution(self, exec_id: str) -> None:
641641 async def get_action_groups (self ) -> list [PersistedActionGroup ]:
642642 """List action groups persisted on the server."""
643643 response = await self ._get ("actionGroups" )
644- return structure_response (response , list [PersistedActionGroup ])
644+ return converter . structure (response , list [PersistedActionGroup ])
645645
646646 @retry_on_auth_error
647647 async def get_places (self ) -> Place :
@@ -656,7 +656,7 @@ async def get_places(self) -> Place:
656656 - `sub_places`: List of nested places within this location
657657 """
658658 response = await self ._get ("setup/places" )
659- return structure_response (response , Place )
659+ return converter . structure (response , Place )
660660
661661 @retry_on_auth_error
662662 async def execute_persisted_action_group (self , oid : str ) -> str :
@@ -678,7 +678,7 @@ async def get_setup_options(self) -> list[Option]:
678678 Access scope : Full enduser API access (enduser/*).
679679 """
680680 response = await self ._get ("setup/options" )
681- return structure_response (response , list [Option ])
681+ return converter . structure (response , list [Option ])
682682
683683 @retry_on_auth_error
684684 async def get_setup_option (self , option : str ) -> Option | None :
@@ -689,7 +689,7 @@ async def get_setup_option(self, option: str) -> Option | None:
689689 response = await self ._get (f"setup/options/{ option } " )
690690
691691 if response :
692- return structure_response (response , Option )
692+ return converter . structure (response , Option )
693693
694694 return None
695695
@@ -707,7 +707,7 @@ async def get_setup_option_parameter(
707707 response = await self ._get (f"setup/options/{ option } /{ parameter } " )
708708
709709 if response :
710- return structure_response (response , OptionParameter )
710+ return converter . structure (response , OptionParameter )
711711
712712 return None
713713
@@ -745,7 +745,7 @@ async def search_reference_devices(
745745 }
746746 """
747747 response = await self ._post ("reference/devices/search" , payload )
748- return structure_response (response , DeviceSearchResult )
748+ return converter . structure (response , DeviceSearchResult )
749749
750750 @retry_on_auth_error
751751 async def get_reference_protocol_types (self ) -> list [ProtocolType ]:
@@ -758,7 +758,6 @@ async def get_reference_protocol_types(self) -> list[ProtocolType]:
758758 - label: Human-readable protocol label
759759 """
760760 response = await self ._get ("reference/protocolTypes" )
761- # No decamelize — ProtocolType fields are all single-word lowercase already.
762761 return converter .structure (response , list [ProtocolType ])
763762
764763 @retry_on_auth_error
@@ -789,7 +788,7 @@ async def get_reference_ui_profile(self, profile_name: str) -> UIProfileDefiniti
789788 response = await self ._get (
790789 f"reference/ui/profile/{ urllib .parse .quote_plus (profile_name )} "
791790 )
792- return structure_response (response , UIProfileDefinition )
791+ return converter . structure (response , UIProfileDefinition )
793792
794793 @retry_on_auth_error
795794 async def get_reference_ui_profile_names (self ) -> list [str ]:
@@ -805,7 +804,7 @@ async def get_reference_ui_widgets(self) -> list[str]:
805804 async def get_devices_not_up_to_date (self ) -> list [Device ]:
806805 """Get all devices whose firmware is not up to date."""
807806 response = await self ._get ("setup/devices/notUpToDate" )
808- return structure_response (response , list [Device ])
807+ return converter . structure (response , list [Device ])
809808
810809 @retry_on_auth_error
811810 async def get_device_firmware_status (
@@ -821,7 +820,7 @@ async def get_device_firmware_status(
821820 )
822821 except UnsupportedOperationError :
823822 return None
824- return structure_response (response , FirmwareStatus )
823+ return converter . structure (response , FirmwareStatus )
825824
826825 @retry_on_auth_error
827826 async def get_device_firmware_update_capability (self , device_url : str ) -> bool :
@@ -868,7 +867,7 @@ async def get_device_controllable_definition(
868867 )
869868 if response is None :
870869 return None
871- return structure_response (response , Definition )
870+ return converter . structure (response , Definition )
872871
873872 @retry_on_auth_error
874873 async def get_device_alternative_controllables (self , device_url : str ) -> list [str ]:
@@ -885,7 +884,7 @@ async def get_device_manufacturer_references(
885884 response = await self ._get (
886885 f"setup/devices/{ urllib .parse .quote_plus (device_url )} /manufacturerReferences"
887886 )
888- return structure_response (response , list [DeviceManufacturerReference ])
887+ return converter . structure (response , list [DeviceManufacturerReference ])
889888
890889 async def _get (self , path : str ) -> Any :
891890 """Make a GET request to the OverKiz API."""
0 commit comments