From f61a619039363e47fc02e4f2aa9357e79103f9b9 Mon Sep 17 00:00:00 2001 From: Praveen Ramalingam Date: Sat, 28 Mar 2020 18:32:50 -0700 Subject: [PATCH 1/3] Adding unaggregated parameter to events.GetEvents Implement @bkabrda suggestion from #203 to add support for querying unaggregated query param --- events.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/events.go b/events.go index 47e3ebf..d1ce303 100644 --- a/events.go +++ b/events.go @@ -63,6 +63,12 @@ func (client *Client) GetEvent(id int) (*Event, error) { // GetEvents returns a slice of events from the query stream. func (client *Client) GetEvents(start, end int, priority, sources, tags string) ([]Event, error) { + return GetEventsWithAggregation(start, end, priority, sources, tags, false) +} + +// GetEvents returns a slice of events from the query stream. +func (client *Client) GetEventsWithAggregation(start, end int, + 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)) @@ -76,6 +82,9 @@ func (client *Client) GetEvents(start, end int, if tags != "" { vals.Add("tags", tags) } + if unaggregated { + vals.Add("unaggregated", "true") + } // Now the request and response. var out reqGetEvents From a5d204c9881eee51e821afa0ba39a0f35c22cfca Mon Sep 17 00:00:00 2001 From: Praveen Ramalingam Date: Sat, 28 Mar 2020 18:36:37 -0700 Subject: [PATCH 2/3] Updated func comments --- events.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/events.go b/events.go index d1ce303..eb76ee9 100644 --- a/events.go +++ b/events.go @@ -60,13 +60,13 @@ func (client *Client) GetEvent(id int) (*Event, error) { return out.Event, nil } -// GetEvents returns a slice of events from the query stream. +// GetEvents returns aggregated events from the query stream. func (client *Client) GetEvents(start, end int, priority, sources, tags string) ([]Event, error) { return GetEventsWithAggregation(start, end, priority, sources, tags, false) } -// GetEvents returns a slice of events from the query stream. +// GetEventsWithAggregation returns a slice of events from the query stream. func (client *Client) GetEventsWithAggregation(start, end int, priority, sources, tags string, unaggregated bool) ([]Event, error) { // Since this is a GET request, we need to build a query string. From f37aefcd660280137c6e274ce91cc7c05514cb1e Mon Sep 17 00:00:00 2001 From: Praveen Ramalingam Date: Sat, 28 Mar 2020 18:56:47 -0700 Subject: [PATCH 3/3] fix broken call --- events.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/events.go b/events.go index eb76ee9..1f84b39 100644 --- a/events.go +++ b/events.go @@ -63,7 +63,7 @@ func (client *Client) GetEvent(id int) (*Event, error) { // GetEvents returns aggregated events from the query stream. func (client *Client) GetEvents(start, end int, priority, sources, tags string) ([]Event, error) { - return GetEventsWithAggregation(start, end, priority, sources, tags, false) + return client.GetEventsWithAggregation(start, end, priority, sources, tags, false) } // GetEventsWithAggregation returns a slice of events from the query stream.