Skip to content

Commit

Permalink
apply fixDates in-place on List results
Browse files Browse the repository at this point in the history
  • Loading branch information
displague committed Sep 6, 2018
1 parent fac5aa1 commit 033e138
Show file tree
Hide file tree
Showing 17 changed files with 36 additions and 36 deletions.
4 changes: 2 additions & 2 deletions account_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ func (resp *EventsPagedResponse) appendData(r *EventsPagedResponse) {
func (c *Client) ListEvents(ctx context.Context, opts *ListOptions) ([]Event, error) {
response := EventsPagedResponse{}
err := c.listHelper(ctx, &response, opts)
for _, el := range response.Data {
el.fixDates()
for i := range response.Data {
response.Data[i].fixDates()
}
if err != nil {
return nil, err
Expand Down
8 changes: 4 additions & 4 deletions account_invoices.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ func (resp *InvoicesPagedResponse) appendData(r *InvoicesPagedResponse) {
func (c *Client) ListInvoices(ctx context.Context, opts *ListOptions) ([]Invoice, error) {
response := InvoicesPagedResponse{}
err := c.listHelper(ctx, &response, opts)
for _, el := range response.Data {
el.fixDates()
for i := range response.Data {
response.Data[i].fixDates()
}
if err != nil {
return nil, err
Expand Down Expand Up @@ -115,8 +115,8 @@ func (resp *InvoiceItemsPagedResponse) appendData(r *InvoiceItemsPagedResponse)
func (c *Client) ListInvoiceItems(ctx context.Context, id int, opts *ListOptions) ([]InvoiceItem, error) {
response := InvoiceItemsPagedResponse{}
err := c.listHelperWithID(ctx, &response, id, opts)
for _, el := range response.Data {
el.fixDates()
for i := range response.Data {
response.Data[i].fixDates()
}
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions account_notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ func (resp *NotificationsPagedResponse) appendData(r *NotificationsPagedResponse
func (c *Client) ListNotifications(ctx context.Context, opts *ListOptions) ([]Notification, error) {
response := NotificationsPagedResponse{}
err := c.listHelper(ctx, &response, opts)
for _, el := range response.Data {
el.fixDates()
for i := range response.Data {
response.Data[i].fixDates()
}
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions images.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ func (resp *ImagesPagedResponse) appendData(r *ImagesPagedResponse) {
func (c *Client) ListImages(ctx context.Context, opts *ListOptions) ([]Image, error) {
response := ImagesPagedResponse{}
err := c.listHelper(ctx, &response, opts)
for _, el := range response.Data {
el.fixDates()
for i := range response.Data {
response.Data[i].fixDates()
}
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions instance_configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ func (resp *InstanceConfigsPagedResponse) appendData(r *InstanceConfigsPagedResp
func (c *Client) ListInstanceConfigs(ctx context.Context, linodeID int, opts *ListOptions) ([]InstanceConfig, error) {
response := InstanceConfigsPagedResponse{}
err := c.listHelperWithID(ctx, &response, linodeID, opts)
for _, el := range response.Data {
el.fixDates()
for i := range response.Data {
response.Data[i].fixDates()
}
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions instance_disks.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ func (resp *InstanceDisksPagedResponse) appendData(r *InstanceDisksPagedResponse
func (c *Client) ListInstanceDisks(ctx context.Context, linodeID int, opts *ListOptions) ([]InstanceDisk, error) {
response := InstanceDisksPagedResponse{}
err := c.listHelperWithID(ctx, &response, linodeID, opts)
for _, el := range response.Data {
el.fixDates()
for i := range response.Data {
response.Data[i].fixDates()
}
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions instance_snapshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ func (l *InstanceBackupSnapshotResponse) fixDates() *InstanceBackupSnapshotRespo
}

func (l *InstanceBackupsResponse) fixDates() *InstanceBackupsResponse {
for _, el := range l.Automatic {
el.fixDates()
for i := range l.Automatic {
l.Automatic[i].fixDates()
}
if l.Snapshot != nil {
l.Snapshot.fixDates()
Expand Down
4 changes: 2 additions & 2 deletions instance_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ func (resp *InstanceVolumesPagedResponse) appendData(r *InstanceVolumesPagedResp
func (c *Client) ListInstanceVolumes(ctx context.Context, linodeID int, opts *ListOptions) ([]Volume, error) {
response := InstanceVolumesPagedResponse{}
err := c.listHelperWithID(ctx, &response, linodeID, opts)
for _, el := range response.Data {
el.fixDates()
for i := range response.Data {
response.Data[i].fixDates()
}
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ func (resp *InstancesPagedResponse) appendData(r *InstancesPagedResponse) {
func (c *Client) ListInstances(ctx context.Context, opts *ListOptions) ([]Instance, error) {
response := InstancesPagedResponse{}
err := c.listHelper(ctx, &response, opts)
for _, el := range response.Data {
el.fixDates()
for i := range response.Data {
response.Data[i].fixDates()
}
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions longview.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func (resp *LongviewClientsPagedResponse) appendData(r *LongviewClientsPagedResp
func (c *Client) ListLongviewClients(ctx context.Context, opts *ListOptions) ([]LongviewClient, error) {
response := LongviewClientsPagedResponse{}
err := c.listHelper(ctx, &response, opts)
for _, el := range response.Data {
el.fixDates()
for i := range response.Data {
response.Data[i].fixDates()
}
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions longview_subscriptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ func (resp *LongviewSubscriptionsPagedResponse) appendData(r *LongviewSubscripti
func (c *Client) ListLongviewSubscriptions(ctx context.Context, opts *ListOptions) ([]LongviewSubscription, error) {
response := LongviewSubscriptionsPagedResponse{}
err := c.listHelper(ctx, &response, opts)
for _, el := range response.Data {
el.fixDates()
for i := range response.Data {
response.Data[i].fixDates()
}
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions nodebalancer_config_nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ func (resp *NodeBalancerNodesPagedResponse) appendData(r *NodeBalancerNodesPaged
func (c *Client) ListNodeBalancerNodes(ctx context.Context, nodebalancerID int, configID int, opts *ListOptions) ([]NodeBalancerNode, error) {
response := NodeBalancerNodesPagedResponse{}
err := c.listHelperWithTwoIDs(ctx, &response, nodebalancerID, configID, opts)
for _, el := range response.Data {
el.fixDates()
for i := range response.Data {
response.Data[i].fixDates()
}
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions nodebalancer_configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ func (resp *NodeBalancerConfigsPagedResponse) appendData(r *NodeBalancerConfigsP
func (c *Client) ListNodeBalancerConfigs(ctx context.Context, nodebalancerID int, opts *ListOptions) ([]NodeBalancerConfig, error) {
response := NodeBalancerConfigsPagedResponse{}
err := c.listHelperWithID(ctx, &response, nodebalancerID, opts)
for _, el := range response.Data {
el.fixDates()
for i := range response.Data {
response.Data[i].fixDates()
}
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions regions.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func (resp *RegionsPagedResponse) appendData(r *RegionsPagedResponse) {
func (c *Client) ListRegions(ctx context.Context, opts *ListOptions) ([]Region, error) {
response := RegionsPagedResponse{}
err := c.listHelper(ctx, &response, opts)
for _, el := range response.Data {
el.fixDates()
for i := range response.Data {
response.Data[i].fixDates()
}
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions stackscripts.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ func (resp *StackscriptsPagedResponse) appendData(r *StackscriptsPagedResponse)
func (c *Client) ListStackscripts(ctx context.Context, opts *ListOptions) ([]Stackscript, error) {
response := StackscriptsPagedResponse{}
err := c.listHelper(ctx, &response, opts)
for _, el := range response.Data {
el.fixDates()
for i := range response.Data {
response.Data[i].fixDates()
}
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions template.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ func (resp *TemplatesPagedResponse) appendData(r *TemplatesPagedResponse) {
func (c *Client) ListTemplates(ctx context.Context, opts *ListOptions) ([]Template, error) {
response := TemplatesPagedResponse{}
err := c.listHelper(ctx, &response, opts)
for _, el := range response.Data {
el.fixDates()
for i := range response.Data {
response.Data[i].fixDates()
}
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ func (resp *VolumesPagedResponse) appendData(r *VolumesPagedResponse) {
func (c *Client) ListVolumes(ctx context.Context, opts *ListOptions) ([]Volume, error) {
response := VolumesPagedResponse{}
err := c.listHelper(ctx, &response, opts)
for _, el := range response.Data {
el.fixDates()
for i := range response.Data {
response.Data[i].fixDates()
}
if err != nil {
return nil, err
Expand Down

0 comments on commit 033e138

Please sign in to comment.