Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pagination options to all supported endpoints in sdk #4463

Merged
merged 5 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion cli/admin/registry/registry_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal"
"go.woodpecker-ci.org/woodpecker/v2/woodpecker-go/woodpecker"
)

var registryListCmd = &cli.Command{
Expand All @@ -42,7 +43,9 @@
return err
}

list, err := client.GlobalRegistryList()
opt := woodpecker.RegistryListOptions{}

list, err := client.GlobalRegistryList(opt)

Check warning on line 48 in cli/admin/registry/registry_list.go

View check run for this annotation

Codecov / codecov/patch

cli/admin/registry/registry_list.go#L46-L48

Added lines #L46 - L48 were not covered by tests
if err != nil {
return err
}
Expand Down
4 changes: 3 additions & 1 deletion cli/cron/cron_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal"
"go.woodpecker-ci.org/woodpecker/v2/woodpecker-go/woodpecker"
)

var cronListCmd = &cli.Command{
Expand Down Expand Up @@ -52,7 +53,8 @@
if err != nil {
return err
}
list, err := client.CronList(repoID)
opt := woodpecker.CronListOptions{}
list, err := client.CronList(repoID, opt)

Check warning on line 57 in cli/cron/cron_list.go

View check run for this annotation

Codecov / codecov/patch

cli/cron/cron_list.go#L56-L57

Added lines #L56 - L57 were not covered by tests
if err != nil {
return err
}
Expand Down
5 changes: 4 additions & 1 deletion cli/org/registry/registry_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal"
"go.woodpecker-ci.org/woodpecker/v2/woodpecker-go/woodpecker"
)

var registryListCmd = &cli.Command{
Expand All @@ -49,7 +50,9 @@
return err
}

list, err := client.OrgRegistryList(orgID)
opt := woodpecker.RegistryListOptions{}

list, err := client.OrgRegistryList(orgID, opt)

Check warning on line 55 in cli/org/registry/registry_list.go

View check run for this annotation

Codecov / codecov/patch

cli/org/registry/registry_list.go#L53-L55

Added lines #L53 - L55 were not covered by tests
if err != nil {
return err
}
Expand Down
5 changes: 4 additions & 1 deletion cli/repo/registry/registry_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal"
"go.woodpecker-ci.org/woodpecker/v2/woodpecker-go/woodpecker"
)

var registryListCmd = &cli.Command{
Expand All @@ -49,7 +50,9 @@
return err
}

list, err := client.RegistryList(repoID)
opt := woodpecker.RegistryListOptions{}

list, err := client.RegistryList(repoID, opt)

Check warning on line 55 in cli/repo/registry/registry_list.go

View check run for this annotation

Codecov / codecov/patch

cli/repo/registry/registry_list.go#L53-L55

Added lines #L53 - L55 were not covered by tests
if err != nil {
return err
}
Expand Down
8 changes: 5 additions & 3 deletions cli/secret/secret_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,22 @@
return err
}

opt := woodpecker.SecretListOptions{}

Check warning on line 60 in cli/secret/secret_list.go

View check run for this annotation

Codecov / codecov/patch

cli/secret/secret_list.go#L59-L60

Added lines #L59 - L60 were not covered by tests
var list []*woodpecker.Secret
switch {
case global:
list, err = client.GlobalSecretList()
list, err = client.GlobalSecretList(opt)

Check warning on line 64 in cli/secret/secret_list.go

View check run for this annotation

Codecov / codecov/patch

cli/secret/secret_list.go#L64

Added line #L64 was not covered by tests
if err != nil {
return err
}
case orgID != -1:
list, err = client.OrgSecretList(orgID)
list, err = client.OrgSecretList(orgID, opt)

Check warning on line 69 in cli/secret/secret_list.go

View check run for this annotation

Codecov / codecov/patch

cli/secret/secret_list.go#L69

Added line #L69 was not covered by tests
if err != nil {
return err
}
default:
list, err = client.SecretList(repoID)
list, err = client.SecretList(repoID, opt)

Check warning on line 74 in cli/secret/secret_list.go

View check run for this annotation

Codecov / codecov/patch

cli/secret/secret_list.go#L74

Added line #L74 was not covered by tests
if err != nil {
return err
}
Expand Down
5 changes: 4 additions & 1 deletion cli/user/user_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal"
"go.woodpecker-ci.org/woodpecker/v2/woodpecker-go/woodpecker"
)

var userListCmd = &cli.Command{
Expand All @@ -39,7 +40,9 @@
return err
}

users, err := client.UserList()
opt := woodpecker.UserListOptions{}

users, err := client.UserList(opt)

Check warning on line 45 in cli/user/user_list.go

View check run for this annotation

Codecov / codecov/patch

cli/user/user_list.go#L43-L45

Added lines #L43 - L45 were not covered by tests
if err != nil || len(users) == 0 {
return err
}
Expand Down
Loading