@@ -145,6 +145,8 @@ async def list(
145145 end_to : datetime | None = None ,
146146 active : bool | None = None ,
147147 dry_run : bool | None = None ,
148+ dispatch_ids : Iterator [DispatchId ] = iter (()),
149+ filter_queries : Iterator [str ] = iter (()),
148150 page_size : int | None = None ,
149151 ) -> AsyncIterator [Iterator [Dispatch ]]:
150152 """List dispatches.
@@ -166,6 +168,17 @@ async def list(
166168 print(dispatch)
167169 ```
168170
171+ The `filter_queries` parameter is applied to the dispatch `id` and `type` fields.
172+ Each query in the list is applied as a logical OR.
173+
174+ ID tokens are preceded by a `#` so we can tell if an id is intended or a type.
175+
176+ - input of [`#4`] will match only the record with id of `4`
177+ - input of [`#not_an_id`] will match types containing `#not_an_id`
178+ - input of [`bar`] will match `bar` and `foobar`
179+ - input of [`#4`, `#24`, `bar`, `foo`] will match ids of `4` and `24` and
180+ types `foo` `bar` `foobar` `foolish bartender`
181+
169182 Args:
170183 microgrid_id: The microgrid_id to list dispatches for.
171184 target_components: optional, list of component ids or categories to filter by.
@@ -175,6 +188,8 @@ async def list(
175188 end_to: optional, filter by end_time < end_to.
176189 active: optional, filter by active status.
177190 dry_run: optional, filter by dry_run status.
191+ dispatch_ids: optional, list of dispatch IDs to filter by.
192+ filter_queries: optional, list of text queries to filter by.
178193 page_size: optional, number of dispatches to return per page.
179194
180195 Returns:
@@ -203,6 +218,8 @@ def to_interval(
203218 end_time_interval = end_time_interval ,
204219 is_active = active ,
205220 is_dry_run = dry_run ,
221+ dispatch_ids = list (map (int , dispatch_ids )),
222+ queries = list (filter_queries ),
206223 )
207224
208225 request = ListMicrogridDispatchesRequest (
0 commit comments