Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
add support for location field to mute timings
Browse files Browse the repository at this point in the history
  • Loading branch information
yuri-tceretian committed Dec 7, 2023
1 parent 5824b5d commit 8254bf6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions alerting_mute_timing.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type TimeInterval struct {
DaysOfMonth []DayOfMonthRange `json:"days_of_month,omitempty"`
Months []MonthRange `json:"months,omitempty"`
Years []YearRange `json:"years,omitempty"`
Location Location `json:"location,omitempty"`
}

// TimeRange represents a range of minutes within a 1440 minute day, exclusive of the End minute.
Expand All @@ -39,6 +40,9 @@ type MonthRange string
// A YearRange is a positive inclusive range of years, e.g. "2030" or "2021:2022".
type YearRange string

// A Location time zone for the time interval in IANA time zone database, e.g. "America/New_York"
type Location string

// MuteTimings fetches all mute timings.
func (c *Client) MuteTimings() ([]MuteTiming, error) {
mts := make([]MuteTiming, 0)
Expand Down
4 changes: 3 additions & 1 deletion alerting_mute_timing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func createMuteTiming() MuteTiming {
Weekdays: []WeekdayRange{"monday", "wednesday"},
Months: []MonthRange{"1:3", "4"},
Years: []YearRange{"2022", "2023"},
Location: "America/New_York",
},
},
}
Expand All @@ -122,7 +123,8 @@ const getMuteTimingsJSON = `
],
"months": [
"1"
]
],
"location": "America/New_York"
}
]
},
Expand Down

0 comments on commit 8254bf6

Please sign in to comment.