Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add suspendedAt to Channels API #151

Merged
merged 1 commit into from
Dec 20, 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
2 changes: 2 additions & 0 deletions channels.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ type Channel struct {
Name string `json:"name"`
Type string `json:"type"`

SuspendedAt *int64 `json:"suspendedAt,omitempty"`

// Exists when the type is "email"
Emails *[]string `json:"emails,omitempty"`
UserIDs *[]string `json:"userIds,omitempty"`
Expand Down
19 changes: 16 additions & 3 deletions channels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ func TestFindChannels(t *testing.T) {
"events": []string{"alertGroup"},
},
{
"id": "defabcdef",
"name": "line channel",
"type": "line",
"id": "defabcdef",
"name": "line channel",
"type": "line",
"suspendedAt": 12345678,
},
},
})
Expand Down Expand Up @@ -112,6 +113,18 @@ func TestFindChannels(t *testing.T) {
if channels[3].Type != "line" {
t.Error("request has Type but: ", channels[3].Type)
}
if channels[0].SuspendedAt != nil {
t.Error("request has SuspendedAt but: ", channels[0].SuspendedAt)
}
if channels[1].SuspendedAt != nil {
t.Error("request has SuspendedAt but: ", channels[1].SuspendedAt)
}
if channels[2].SuspendedAt != nil {
t.Error("request has SuspendedAt but: ", channels[2].SuspendedAt)
}
if *channels[3].SuspendedAt != 12345678 {
t.Error("request has SuspendedAt but: ", *channels[3].SuspendedAt)
}
if reflect.DeepEqual(*(channels[0].Emails), []string{"[email protected]", "[email protected]"}) != true {
t.Errorf("Wrong data for emails: %v", *(channels[0].Emails))
}
Expand Down