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

Method ListStatusesIter

github/github-iterators.go:6379–6407  ·  view source on GitHub ↗

ListStatusesIter returns an iterator that paginates through all results of ListStatuses.

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

Source from the content-addressed store, hash-verified

6377
6378// ListStatusesIter returns an iterator that paginates through all results of ListStatuses.
6379func (s *RepositoriesService) ListStatusesIter(ctx context.Context, owner string, repo string, ref string, opts *ListOptions) iter.Seq2[*RepoStatus, error] {
6380 return func(yield func(*RepoStatus, error) bool) {
6381 // Create a copy of opts to avoid mutating the caller's struct
6382 if opts == nil {
6383 opts = &ListOptions{}
6384 } else {
6385 opts = Ptr(*opts)
6386 }
6387
6388 for {
6389 results, resp, err := s.ListStatuses(ctx, owner, repo, ref, opts)
6390 if err != nil {
6391 yield(nil, err)
6392 return
6393 }
6394
6395 for _, item := range results {
6396 if !yield(item, nil) {
6397 return
6398 }
6399 }
6400
6401 if resp.NextPage == 0 {
6402 break
6403 }
6404 opts.Page = resp.NextPage
6405 }
6406 }
6407}
6408
6409// ListTagsIter returns an iterator that paginates through all results of ListTags.
6410func (s *RepositoriesService) ListTagsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*RepositoryTag, error] {

Calls 2

ListStatusesMethod · 0.95
PtrFunction · 0.70

Tested by 1