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

Fix #156 no 6 Support get number of sent broadcast messages. #169

Merged
merged 1 commit into from
Jul 9, 2019
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 examples/delivery_helper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ func main() {
res, err = bot.GetNumberPushMessages(*date).Do()
case "reply":
res, err = bot.GetNumberReplyMessages(*date).Do()
case "broadcast":
res, err = bot.GetNumberBroadcastMessages(*date).Do()
default:
log.Fatal("implement me")
}
Expand Down
10 changes: 10 additions & 0 deletions linebot/delivery.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const (
DeliveryTypeMulticast DeliveryType = "multicast"
DeliveryTypePush DeliveryType = "push"
DeliveryTypeReply DeliveryType = "reply"
DeliveryTypeBroadcast DeliveryType = "broadcast"
)

// GetNumberReplyMessages method
Expand Down Expand Up @@ -57,6 +58,15 @@ func (client *Client) GetNumberMulticastMessages(date string) *GetNumberMessages
}
}

// GetNumberBroadcastMessages method
func (client *Client) GetNumberBroadcastMessages(date string) *GetNumberMessagesCall {
return &GetNumberMessagesCall{
c: client,
date: date,
deliveryType: DeliveryTypeBroadcast,
}
}

// GetNumberMessagesCall type
type GetNumberMessagesCall struct {
c *Client
Expand Down
6 changes: 4 additions & 2 deletions linebot/delivery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"testing"
)

// TestGetNumberMessages tests GetNumberReplyMessages, GetNumberPushMessages
// and GetNumberMulticastMessages func
// TestGetNumberMessages tests GetNumberReplyMessages, GetNumberPushMessages, GetNumberMulticastMessages
// and GetNumberBroadcastMessages func
func TestGetNumberMessages(t *testing.T) {
type want struct {
URLPath string
Expand Down Expand Up @@ -125,6 +125,8 @@ func TestGetNumberMessages(t *testing.T) {
res, err = client.GetNumberPushMessages(tc.Date).Do()
case DeliveryTypeReply:
res, err = client.GetNumberReplyMessages(tc.Date).Do()
case DeliveryTypeBroadcast:
res, err = client.GetNumberBroadcastMessages(tc.Date).Do()
}
if tc.Want.Error != nil {
if !reflect.DeepEqual(err, tc.Want.Error) {
Expand Down