MCPcopy Index your code
hub / github.com/google/go-github / ListKeysIter

Method ListKeysIter

github/github-iterators.go:7448–7476  ·  view source on GitHub ↗

ListKeysIter returns an iterator that paginates through all results of ListKeys.

(ctx context.Context, user string, opts *ListOptions)

Source from the content-addressed store, hash-verified

7446
7447// ListKeysIter returns an iterator that paginates through all results of ListKeys.
7448func (s *UsersService) ListKeysIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*Key, error] {
7449 return func(yield func(*Key, error) bool) {
7450 // Create a copy of opts to avoid mutating the caller's struct
7451 if opts == nil {
7452 opts = &ListOptions{}
7453 } else {
7454 opts = Ptr(*opts)
7455 }
7456
7457 for {
7458 results, resp, err := s.ListKeys(ctx, user, opts)
7459 if err != nil {
7460 yield(nil, err)
7461 return
7462 }
7463
7464 for _, item := range results {
7465 if !yield(item, nil) {
7466 return
7467 }
7468 }
7469
7470 if resp.NextPage == 0 {
7471 break
7472 }
7473 opts.Page = resp.NextPage
7474 }
7475 }
7476}
7477
7478// ListPackageVersionsIter returns an iterator that paginates through all results of ListPackageVersions.
7479func (s *UsersService) ListPackageVersionsIter(ctx context.Context, packageType string, packageName string, opts *ListPackageVersionsOptions) iter.Seq2[*PackageVersion, error] {

Calls 2

ListKeysMethod · 0.95
PtrFunction · 0.70