From 87de1f734d4ebdfc55ed3de1969cfcd462d40dcc Mon Sep 17 00:00:00 2001 From: Matt Dzwonczyk <9063128+mattgd@users.noreply.github.com> Date: Thu, 11 Apr 2024 15:03:24 -0400 Subject: [PATCH] Make events parameter required for ListEvents (#325) * Make events parameter required for ListEvents. * Fix formatting. * Bump minor version. * Undo version bump. --- pkg/events/client.go | 2 +- pkg/events/client_test.go | 6 +++++- pkg/events/events_test.go | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pkg/events/client.go b/pkg/events/client.go index e0f9cb9f..c4377aa9 100644 --- a/pkg/events/client.go +++ b/pkg/events/client.go @@ -89,7 +89,7 @@ type Event struct { // ListEventsOpts contains the options to request provisioned Events. type ListEventsOpts struct { // Filter to only return Events of particular types. - Events []string `url:"events,omitempty"` + Events []string `url:"events"` // Maximum number of records to return. Limit int `url:"limit"` diff --git a/pkg/events/client_test.go b/pkg/events/client_test.go index b2274595..1acfd1e3 100644 --- a/pkg/events/client_test.go +++ b/pkg/events/client_test.go @@ -36,7 +36,10 @@ func TestListEvents(t *testing.T) { }, } - events, err := client.ListEvents(context.Background(), ListEventsOpts{}) + params := ListEventsOpts{ + Events: []string{"dsync.user.created"}, + } + events, err := client.ListEvents(context.Background(), params) require.NoError(t, err) require.Equal(t, expectedResponse, events) @@ -56,6 +59,7 @@ func TestListEvents(t *testing.T) { rangeEnd := currentTime.AddDate(0, 0, -1) params := ListEventsOpts{ + Events: []string{"dsync.user.created"}, RangeStart: rangeStart.String(), RangeEnd: rangeEnd.String(), } diff --git a/pkg/events/events_test.go b/pkg/events/events_test.go index 3a045201..4f7760b0 100644 --- a/pkg/events/events_test.go +++ b/pkg/events/events_test.go @@ -21,6 +21,10 @@ func TestEventsListEvents(t *testing.T) { } SetAPIKey("test") + params := ListEventsOpts{ + Events: []string{"dsync.user.created"}, + } + expectedResponse := ListEventsResponse{ Data: []Event{ { @@ -33,7 +37,7 @@ func TestEventsListEvents(t *testing.T) { After: "", }, } - eventsResponse, err := ListEvents(context.Background(), ListEventsOpts{}) + eventsResponse, err := ListEvents(context.Background(), params) require.NoError(t, err) require.Equal(t, expectedResponse, eventsResponse)