@@ -78,6 +78,9 @@ message Dispatch {
7878
7979 // The dispatch payload
8080 google.protobuf.Struct payload = 11 ;
81+
82+ // The recurrence rule
83+ RecurrenceRule recurrence = 12 ;
8184}
8285
8386// Filter parameter for specifying multiple time intervals
@@ -113,6 +116,98 @@ message DispatchComponentIDs {
113116 repeated uint64 component_ids = 1 ;
114117}
115118
119+ // Ruleset governing when and how a dispatch should re-occur
120+ //
121+ // This definition tries to adhere closely to the iCalendar specification (RFC 5545),
122+ // particularly for recurrence rules. For advanced use-cases or further clarifications,
123+ // refer to RFC 5545.
124+ //
125+ // Examples:
126+ //
127+ // Every 6 months:
128+ // ```
129+ // message RecurrenceRule {
130+ // Frequency freq = FREQUENCY_MONTHLY;
131+ // uint32 interval = 6;
132+ // }
133+ // ```
134+ //
135+ // Weekends only:
136+ // ```
137+ // message RecurrenceRule {
138+ // Frequency freq = FREQUENCY_WEEKLY;
139+ // repeated Weekday byweekdays = [WEEKDAY_SATURDAY, WEEKDAY_SUNDAY];
140+ // }
141+ // ```
142+ //
143+ // Every day at midnight:
144+ // ```
145+ // message RecurrenceRule {
146+ // Frequency freq = FREQUENCY_DAILY;
147+ // repeated uint32 byhours = [0];
148+ // }
149+ // ```
150+ //
151+ // Nightly, assuming "night" means from 8 PM to 6 AM:
152+ // ```
153+ // message RecurrenceRule {
154+ // Frequency freq = FREQUENCY_DAILY;
155+ // repeated uint32 byhours = [20, 21, 22, 23, 0, 1, 2, 3, 4, 5];
156+ // }
157+ // ```
158+ message RecurrenceRule {
159+ // Enum representing the day of the week
160+ enum Weekday {
161+ WEEKDAY_UNSPECIFIED = 0 ;
162+ WEEKDAY_MONDAY = 1 ;
163+ WEEKDAY_TUESDAY = 2 ;
164+ WEEKDAY_WEDNESDAY = 3 ;
165+ WEEKDAY_THURSDAY = 4 ;
166+ WEEKDAY_FRIDAY = 5 ;
167+ WEEKDAY_SATURDAY = 6 ;
168+ WEEKDAY_SUNDAY = 7 ;
169+ }
170+
171+ // Enum representing the frequency of the recurrence
172+ enum Frequency {
173+ FREQUENCY_UNSPECIFIED = 0 ;
174+ FREQUENCY_MINUTELY = 1 ;
175+ FREQUENCY_HOURLY = 2 ;
176+ FREQUENCY_DAILY = 3 ;
177+ FREQUENCY_WEEKLY = 4 ;
178+ FREQUENCY_MONTHLY = 5 ;
179+ }
180+
181+ // The frequency specifier of this recurring dispatch
182+ Frequency freq = 1 ;
183+
184+ // How often this dispatch should recur, based on the frequency
185+ // Example:
186+ // - Every 2 hours:
187+ // freq = FREQUENCY_HOURLY
188+ // interval = 2
189+ uint32 interval = 2 ;
190+
191+ // (Optional) limit the number of occurences
192+ // If this field is not set, the dispatch will recur indefinitely
193+ optional uint32 count = 3 ;
194+
195+ // On which minute(s) of the hour does the event occur
196+ repeated uint32 byminutes = 4 ;
197+
198+ // On which hour(s) of the day does the event occur
199+ repeated uint32 byhours = 5 ;
200+
201+ // On which day(s) of the week does the event occur
202+ repeated Weekday byweekdays = 6 ;
203+
204+ // On which day(s) of the month does the event occur
205+ repeated uint32 bymonthdays = 7 ;
206+
207+ // On which month(s) of the year does the event occur
208+ repeated uint32 bymonths = 8 ;
209+ }
210+
116211// Message for listing dispatches for a given microgrid, and an optional filter
117212message DispatchListRequest {
118213 // The microgrid ID
@@ -167,6 +262,9 @@ message DispatchCreateRequest {
167262
168263 // The dispatch payload
169264 google.protobuf.Struct payload = 8 ;
265+
266+ // The recurrence rule
267+ RecurrenceRule recurrence = 9 ;
170268}
171269
172270// Message to update the dispatch with the given ID, with the given attributes
@@ -194,6 +292,9 @@ message DispatchUpdateRequest {
194292
195293 // The dispatch payload
196294 google.protobuf.Struct payload = 7 ;
295+
296+ // The recurrence rule
297+ RecurrenceRule recurrence = 8 ;
197298}
198299
199300// Message to get a single dispatch by its ID
0 commit comments