From 7d5fb77863e359a5b2bafdd32226fdb416541fd7 Mon Sep 17 00:00:00 2001 From: yohfee Date: Mon, 18 Dec 2023 15:43:36 +0900 Subject: [PATCH] Add suspendedAt to Channels API --- channels.go | 2 ++ channels_test.go | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/channels.go b/channels.go index cabec29..a411828 100644 --- a/channels.go +++ b/channels.go @@ -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"` diff --git a/channels_test.go b/channels_test.go index 0275770..0a734f4 100644 --- a/channels_test.go +++ b/channels_test.go @@ -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, }, }, }) @@ -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{"test@example.com", "test2@example.com"}) != true { t.Errorf("Wrong data for emails: %v", *(channels[0].Emails)) }