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

Make events parameter required for ListEvents #325

Merged
Merged
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: 1 addition & 1 deletion pkg/events/client.go
Original file line number Diff line number Diff line change
@@ -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"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PaulAsjes While this change is breaking in the API (mitigated by feature flag for affected customers), I don't consider this is a breaking change in the Go SDK, so a minor bump seems appropriate. Wanted to double check to see if you had an opinion though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, minor bump seems fine!


// Maximum number of records to return.
Limit int `url:"limit"`
6 changes: 5 additions & 1 deletion pkg/events/client_test.go
Original file line number Diff line number Diff line change
@@ -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(),
}
6 changes: 5 additions & 1 deletion pkg/events/events_test.go
Original file line number Diff line number Diff line change
@@ -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)