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

Add support for location field to mute timings #176

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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