diff --git a/gitlab.go b/gitlab.go index db6041726..8cfeaf562 100644 --- a/gitlab.go +++ b/gitlab.go @@ -236,15 +236,16 @@ type Client struct { // ListOptions specifies the optional parameters to various List methods that // support pagination. type ListOptions struct { - // For offset-based paginated result sets, page of results to retrieve. - Page int `url:"page,omitempty" json:"page,omitempty"` + // For keyset-based paginated result sets, the value must be `"keyset"` + Pagination string `url:"pagination,omitempty" json:"pagination,omitempty"` // For offset-based and keyset-based paginated result sets, the number of results to include per page. PerPage int `url:"per_page,omitempty" json:"per_page,omitempty"` - + // For offset-based paginated result sets, page of results to retrieve. + Page int `url:"page,omitempty" json:"page,omitempty"` + // For keyset-based paginated result sets, tree record ID at which to fetch the next page. + PageToken string `url:"page_token,omitempty" json:"page_token,omitempty"` // For keyset-based paginated result sets, name of the column by which to order OrderBy string `url:"order_by,omitempty" json:"order_by,omitempty"` - // For keyset-based paginated result sets, the value must be `"keyset"` - Pagination string `url:"pagination,omitempty" json:"pagination,omitempty"` // For keyset-based paginated result sets, sort order (`"asc"`` or `"desc"`) Sort string `url:"sort,omitempty" json:"sort,omitempty"` } diff --git a/projects.go b/projects.go index a2b8e527e..6df4eff2b 100644 --- a/projects.go +++ b/projects.go @@ -169,7 +169,7 @@ type Project struct { MergeRequestDefaultTargetSelf bool `json:"mr_default_target_self"` ModelExperimentsAccessLevel AccessControlValue `json:"model_experiments_access_level"` ModelRegistryAccessLevel AccessControlValue `json:"model_registry_access_level"` - PreReceiveSecretDetectionEnabled bool `json:"pre_receive_secret_detection_enabled"` + PreReceiveSecretDetectionEnabled bool `json:"pre_receive_secret_detection_enabled"` // Deprecated: Use EmailsEnabled instead EmailsDisabled bool `json:"emails_disabled"` diff --git a/repositories_test.go b/repositories_test.go index e08b67ef4..4610bf3e8 100644 --- a/repositories_test.go +++ b/repositories_test.go @@ -37,6 +37,13 @@ func TestRepositoriesService_ListTree(t *testing.T) { }, } + lto := ListTreeOptions{ + ListOptions: ListOptions{ + PerPage: 1, + PageToken: "a1e8f8d745cc87e3a9248358d9352bb7f9a0aeba", + }, + } + tns, resp, err := client.Repositories.ListTree(1, nil) require.NoError(t, err) require.NotNil(t, resp) @@ -56,6 +63,11 @@ func TestRepositoriesService_ListTree(t *testing.T) { require.Error(t, err) require.Nil(t, tns) require.Equal(t, http.StatusNotFound, resp.StatusCode) + + tns, resp, err = client.Repositories.ListTree(1, <o) + require.NoError(t, err) + require.NotNil(t, resp) + require.Equal(t, want, tns) } func TestRepositoriesService_Blob(t *testing.T) {