Skip to content

Commit

Permalink
feat: make ListOpts.Values method public (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
jooola committed Jul 11, 2023
1 parent b8a0c24 commit c82ea59
Show file tree
Hide file tree
Showing 18 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion hcloud/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ type ActionListOpts struct {
}

func (l ActionListOpts) values() url.Values {
vals := l.ListOpts.values()
vals := l.ListOpts.Values()
for _, id := range l.ID {
vals.Add("id", fmt.Sprintf("%d", id))
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ type CertificateListOpts struct {
}

func (l CertificateListOpts) values() url.Values {
vals := l.ListOpts.values()
vals := l.ListOpts.Values()
if l.Name != "" {
vals.Add("name", l.Name)
}
Expand Down
3 changes: 2 additions & 1 deletion hcloud/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,8 @@ type ListOpts struct {
LabelSelector string // Label selector for filtering by labels
}

func (l ListOpts) values() url.Values {
// Values returns the ListOpts as URL values.
func (l ListOpts) Values() url.Values {
vals := url.Values{}
if l.Page > 0 {
vals.Add("page", strconv.Itoa(l.Page))
Expand Down
2 changes: 1 addition & 1 deletion hcloud/datacenter.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ type DatacenterListOpts struct {
}

func (l DatacenterListOpts) values() url.Values {
vals := l.ListOpts.values()
vals := l.ListOpts.Values()
if l.Name != "" {
vals.Add("name", l.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/firewall.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ type FirewallListOpts struct {
}

func (l FirewallListOpts) values() url.Values {
vals := l.ListOpts.values()
vals := l.ListOpts.Values()
if l.Name != "" {
vals.Add("name", l.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/floating_ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ type FloatingIPListOpts struct {
}

func (l FloatingIPListOpts) values() url.Values {
vals := l.ListOpts.values()
vals := l.ListOpts.Values()
if l.Name != "" {
vals.Add("name", l.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ type ImageListOpts struct {
}

func (l ImageListOpts) values() url.Values {
vals := l.ListOpts.values()
vals := l.ListOpts.Values()
for _, typ := range l.Type {
vals.Add("type", string(typ))
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/iso.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ type ISOListOpts struct {
}

func (l ISOListOpts) values() url.Values {
vals := l.ListOpts.values()
vals := l.ListOpts.Values()
if l.Name != "" {
vals.Add("name", l.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/load_balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ type LoadBalancerListOpts struct {
}

func (l LoadBalancerListOpts) values() url.Values {
vals := l.ListOpts.values()
vals := l.ListOpts.Values()
if l.Name != "" {
vals.Add("name", l.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/load_balancer_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ type LoadBalancerTypeListOpts struct {
}

func (l LoadBalancerTypeListOpts) values() url.Values {
vals := l.ListOpts.values()
vals := l.ListOpts.Values()
if l.Name != "" {
vals.Add("name", l.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/location.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ type LocationListOpts struct {
}

func (l LocationListOpts) values() url.Values {
vals := l.ListOpts.values()
vals := l.ListOpts.Values()
if l.Name != "" {
vals.Add("name", l.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ type NetworkListOpts struct {
}

func (l NetworkListOpts) values() url.Values {
vals := l.ListOpts.values()
vals := l.ListOpts.Values()
if l.Name != "" {
vals.Add("name", l.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/placement_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ type PlacementGroupListOpts struct {
}

func (l PlacementGroupListOpts) values() url.Values {
vals := l.ListOpts.values()
vals := l.ListOpts.Values()
if l.Name != "" {
vals.Add("name", l.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/primary_ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ type PrimaryIPListOpts struct {
}

func (l PrimaryIPListOpts) values() url.Values {
vals := l.ListOpts.values()
vals := l.ListOpts.Values()
if l.Name != "" {
vals.Add("name", l.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ type ServerListOpts struct {
}

func (l ServerListOpts) values() url.Values {
vals := l.ListOpts.values()
vals := l.ListOpts.Values()
if l.Name != "" {
vals.Add("name", l.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/server_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ type ServerTypeListOpts struct {
}

func (l ServerTypeListOpts) values() url.Values {
vals := l.ListOpts.values()
vals := l.ListOpts.Values()
if l.Name != "" {
vals.Add("name", l.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/ssh_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ type SSHKeyListOpts struct {
}

func (l SSHKeyListOpts) values() url.Values {
vals := l.ListOpts.values()
vals := l.ListOpts.Values()
if l.Name != "" {
vals.Add("name", l.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ type VolumeListOpts struct {
}

func (l VolumeListOpts) values() url.Values {
vals := l.ListOpts.values()
vals := l.ListOpts.Values()
if l.Name != "" {
vals.Add("name", l.Name)
}
Expand Down

0 comments on commit c82ea59

Please sign in to comment.