Skip to content

Commit 4e14d92

Browse files
committed
Update dispatch filter for recurrence and end time
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 92a911e commit 4e14d92

File tree

2 files changed

+60
-27
lines changed

2 files changed

+60
-27
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ In this release, we have made some changes to the API to improve the user experi
2020
* Add YEARLY frequency to the recurrence definition.
2121
* Add parameters for pagination and sorting.
2222
* Documentation of valid values for `count` and `interval` fields was added.
23+
* Extended filter parameters for recurrence and end time.
2324

2425
## Bug Fixes
2526

proto/frequenz/api/dispatch/v1/dispatch.proto

Lines changed: 59 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,68 @@ message DispatchDetail {
151151

152152
// Filter parameter for specifying multiple time intervals
153153
message TimeIntervalFilter {
154-
// Filter by start_time >= this timestamp
155-
google.protobuf.Timestamp start_from = 1;
154+
// Filter by time >= this timestamp.
155+
google.protobuf.Timestamp from = 1;
156156

157-
// Filter by start_time < this timestamp
158-
google.protobuf.Timestamp start_to = 2;
157+
// Filter by time < this timestamp.
158+
google.protobuf.Timestamp to = 2;
159+
}
160+
161+
// Parameters for filtering the dispatch list
162+
message DispatchFilter {
163+
message RecurrenceFilter {
164+
// Filter by recurring status
165+
// True: Only recurring dispatches will be returned.
166+
// False: Only non-recurring dispatches will be returned.
167+
// Unset: Both recurring and non-recurring dispatches will be returned,
168+
// recurring dispatches will be filtered based on the recurrence
169+
// filter, while non-recurring dispatches will be returned regardless.
170+
// Examples:
171+
// - To retrieve only recurring dispatches:
172+
// filter { recurrence_filter { is_recurring: true } }
173+
// - To retrieve only non-recurring dispatches:
174+
// filter { recurrence_filter { is_recurring: false } }
175+
// - To retrieve all dispatches:
176+
// filter { recurrence_filter {} }
177+
// - To retrieve only recurring dispatches with a specific frequency:
178+
// filter { recurrence_filter { is_recurring: true, freq: [FREQUENCY_DAILY] } }
179+
// - To retrieve only recurring dispatches with a specific frequency but
180+
// also include non-recurring dispatches:
181+
// filter { recurrence_filter { freq: [FREQUENCY_DAILY] } }
182+
183+
// - only_recurring = true: Only recurring dispatches will be returned.
184+
optional bool is_recurring = 1;
185+
186+
// Filter by frequency
187+
// If not specified, all frequencies will be returned.
188+
repeated RecurrenceRule.Frequency freqs = 2;
189+
}
190+
191+
// Optional filter by component ID or category.
192+
repeated ComponentSelector selectors = 1;
193+
194+
// Optional filter by active status.
195+
// If this field is not set, dispatches of any active status will be included.
196+
optional bool is_active = 2;
197+
198+
// Optional filter by dry run status.
199+
// If this field is not set, dispatches of any dry run status will be included.
200+
optional bool is_dry_run = 3;
201+
202+
// Optional recurrence filter
203+
// If not specified both types will be returned.
204+
RecurrenceFilter recurrence_filter = 4;
159205

160-
// Filter by recurrence.end_criteria.until >= this timestamp
161-
google.protobuf.Timestamp end_from = 3;
206+
// Optional filter by start time.
207+
// If no interval is provided, all dispatches will be returned.
208+
TimeIntervalFilter start_time_interval = 5;
162209

163-
// Filter by recurrence.end_criteria.until < this timestamp
164-
google.protobuf.Timestamp end_to = 4;
210+
// Optional filter by end time
211+
// Filter dispatches based on their explicit end time.
212+
TimeIntervalFilter end_time_interval = 6;
213+
214+
// Optional filter by update time
215+
TimeIntervalFilter update_time_interval = 7;
165216
}
166217

167218
// Parameter for controlling which components a dispatch applies to
@@ -371,25 +422,6 @@ message ListMicrogridDispatchesRequest {
371422
frequenz.api.common.v1.pagination.PaginationParams pagination_params = 4;
372423
}
373424

374-
// Parameters for filtering the dispatch list
375-
message DispatchFilter {
376-
// Filter by component ID or category
377-
repeated ComponentSelector selectors = 1;
378-
379-
// Filter by time interval
380-
// If no interval is provided, all dispatches starting from the
381-
// current timestamp will be included.
382-
TimeIntervalFilter time_interval = 2;
383-
384-
// Filter by active status
385-
// If this field is not set, dispatches of any active status will be included.
386-
optional bool is_active = 3;
387-
388-
// Filter by dry run status
389-
// If this field is not set, dispatches of any dry run status will be included.
390-
optional bool is_dry_run = 4;
391-
}
392-
393425
// A list of dispatches
394426
message ListMicrogridDispatchesResponse {
395427
// The dispatches

0 commit comments

Comments
 (0)