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

Method ListLabelsIter

github/github-iterators.go:3634–3662  ·  view source on GitHub ↗

ListLabelsIter returns an iterator that paginates through all results of ListLabels.

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

Source from the content-addressed store, hash-verified

3632
3633// ListLabelsIter returns an iterator that paginates through all results of ListLabels.
3634func (s *IssuesService) ListLabelsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Label, error] {
3635 return func(yield func(*Label, error) bool) {
3636 // Create a copy of opts to avoid mutating the caller's struct
3637 if opts == nil {
3638 opts = &ListOptions{}
3639 } else {
3640 opts = Ptr(*opts)
3641 }
3642
3643 for {
3644 results, resp, err := s.ListLabels(ctx, owner, repo, opts)
3645 if err != nil {
3646 yield(nil, err)
3647 return
3648 }
3649
3650 for _, item := range results {
3651 if !yield(item, nil) {
3652 return
3653 }
3654 }
3655
3656 if resp.NextPage == 0 {
3657 break
3658 }
3659 opts.Page = resp.NextPage
3660 }
3661 }
3662}
3663
3664// ListLabelsByIssueIter returns an iterator that paginates through all results of ListLabelsByIssue.
3665func (s *IssuesService) ListLabelsByIssueIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*Label, error] {

Callers 1

Calls 2

ListLabelsMethod · 0.95
PtrFunction · 0.70

Tested by 1