@@ -18,6 +18,8 @@ import "google/protobuf/struct.proto";
1818import "google/protobuf/timestamp.proto" ;
1919
2020import "frequenz/api/common/v1/microgrid/components/components.proto" ;
21+ import "frequenz/api/common/v1/pagination/pagination_info.proto" ;
22+ import "frequenz/api/common/v1/pagination/pagination_params.proto" ;
2123
2224// Service providing operations related to dispatching microgrid components.
2325//
@@ -307,13 +309,64 @@ message RecurrenceRule {
307309 repeated uint32 bymonths = 8 ;
308310}
309311
310- // Message for listing dispatches for a given microgrid, and an optional filter
312+ // Enum for the fields to by sorted by.
313+ enum SortField {
314+ // UNSPECIFIED: Default, unspecified sort field.
315+ SORT_FIELD_UNSPECIFIED = 0 ;
316+
317+ // START_TIME: Sort by start time of the dispatch.
318+ SORT_FIELD_START_TIME = 1 ;
319+
320+ // CREATE_TIME: Sort by creation time of the dispatch.
321+ SORT_FIELD_CREATE_TIME = 2 ;
322+
323+ // UPDATE_TIME: Sort by last update time of the dispatch.
324+ SORT_FIELD_LAST_UPDATE_TIME = 3 ;
325+ }
326+
327+ // Enum for sort order.
328+ enum SortOrder {
329+ // UNSPECIFIED: Default, unspecified sort order.
330+ SORT_ORDER_UNSPECIFIED = 0 ;
331+
332+ // ASCENDING: Results are returned in ascending order.
333+ SORT_ORDER_ASCENDING = 1 ;
334+
335+ // DESCENDING: Results are returned in descending order.
336+ SORT_ORDER_DESCENDING = 2 ;
337+ }
338+
339+ // Message defining parameters for sorting list requests.
340+ //
341+ // Example Usage:
342+ // To retrieve dispatches sorted by creation time in descending order:
343+ // sort_options: { field: CREATE_TIME, order: DESCENDING }
344+ //
345+ message SortOptions {
346+ // Optional field by which to sort the results.
347+ SortField sort_field = 1 ;
348+
349+ // Optional Order in which to sort the results.
350+ SortOrder sort_order = 2 ;
351+ }
352+
353+ // Message for listing dispatches for a given microgrid.
354+ //
355+ // Allows retrieval of dispatches for a specified microgrid with optional filtering and sorting.
356+ // Sorting can be specified by setting 'sort_field' and 'sort_order'. If no sorting is specified,
357+ // the results will be returned by their create time in a descending order.
311358message ListMicrogridDispatchesRequest {
312359 // The microgrid ID
313360 uint64 microgrid_id = 1 ;
314361
315- // Additional filter parameters
362+ // Optional filters to apply
316363 DispatchFilter filter = 2 ;
364+
365+ // Sorting options for the result
366+ SortOptions sort_options = 3 ;
367+
368+ // Pagination parameters
369+ frequenz.api.common.v1.pagination.PaginationParams pagination_params = 4 ;
317370}
318371
319372// Parameters for filtering the dispatch list
@@ -339,6 +392,9 @@ message DispatchFilter {
339392message ListMicrogridDispatchesResponse {
340393 // The dispatches
341394 repeated DispatchDetail dispatches = 1 ;
395+
396+ // Pagination parameters
397+ frequenz.api.common.v1.pagination.PaginationParams pagination_params = 4 ;
342398}
343399
344400// Message to create a new dispatch with the given attributes
0 commit comments