MCPcopy Create free account
hub / github.com/google/go-github / ListWatchersIter

Method ListWatchersIter

github/github-iterators.go:1471–1499  ·  view source on GitHub ↗

ListWatchersIter returns an iterator that paginates through all results of ListWatchers.

(ctx context.Context, owner string, repo string, opts *ListOptions)

Source from the content-addressed store, hash-verified

1469
1470// ListWatchersIter returns an iterator that paginates through all results of ListWatchers.
1471func (s *ActivityService) ListWatchersIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*User, error] {
1472 return func(yield func(*User, error) bool) {
1473 // Create a copy of opts to avoid mutating the caller's struct
1474 if opts == nil {
1475 opts = &ListOptions{}
1476 } else {
1477 opts = Ptr(*opts)
1478 }
1479
1480 for {
1481 results, resp, err := s.ListWatchers(ctx, owner, repo, opts)
1482 if err != nil {
1483 yield(nil, err)
1484 return
1485 }
1486
1487 for _, item := range results {
1488 if !yield(item, nil) {
1489 return
1490 }
1491 }
1492
1493 if resp.NextPage == 0 {
1494 break
1495 }
1496 opts.Page = resp.NextPage
1497 }
1498 }
1499}
1500
1501// ListHookDeliveriesIter returns an iterator that paginates through all results of ListHookDeliveries.
1502func (s *AppsService) ListHookDeliveriesIter(ctx context.Context, opts *ListCursorOptions) iter.Seq2[*HookDelivery, error] {

Callers 1

Calls 2

ListWatchersMethod · 0.95
PtrFunction · 0.70

Tested by 1