Skip to content

Commit b3b74e6

Browse files
committed
feat(list): Add consistent filter type.
1 parent 860bdc4 commit b3b74e6

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

autoscaling_group.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ type AutoscalingGroupGetParams struct {
4444
type AutoscalingGroupListParams struct {
4545
RequestParams
4646

47-
Filter map[string]string `json:"filter,omitempty"`
48-
IncludeNodes bool `json:"includeNodes,omitempty"`
47+
Filter Filter `json:"filter,omitempty"`
48+
IncludeNodes bool `json:"includeNodes,omitempty"`
4949
}
5050

5151
type AutoscalingGroupUpdateAttributeParams struct {

cluster.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ type ClusterGetParams struct {
6767
type ClusterListParams struct {
6868
RequestParams
6969

70-
Filter map[string]string `json:"filter"`
70+
Filter Filter `json:"filter,omitempty"`
7171
}
7272

7373
type ClusterUpdateAttributeParams struct {
@@ -106,11 +106,7 @@ type ClusterUpdateS3Params struct {
106106
}
107107

108108
func NewClusterListParams() ClusterListParams {
109-
clusterListParams := ClusterListParams{
110-
Filter: make(map[string]string),
111-
}
112-
113-
return clusterListParams
109+
return ClusterListParams{}
114110
}
115111

116112
func (c Client) CreateCluster(params ClusterCreateParams) (Cluster, error) {

filter.go

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package paperspace
2+
3+
type Filter struct {
4+
Where map[string]interface{} `json:"where,omitempty"`
5+
Limit int64 `json:"limit,omitempty"`
6+
Order string `json:"order,omitempty"`
7+
}

machine.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ type MachineGetParams struct {
7171
type MachineListParams struct {
7272
RequestParams
7373

74-
Filter map[string]string `json:"filter,omitempty"`
74+
Filter Filter `json:"filter,omitempty"`
7575
}
7676

7777
type MachineUpdateAttributeParams struct {
@@ -94,11 +94,7 @@ type MachineUpdateParams struct {
9494
}
9595

9696
func NewMachineListParams() MachineListParams {
97-
machineListParams := MachineListParams{
98-
Filter: make(map[string]string),
99-
}
100-
101-
return machineListParams
97+
return MachineListParams{}
10298
}
10399

104100
func (c Client) CreateMachine(params MachineCreateParams) (Machine, error) {

0 commit comments

Comments
 (0)