From d2d93f4b0265c2e73e5bb66484a9c83d4266000d Mon Sep 17 00:00:00 2001 From: Eric Byers Date: Fri, 11 Jan 2019 10:33:28 -0600 Subject: [PATCH 1/2] Adding unaggregated parameter --- events.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/events.go b/events.go index 0aeedef..392c0e6 100644 --- a/events.go +++ b/events.go @@ -62,11 +62,12 @@ func (client *Client) GetEvent(id int) (*Event, error) { // QueryEvents returns a slice of events from the query stream. func (client *Client) GetEvents(start, end int, - priority, sources, tags string) ([]Event, error) { + priority, sources, tags string, unaggregated bool) ([]Event, error) { // Since this is a GET request, we need to build a query string. vals := url.Values{} vals.Add("start", strconv.Itoa(start)) vals.Add("end", strconv.Itoa(end)) + vals.Add("unaggregated", strconv.FormatBool(unaggregated)) if priority != "" { vals.Add("priority", priority) } From a3fc2d1ccdbf9a174e1a25d03581608ed2d08a0e Mon Sep 17 00:00:00 2001 From: Eric Byers Date: Fri, 11 Jan 2019 10:49:38 -0600 Subject: [PATCH 2/2] Switching unaggregated to be variadic to prevent backwards compatible breakage. --- events.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/events.go b/events.go index 392c0e6..27fe2fc 100644 --- a/events.go +++ b/events.go @@ -61,13 +61,19 @@ func (client *Client) GetEvent(id int) (*Event, error) { } // QueryEvents returns a slice of events from the query stream. +// unaggregated was added on as variadic to allow a non-breaking change. +// if addtional parameters are needed this will need to be changed to a struct input or fully variadic. func (client *Client) GetEvents(start, end int, - priority, sources, tags string, unaggregated bool) ([]Event, error) { + priority, sources, tags string, unaggregated ...bool) ([]Event, error) { // Since this is a GET request, we need to build a query string. vals := url.Values{} vals.Add("start", strconv.Itoa(start)) vals.Add("end", strconv.Itoa(end)) - vals.Add("unaggregated", strconv.FormatBool(unaggregated)) + + if len(unaggregated) > 0 { + vals.Add("unaggregated", strconv.FormatBool(unaggregated[0])) + } + if priority != "" { vals.Add("priority", priority) }