Skip to content

Commit c6c623f

Browse files
break: use uint32 for page_size (#210)
* break: use uint32 for page_size * break: use uint32 for per_page * fix: client tests * fix: per page default value
1 parent b087316 commit c6c623f

File tree

10 files changed

+45
-45
lines changed

10 files changed

+45
-45
lines changed

api/account/v2alpha1/account_sdk.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ type ListSSHKeysRequest struct {
130130

131131
Page *int32 `json:"-"`
132132

133-
PageSize *int32 `json:"-"`
133+
PageSize *uint32 `json:"-"`
134134

135135
Name *string `json:"-"`
136136

api/baremetal/v1alpha1/baremetal_sdk.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ type ListServersRequest struct {
436436
// Page page number
437437
Page *int32 `json:"-"`
438438
// PageSize number of server per page
439-
PageSize *int32 `json:"-"`
439+
PageSize *uint32 `json:"-"`
440440
// OrderBy order of the servers
441441
//
442442
// Default value: created_at_asc
@@ -894,7 +894,7 @@ type ListServerEventsRequest struct {
894894
// Page page number
895895
Page *int32 `json:"-"`
896896
// PageSize number of server events per page
897-
PageSize *int32 `json:"-"`
897+
PageSize *uint32 `json:"-"`
898898
// OrderBy order of the server events
899899
//
900900
// Default value: created_at_asc

api/instance/v1/instance_sdk.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,7 @@ type setSnapshotResponse struct {
12471247
type GetServerTypesAvailabilityRequest struct {
12481248
Zone scw.Zone `json:"-"`
12491249

1250-
PerPage *int32 `json:"-"`
1250+
PerPage *uint32 `json:"-"`
12511251

12521252
Page *int32 `json:"-"`
12531253
}
@@ -1295,7 +1295,7 @@ func (s *API) GetServerTypesAvailability(req *GetServerTypesAvailabilityRequest,
12951295
type ListServersTypesRequest struct {
12961296
Zone scw.Zone `json:"-"`
12971297

1298-
PerPage *int32 `json:"-"`
1298+
PerPage *uint32 `json:"-"`
12991299

13001300
Page *int32 `json:"-"`
13011301
}
@@ -1345,7 +1345,7 @@ type ListServersRequest struct {
13451345
// PerPage a positive integer lower or equal to 100 to select the number of items to display
13461346
//
13471347
// Default value: 20
1348-
PerPage *int32 `json:"-"`
1348+
PerPage *uint32 `json:"-"`
13491349
// Page a positive integer to choose the page to display
13501350
Page *int32 `json:"-"`
13511351
// Organization list only servers of this organization
@@ -1915,7 +1915,7 @@ type ListImagesRequest struct {
19151915

19161916
Organization *string `json:"-"`
19171917

1918-
PerPage *int32 `json:"-"`
1918+
PerPage *uint32 `json:"-"`
19191919

19201920
Page *int32 `json:"-"`
19211921

@@ -2211,7 +2211,7 @@ type ListSnapshotsRequest struct {
22112211

22122212
Organization *string `json:"-"`
22132213

2214-
PerPage *int32 `json:"-"`
2214+
PerPage *uint32 `json:"-"`
22152215

22162216
Page *int32 `json:"-"`
22172217

@@ -2487,7 +2487,7 @@ type ListVolumesRequest struct {
24872487
// PerPage a positive integer lower or equal to 100 to select the number of items to display
24882488
//
24892489
// Default value: 20
2490-
PerPage *int32 `json:"-"`
2490+
PerPage *uint32 `json:"-"`
24912491
// Page a positive integer to choose the page to display
24922492
Page *int32 `json:"-"`
24932493
// Organization display volumes of this organization
@@ -2715,7 +2715,7 @@ type ListSecurityGroupsRequest struct {
27152715

27162716
Organization *string `json:"-"`
27172717

2718-
PerPage *int32 `json:"-"`
2718+
PerPage *uint32 `json:"-"`
27192719

27202720
Page *int32 `json:"-"`
27212721

@@ -3005,7 +3005,7 @@ type ListSecurityGroupRulesRequest struct {
30053005

30063006
SecurityGroupID string `json:"-"`
30073007

3008-
PerPage *int32 `json:"-"`
3008+
PerPage *uint32 `json:"-"`
30093009

30103010
Page *int32 `json:"-"`
30113011
}
@@ -3304,7 +3304,7 @@ type ListComputeClustersRequest struct {
33043304
// PerPage a positive integer lower or equal to 100 to select the number of items to display
33053305
//
33063306
// Default value: 20
3307-
PerPage *int32 `json:"-"`
3307+
PerPage *uint32 `json:"-"`
33083308
// Page a positive integer to choose the page to display
33093309
Page *int32 `json:"-"`
33103310
// Organization list only compute-clusters of this organization
@@ -3812,7 +3812,7 @@ type ListIPsRequest struct {
38123812

38133813
Name *string `json:"-"`
38143814

3815-
PerPage *int32 `json:"-"`
3815+
PerPage *uint32 `json:"-"`
38163816

38173817
Page *int32 `json:"-"`
38183818
}
@@ -4118,7 +4118,7 @@ type ListBootscriptsRequest struct {
41184118

41194119
Public *bool `json:"-"`
41204120

4121-
PerPage *int32 `json:"-"`
4121+
PerPage *uint32 `json:"-"`
41224122

41234123
Page *int32 `json:"-"`
41244124
}

api/k8s/v1beta3/k8s_sdk.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ type ListClustersRequest struct {
595595
// Page page number
596596
Page *int32 `json:"-"`
597597
// PageSize set the maximum list size
598-
PageSize *int32 `json:"-"`
598+
PageSize *uint32 `json:"-"`
599599
// Name filter clusters per name
600600
Name *string `json:"-"`
601601
// OrganizationID filter cluster by organization
@@ -1047,7 +1047,7 @@ type ListPoolsRequest struct {
10471047
// Page page number
10481048
Page *int32 `json:"-"`
10491049
// PageSize set the maximum list size
1050-
PageSize *int32 `json:"-"`
1050+
PageSize *uint32 `json:"-"`
10511051
// Name filter pools per name
10521052
Name *string `json:"-"`
10531053
}
@@ -1373,7 +1373,7 @@ type ListNodesRequest struct {
13731373
// Page page number
13741374
Page *int32 `json:"-"`
13751375
// PageSize set the maximum list size
1376-
PageSize *int32 `json:"-"`
1376+
PageSize *uint32 `json:"-"`
13771377
// Name filter nodes by name
13781378
Name *string `json:"-"`
13791379
// Status filter nodes by status

api/lb/v1/lb_sdk.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,7 @@ type ListLbsRequest struct {
11821182
// Default value: created_at_asc
11831183
OrderBy ListLbsRequestOrderBy `json:"-"`
11841184

1185-
PageSize *int32 `json:"-"`
1185+
PageSize *uint32 `json:"-"`
11861186

11871187
Page *int32 `json:"-"`
11881188

@@ -1437,7 +1437,7 @@ type ListIPsRequest struct {
14371437
// Page page number
14381438
Page *int32 `json:"-"`
14391439
// PageSize set the maximum list size
1440-
PageSize *int32 `json:"-"`
1440+
PageSize *uint32 `json:"-"`
14411441
// IPAddress use this to search by IP address
14421442
IPAddress *string `json:"-"`
14431443

@@ -1640,7 +1640,7 @@ type ListBackendsRequest struct {
16401640
// Page page number
16411641
Page *int32 `json:"-"`
16421642
// PageSize set the maximum list sizes
1643-
PageSize *int32 `json:"-"`
1643+
PageSize *uint32 `json:"-"`
16441644
}
16451645

16461646
func (s *API) ListBackends(req *ListBackendsRequest, opts ...scw.RequestOption) (*ListBackendsResponse, error) {
@@ -2277,7 +2277,7 @@ type ListFrontendsRequest struct {
22772277
// Page page number
22782278
Page *int32 `json:"-"`
22792279
// PageSize set the maximum list sizes
2280-
PageSize *int32 `json:"-"`
2280+
PageSize *uint32 `json:"-"`
22812281
}
22822282

22832283
func (s *API) ListFrontends(req *ListFrontendsRequest, opts ...scw.RequestOption) (*ListFrontendsResponse, error) {
@@ -2630,7 +2630,7 @@ type ListACLsRequest struct {
26302630
// Page page number
26312631
Page *int32 `json:"-"`
26322632
// PageSize set the maximum list size
2633-
PageSize *int32 `json:"-"`
2633+
PageSize *uint32 `json:"-"`
26342634
// Name filter acl per name
26352635
Name *string `json:"-"`
26362636
}
@@ -2938,7 +2938,7 @@ type ListCertificatesRequest struct {
29382938
// Page page number
29392939
Page *int32 `json:"-"`
29402940
// PageSize set the maximum list size
2941-
PageSize *int32 `json:"-"`
2941+
PageSize *uint32 `json:"-"`
29422942
// Name use this to search by name
29432943
Name *string `json:"-"`
29442944
}
@@ -3130,7 +3130,7 @@ type ListLbTypesRequest struct {
31303130
// Page page number
31313131
Page *int32 `json:"-"`
31323132
// PageSize set the maximum list size
3133-
PageSize *int32 `json:"-"`
3133+
PageSize *uint32 `json:"-"`
31343134
}
31353135

31363136
// ListLbTypes list all Load Balancer offer type

api/marketplace/v1/marketplace_sdk.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func (s *API) GetServiceInfo(req *GetServiceInfoRequest, opts ...scw.RequestOpti
154154
}
155155

156156
type ListImagesRequest struct {
157-
PerPage *int32 `json:"-"`
157+
PerPage *uint32 `json:"-"`
158158

159159
Page *int32 `json:"-"`
160160
}

api/test/v1/test_sdk.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ type ListHumansRequest struct {
257257

258258
Page *int32 `json:"-"`
259259

260-
PageSize *int32 `json:"-"`
260+
PageSize *uint32 `json:"-"`
261261
// OrderBy
262262
//
263263
// Default value: created_at_asc

scw/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type Client struct {
3030
defaultOrganizationID *string
3131
defaultRegion *Region
3232
defaultZone *Zone
33-
defaultPageSize *int32
33+
defaultPageSize *uint32
3434
}
3535

3636
func defaultOptions() []ClientOption {
@@ -114,7 +114,7 @@ func (c *Client) GetDefaultZone() (Zone, bool) {
114114
// GetDefaultPageSize return the default page size of the client.
115115
// This value can be set in the client option
116116
// WithDefaultPageSize(). Be aware this value can be empty.
117-
func (c *Client) GetDefaultPageSize() (int32, bool) {
117+
func (c *Client) GetDefaultPageSize() (uint32, bool) {
118118
if c.defaultPageSize != nil {
119119
return *c.defaultPageSize, true
120120
}

scw/client_option.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,23 +140,23 @@ func WithDefaultZone(zone Zone) ClientOption {
140140
// WithDefaultPageSize client option overrides the default page size of the SDK.
141141
//
142142
// It will be used as the default value of the page_size field in all requests made with this client.
143-
func WithDefaultPageSize(pageSize int32) ClientOption {
143+
func WithDefaultPageSize(pageSize uint32) ClientOption {
144144
return func(s *settings) {
145145
s.defaultPageSize = &pageSize
146146
}
147147
}
148148

149149
// settings hold the values of all client options
150150
type settings struct {
151-
apiURL string
152-
token auth.Auth
153-
userAgent string
154-
httpClient httpClient
155-
insecure bool
151+
apiURL string
152+
token auth.Auth
153+
userAgent string
154+
httpClient httpClient
155+
insecure bool
156156
defaultOrganizationID *string
157-
defaultRegion *Region
158-
defaultZone *Zone
159-
defaultPageSize *int32
157+
defaultRegion *Region
158+
defaultZone *Zone
159+
defaultPageSize *uint32
160160
}
161161

162162
func newSettings() *settings {

scw/client_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ import (
1313
)
1414

1515
const (
16-
testAPIURL = "https://api.example.com/"
17-
defaultAPIURL = "https://api.scaleway.com"
18-
testAccessKey = "ACCESS_KEY"
19-
testSecretKey = "7363616c-6577-6573-6862-6f7579616161" // hint: | xxd -ps -r
16+
testAPIURL = "https://api.example.com/"
17+
defaultAPIURL = "https://api.scaleway.com"
18+
testAccessKey = "ACCESS_KEY"
19+
testSecretKey = "7363616c-6577-6573-6862-6f7579616161" // hint: | xxd -ps -r
2020
testDefaultOrganizationID = "6170692e-7363-616c-6577-61792e636f6d" // hint: | xxd -ps -r
21-
testDefaultRegion = RegionFrPar
22-
testDefaultZone = ZoneFrPar1
23-
testDefaultPageSize = int32(5)
24-
testInsecure = true
21+
testDefaultRegion = RegionFrPar
22+
testDefaultZone = ZoneFrPar1
23+
testDefaultPageSize = uint32(5)
24+
testInsecure = true
2525
)
2626

2727
func TestNewClientWithDefaults(t *testing.T) {

0 commit comments

Comments
 (0)