1414from frequenz .api .assets .v1 import assets_pb2 , assets_pb2_grpc
1515from frequenz .client .base import channel
1616from frequenz .client .base .client import BaseApiClient , call_stub_method
17+ from frequenz .client .common .microgrid import MicrogridId
1718
1819from ._microgrid import Microgrid
1920from ._microgrid_proto import microgrid_from_proto
@@ -87,7 +88,7 @@ def stub(self) -> assets_pb2_grpc.PlatformAssetsAsyncStub:
8788 return self ._stub # type: ignore
8889
8990 async def get_microgrid ( # noqa: DOC502 (raises ApiClientError indirectly)
90- self , microgrid_id : int
91+ self , microgrid_id : MicrogridId
9192 ) -> Microgrid :
9293 """
9394 Get the details of a microgrid.
@@ -105,7 +106,7 @@ async def get_microgrid( # noqa: DOC502 (raises ApiClientError indirectly)
105106 response = await call_stub_method (
106107 self ,
107108 lambda : self .stub .GetMicrogrid (
108- assets_pb2 .GetMicrogridRequest (microgrid_id = microgrid_id ),
109+ assets_pb2 .GetMicrogridRequest (microgrid_id = int ( microgrid_id ) ),
109110 timeout = DEFAULT_GRPC_CALL_TIMEOUT ,
110111 ),
111112 method_name = "GetMicrogrid" ,
@@ -114,7 +115,7 @@ async def get_microgrid( # noqa: DOC502 (raises ApiClientError indirectly)
114115 return microgrid_from_proto (response .microgrid )
115116
116117 async def list_microgrid_electrical_components (
117- self , microgrid_id : int
118+ self , microgrid_id : MicrogridId
118119 ) -> list [ElectricalComponent ]:
119120 """
120121 Get the electrical components of a microgrid.
@@ -129,7 +130,7 @@ async def list_microgrid_electrical_components(
129130 self ,
130131 lambda : self .stub .ListMicrogridElectricalComponents (
131132 assets_pb2 .ListMicrogridElectricalComponentsRequest (
132- microgrid_id = microgrid_id ,
133+ microgrid_id = int ( microgrid_id ) ,
133134 ),
134135 timeout = DEFAULT_GRPC_CALL_TIMEOUT ,
135136 ),
@@ -142,7 +143,7 @@ async def list_microgrid_electrical_components(
142143
143144 async def list_microgrid_electrical_component_connections (
144145 self ,
145- microgrid_id : int ,
146+ microgrid_id : MicrogridId ,
146147 source_component_ids : Iterable [int ] = (),
147148 destination_component_ids : Iterable [int ] = (),
148149 ) -> list [ComponentConnection | None ]:
@@ -161,7 +162,7 @@ async def list_microgrid_electrical_component_connections(
161162 The electrical component connections of the microgrid.
162163 """
163164 request = assets_pb2 .ListMicrogridElectricalComponentConnectionsRequest (
164- microgrid_id = microgrid_id ,
165+ microgrid_id = int ( microgrid_id ) ,
165166 source_component_ids = source_component_ids ,
166167 destination_component_ids = destination_component_ids ,
167168 )
0 commit comments