Skip to content

Commit

Permalink
make ListResponse functions private/lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
displague committed May 26, 2018
1 parent 704d0ed commit f36ec41
Show file tree
Hide file tree
Showing 30 changed files with 290 additions and 290 deletions.
20 changes: 10 additions & 10 deletions account_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,31 +40,31 @@ type EventsPagedResponse struct {
Data []*Event
}

// Endpoint gets the endpoint URL for Event
func (EventsPagedResponse) Endpoint(c *Client) string {
// endpoint gets the endpoint URL for Event
func (EventsPagedResponse) endpoint(c *Client) string {
endpoint, err := c.Events.Endpoint()
if err != nil {
panic(err)
}
return endpoint
}

// EndpointWithID gets the endpoint URL for a specific Event
func (EventsPagedResponse) EndpointWithID(c *Client, id int) string {
endpoint, err := c.Events.EndpointWithID(id)
// endpointWithID gets the endpoint URL for a specific Event
func (EventsPagedResponse) endpointWithID(c *Client, id int) string {
endpoint, err := c.Events.endpointWithID(id)
if err != nil {
panic(err)
}
return endpoint
}

// AppendData appends Events when processing paginated Event responses
func (resp *EventsPagedResponse) AppendData(r *EventsPagedResponse) {
// appendData appends Events when processing paginated Event responses
func (resp *EventsPagedResponse) appendData(r *EventsPagedResponse) {
(*resp).Data = append(resp.Data, r.Data...)
}

// SetResult sets the Resty response type of Events
func (EventsPagedResponse) SetResult(r *resty.Request) {
// setResult sets the Resty response type of Events
func (EventsPagedResponse) setResult(r *resty.Request) {
r.SetResult(EventsPagedResponse{})
}

Expand All @@ -73,7 +73,7 @@ func (EventsPagedResponse) SetResult(r *resty.Request) {
// of the associated user.
func (c *Client) ListEvents(opts *ListOptions) ([]*Event, error) {
response := EventsPagedResponse{}
err := c.ListHelper(&response, opts)
err := c.listHelper(&response, opts)
for _, el := range response.Data {
el.fixDates()
}
Expand Down
30 changes: 15 additions & 15 deletions account_invoices.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,29 @@ type InvoicesPagedResponse struct {
Data []*Invoice
}

// Endpoint gets the endpoint URL for Invoice
func (InvoicesPagedResponse) Endpoint(c *Client) string {
// endpoint gets the endpoint URL for Invoice
func (InvoicesPagedResponse) endpoint(c *Client) string {
endpoint, err := c.Invoices.Endpoint()
if err != nil {
panic(err)
}
return endpoint
}

// AppendData appends Invoices when processing paginated Invoice responses
func (resp *InvoicesPagedResponse) AppendData(r *InvoicesPagedResponse) {
// appendData appends Invoices when processing paginated Invoice responses
func (resp *InvoicesPagedResponse) appendData(r *InvoicesPagedResponse) {
(*resp).Data = append(resp.Data, r.Data...)
}

// SetResult sets the Resty response type of Invoice
func (InvoicesPagedResponse) SetResult(r *resty.Request) {
// setResult sets the Resty response type of Invoice
func (InvoicesPagedResponse) setResult(r *resty.Request) {
r.SetResult(InvoicesPagedResponse{})
}

// ListInvoices gets a paginated list of Invoices against the Account
func (c *Client) ListInvoices(opts *ListOptions) ([]*Invoice, error) {
response := InvoicesPagedResponse{}
err := c.ListHelper(&response, opts)
err := c.listHelper(&response, opts)
for _, el := range response.Data {
el.fixDates()
}
Expand Down Expand Up @@ -103,29 +103,29 @@ type InvoiceItemsPagedResponse struct {
Data []*InvoiceItem
}

// EndpointWithID gets the endpoint URL for InvoiceItems associated with a specific Invoice
func (InvoiceItemsPagedResponse) EndpointWithID(c *Client, id int) string {
endpoint, err := c.InvoiceItems.EndpointWithID(id)
// endpointWithID gets the endpoint URL for InvoiceItems associated with a specific Invoice
func (InvoiceItemsPagedResponse) endpointWithID(c *Client, id int) string {
endpoint, err := c.InvoiceItems.endpointWithID(id)
if err != nil {
panic(err)
}
return endpoint
}

// AppendData appends InvoiceItems when processing paginated Invoice Item responses
func (resp *InvoiceItemsPagedResponse) AppendData(r *InvoiceItemsPagedResponse) {
// appendData appends InvoiceItems when processing paginated Invoice Item responses
func (resp *InvoiceItemsPagedResponse) appendData(r *InvoiceItemsPagedResponse) {
(*resp).Data = append(resp.Data, r.Data...)
}

// SetResult sets the Resty response type of InvoiceItems
func (InvoiceItemsPagedResponse) SetResult(r *resty.Request) {
// setResult sets the Resty response type of InvoiceItems
func (InvoiceItemsPagedResponse) setResult(r *resty.Request) {
r.SetResult(InvoiceItemsPagedResponse{})
}

// ListInvoiceItems gets the invoice items associated with a specific Invoice
func (c *Client) ListInvoiceItems(id int, opts *ListOptions) ([]*InvoiceItem, error) {
response := InvoiceItemsPagedResponse{}
err := c.ListHelperWithID(&response, id, opts)
err := c.listHelperWithID(&response, id, opts)
for _, el := range response.Data {
el.fixDates()
}
Expand Down
14 changes: 7 additions & 7 deletions account_notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ type NotificationsPagedResponse struct {
Data []*Notification
}

// Endpoint gets the endpoint URL for Notification
func (NotificationsPagedResponse) Endpoint(c *Client) string {
// endpoint gets the endpoint URL for Notification
func (NotificationsPagedResponse) endpoint(c *Client) string {
endpoint, err := c.Notifications.Endpoint()
if err != nil {
panic(err)
}
return endpoint
}

// AppendData appends Notifications when processing paginated Notification responses
func (resp *NotificationsPagedResponse) AppendData(r *NotificationsPagedResponse) {
// appendData appends Notifications when processing paginated Notification responses
func (resp *NotificationsPagedResponse) appendData(r *NotificationsPagedResponse) {
(*resp).Data = append(resp.Data, r.Data...)
}

// SetResult sets the Resty response type of Notifications
func (NotificationsPagedResponse) SetResult(r *resty.Request) {
// setResult sets the Resty response type of Notifications
func (NotificationsPagedResponse) setResult(r *resty.Request) {
r.SetResult(NotificationsPagedResponse{})
}

Expand All @@ -60,7 +60,7 @@ func (NotificationsPagedResponse) SetResult(r *resty.Request) {
// to the Ticket will dismiss the Notification.
func (c *Client) ListNotifications(opts *ListOptions) ([]*Notification, error) {
response := NotificationsPagedResponse{}
err := c.ListHelper(&response, opts)
err := c.listHelper(&response, opts)
for _, el := range response.Data {
el.fixDates()
}
Expand Down
16 changes: 8 additions & 8 deletions domain_records.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,29 @@ type DomainRecordsPagedResponse struct {
Data []*DomainRecord
}

// Endpoint gets the endpoint URL for InstanceConfig
func (DomainRecordsPagedResponse) EndpointWithID(c *Client, id int) string {
endpoint, err := c.DomainRecords.EndpointWithID(id)
// endpoint gets the endpoint URL for InstanceConfig
func (DomainRecordsPagedResponse) endpointWithID(c *Client, id int) string {
endpoint, err := c.DomainRecords.endpointWithID(id)
if err != nil {
panic(err)
}
return endpoint
}

// AppendData appends DomainRecords when processing paginated DomainRecord responses
func (resp *DomainRecordsPagedResponse) AppendData(r *DomainRecordsPagedResponse) {
// appendData appends DomainRecords when processing paginated DomainRecord responses
func (resp *DomainRecordsPagedResponse) appendData(r *DomainRecordsPagedResponse) {
(*resp).Data = append(resp.Data, r.Data...)
}

// SetResult sets the Resty response type of DomainRecord
func (DomainRecordsPagedResponse) SetResult(r *resty.Request) {
// setResult sets the Resty response type of DomainRecord
func (DomainRecordsPagedResponse) setResult(r *resty.Request) {
r.SetResult(DomainRecordsPagedResponse{})
}

// ListDomainRecords lists DomainRecords
func (c *Client) ListDomainRecords(opts *ListOptions) ([]*DomainRecord, error) {
response := DomainRecordsPagedResponse{}
err := c.ListHelper(&response, opts)
err := c.listHelper(&response, opts)
if err != nil {
return nil, err
}
Expand Down
14 changes: 7 additions & 7 deletions domains.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,29 @@ type DomainsPagedResponse struct {
Data []*Domain
}

// Endpoint gets the endpoint URL for Domain
func (DomainsPagedResponse) Endpoint(c *Client) string {
// endpoint gets the endpoint URL for Domain
func (DomainsPagedResponse) endpoint(c *Client) string {
endpoint, err := c.Domains.Endpoint()
if err != nil {
panic(err)
}
return endpoint
}

// AppendData appends Domains when processing paginated Domain responses
func (resp *DomainsPagedResponse) AppendData(r *DomainsPagedResponse) {
// appendData appends Domains when processing paginated Domain responses
func (resp *DomainsPagedResponse) appendData(r *DomainsPagedResponse) {
(*resp).Data = append(resp.Data, r.Data...)
}

// SetResult sets the Resty response type of Domain
func (DomainsPagedResponse) SetResult(r *resty.Request) {
// setResult sets the Resty response type of Domain
func (DomainsPagedResponse) setResult(r *resty.Request) {
r.SetResult(DomainsPagedResponse{})
}

// ListDomains lists Domains
func (c *Client) ListDomains(opts *ListOptions) ([]*Domain, error) {
response := DomainsPagedResponse{}
err := c.ListHelper(&response, opts)
err := c.listHelper(&response, opts)
for _, el := range response.Data {
el.fixDates()
}
Expand Down
8 changes: 4 additions & 4 deletions images.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,26 @@ type ImagesPagedResponse struct {
Data []*Image
}

func (ImagesPagedResponse) Endpoint(c *Client) string {
func (ImagesPagedResponse) endpoint(c *Client) string {
endpoint, err := c.Images.Endpoint()
if err != nil {
panic(err)
}
return endpoint
}

func (resp *ImagesPagedResponse) AppendData(r *ImagesPagedResponse) {
func (resp *ImagesPagedResponse) appendData(r *ImagesPagedResponse) {
(*resp).Data = append(resp.Data, r.Data...)
}

func (ImagesPagedResponse) SetResult(r *resty.Request) {
func (ImagesPagedResponse) setResult(r *resty.Request) {
r.SetResult(ImagesPagedResponse{})
}

// ListImages lists Images
func (c *Client) ListImages(opts *ListOptions) ([]*Image, error) {
response := ImagesPagedResponse{}
err := c.ListHelper(&response, opts)
err := c.listHelper(&response, opts)
for _, el := range response.Data {
el.fixDates()
}
Expand Down
24 changes: 12 additions & 12 deletions instance_configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,29 +104,29 @@ func (i InstanceConfig) GetUpdateOptions() InstanceConfigUpdateOptions {
}
}

// EndpointWithID gets the endpoint URL for InstanceConfigs of a given Instance
func (InstanceConfigsPagedResponse) EndpointWithID(c *Client, id int) string {
endpoint, err := c.InstanceConfigs.EndpointWithID(id)
// endpointWithID gets the endpoint URL for InstanceConfigs of a given Instance
func (InstanceConfigsPagedResponse) endpointWithID(c *Client, id int) string {
endpoint, err := c.InstanceConfigs.endpointWithID(id)
if err != nil {
panic(err)
}
return endpoint
}

// AppendData appends InstanceConfigs when processing paginated InstanceConfig responses
func (resp *InstanceConfigsPagedResponse) AppendData(r *InstanceConfigsPagedResponse) {
// appendData appends InstanceConfigs when processing paginated InstanceConfig responses
func (resp *InstanceConfigsPagedResponse) appendData(r *InstanceConfigsPagedResponse) {
(*resp).Data = append(resp.Data, r.Data...)
}

// SetResult sets the Resty response type of InstanceConfig
func (InstanceConfigsPagedResponse) SetResult(r *resty.Request) {
// setResult sets the Resty response type of InstanceConfig
func (InstanceConfigsPagedResponse) setResult(r *resty.Request) {
r.SetResult(InstanceConfigsPagedResponse{})
}

// ListInstanceConfigs lists InstanceConfigs
func (c *Client) ListInstanceConfigs(linodeID int, opts *ListOptions) ([]*InstanceConfig, error) {
response := InstanceConfigsPagedResponse{}
err := c.ListHelperWithID(&response, linodeID, opts)
err := c.listHelperWithID(&response, linodeID, opts)
for _, el := range response.Data {
el.fixDates()
}
Expand All @@ -145,7 +145,7 @@ func (v *InstanceConfig) fixDates() *InstanceConfig {

// GetInstanceConfig gets the template with the provided ID
func (c *Client) GetInstanceConfig(linodeID int, configID int) (*InstanceConfig, error) {
e, err := c.InstanceConfigs.EndpointWithID(linodeID)
e, err := c.InstanceConfigs.endpointWithID(linodeID)
if err != nil {
return nil, err
}
Expand All @@ -160,7 +160,7 @@ func (c *Client) GetInstanceConfig(linodeID int, configID int) (*InstanceConfig,
// CreateInstanceConfig creates a new InstanceConfig for the given Instance
func (c *Client) CreateInstanceConfig(linodeID int, createOpts InstanceConfigCreateOptions) (*InstanceConfig, error) {
var body string
e, err := c.InstanceConfigs.EndpointWithID(linodeID)
e, err := c.InstanceConfigs.endpointWithID(linodeID)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -188,7 +188,7 @@ func (c *Client) CreateInstanceConfig(linodeID int, createOpts InstanceConfigCre
// UpdateInstanceConfig update an InstanceConfig for the given Instance
func (c *Client) UpdateInstanceConfig(linodeID int, configID int, updateOpts InstanceConfigUpdateOptions) (*InstanceConfig, error) {
var body string
e, err := c.InstanceConfigs.EndpointWithID(linodeID)
e, err := c.InstanceConfigs.endpointWithID(linodeID)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -220,7 +220,7 @@ func (c *Client) RenameInstanceConfig(linodeID int, configID int, label string)

// DeleteInstanceConfig deletes a Linode InstanceConfig
func (c *Client) DeleteInstanceConfig(id int) error {
e, err := c.InstanceConfigs.EndpointWithID(id)
e, err := c.InstanceConfigs.endpointWithID(id)
if err != nil {
return err
}
Expand Down
Loading

0 comments on commit f36ec41

Please sign in to comment.