Skip to content

Commit bebb463

Browse files
Export PaginatedResponse type in request_helpers (#970)
1 parent c8dc0f7 commit bebb463

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

request_helpers.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
"reflect"
1111
)
1212

13-
// paginatedResponse represents a single response from a paginated
13+
// PaginatedResponse represents a single response from a paginated
1414
// endpoint.
15-
type paginatedResponse[T any] struct {
15+
type PaginatedResponse[T any] struct {
1616
Page int `json:"page"`
1717
Pages int `json:"pages"`
1818
Results int `json:"results"`
@@ -60,7 +60,7 @@ func handlePaginatedResults[T any, O any](
6060

6161
// Makes a request to a particular page and appends the response to the result
6262
handlePage := func(page int) error {
63-
var resultType paginatedResponse[T]
63+
var resultType PaginatedResponse[T]
6464

6565
// Override the page to be applied in createListOptionsToRequestMutator(...)
6666
opts.Page = page

request_helpers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ func mockPaginatedResponse(
268268

269269
return httpmock.NewJsonResponse(
270270
200,
271-
paginatedResponse[testResultType]{
271+
PaginatedResponse[testResultType]{
272272
Page: page,
273273
Pages: int(math.Ceil(float64(len(entries)) / float64(pageSize))),
274274
Results: pageSize,

test/unit/nodebalancer_types_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func TestNodeBalancerTypes_List(t *testing.T) {
1616
base.SetUp(t)
1717
defer base.TearDown(t)
1818

19-
// Mock the GET request for the node balancer types endpoint (mock as an array instead of paginatedResponse)
19+
// Mock the GET request for the node balancer types endpoint (mock as an array instead of PaginatedResponse)
2020
base.MockGet("nodebalancers/types", fixtureData)
2121

2222
// Call the ListNodeBalancerTypes method

0 commit comments

Comments
 (0)