ListLabelsIter returns an iterator that paginates through all results of ListLabels.
(ctx context.Context, owner string, repo string, opts *ListOptions)
| 3632 | |
| 3633 | // ListLabelsIter returns an iterator that paginates through all results of ListLabels. |
| 3634 | func (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. |
| 3665 | func (s *IssuesService) ListLabelsByIssueIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*Label, error] { |