From eb7fef47e6da711ee8d046d08263a56ae87a45e1 Mon Sep 17 00:00:00 2001 From: Allison Maheu Date: Mon, 6 Jan 2020 10:04:35 -0600 Subject: [PATCH] Implemented feedback from @xvello --- datadog-accessors.go | 33 ++++++++++++++++++++++++++++++++- log_lists.go | 3 ++- log_lists_test.go | 2 ++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/datadog-accessors.go b/datadog-accessors.go index 77cfaf9..83353bc 100644 --- a/datadog-accessors.go +++ b/datadog-accessors.go @@ -4,7 +4,7 @@ * * Please see the included LICENSE file for licensing information. * - * Copyright 2019 by authors and contributors. + * Copyright 2020 by authors and contributors. */ package datadog @@ -15173,6 +15173,37 @@ func (q *QueryTableRequest) SetProcessQuery(v WidgetProcessQuery) { q.ProcessQuery = &v } +// GetOffset returns the Offset field if non-nil, zero value otherwise. +func (q *QueryTime) GetOffset() int { + if q == nil || q.Offset == nil { + return 0 + } + return *q.Offset +} + +// GetOffsetOk returns a tuple with the Offset field if it's non-nil, zero value otherwise +// and a boolean to check if the value has been set. +func (q *QueryTime) GetOffsetOk() (int, bool) { + if q == nil || q.Offset == nil { + return 0, false + } + return *q.Offset, true +} + +// HasOffset returns a boolean if a field has been set. +func (q *QueryTime) HasOffset() bool { + if q != nil && q.Offset != nil { + return true + } + + return false +} + +// SetOffset allocates a new q.Offset and returns the pointer to it. +func (q *QueryTime) SetOffset(v int) { + q.Offset = &v +} + // GetTimeFrom returns the TimeFrom field if non-nil, zero value otherwise. func (q *QueryTime) GetTimeFrom() string { if q == nil || q.TimeFrom == nil { diff --git a/log_lists.go b/log_lists.go index 6edfbdb..d668f3e 100644 --- a/log_lists.go +++ b/log_lists.go @@ -21,6 +21,7 @@ type QueryTime struct { TimeFrom *string `json:"from"` TimeTo *string `json:"to"` TimeZone *string `json:"timezone,omitempty"` + Offset *int `json:"offset,omitempty"` } // LogsList represents the base API response returned by the list API @@ -74,7 +75,7 @@ func (client *Client) GetLogsListPages(logsRequest *LogsListRequest) (logs []Log response, err := client.GetLogsList(logsRequest) if err != nil { - return response.Logs, err + return nil, err } logs = append(logs, response.Logs...) diff --git a/log_lists_test.go b/log_lists_test.go index 8b36e30..64f15f8 100644 --- a/log_lists_test.go +++ b/log_lists_test.go @@ -53,6 +53,8 @@ func TestGetLogsListPages(t *testing.T) { assert.Nil(err) w.Write(response) } else { + assert.Equal(*responseBody.StartAt, "BBBBBWgN8Xwgr1vKDQAAAABBV2dOOFh3ZzZobm1mWXJFYTR0OA") + response, err := ioutil.ReadFile("./tests/fixtures/logs/loglist_page_response.json") assert.Nil(err)