ListCheckRunsForRefIter returns an iterator that paginates through all results of ListCheckRunsForRef.
(ctx context.Context, owner string, repo string, ref string, opts *ListCheckRunsOptions)
| 1760 | |
| 1761 | // ListCheckRunsForRefIter returns an iterator that paginates through all results of ListCheckRunsForRef. |
| 1762 | func (s *ChecksService) ListCheckRunsForRefIter(ctx context.Context, owner string, repo string, ref string, opts *ListCheckRunsOptions) iter.Seq2[*CheckRun, error] { |
| 1763 | return func(yield func(*CheckRun, error) bool) { |
| 1764 | // Create a copy of opts to avoid mutating the caller's struct |
| 1765 | if opts == nil { |
| 1766 | opts = &ListCheckRunsOptions{} |
| 1767 | } else { |
| 1768 | opts = Ptr(*opts) |
| 1769 | } |
| 1770 | |
| 1771 | for { |
| 1772 | results, resp, err := s.ListCheckRunsForRef(ctx, owner, repo, ref, opts) |
| 1773 | if err != nil { |
| 1774 | yield(nil, err) |
| 1775 | return |
| 1776 | } |
| 1777 | |
| 1778 | var iterItems []*CheckRun |
| 1779 | if results != nil { |
| 1780 | iterItems = results.CheckRuns |
| 1781 | } |
| 1782 | for _, item := range iterItems { |
| 1783 | if !yield(item, nil) { |
| 1784 | return |
| 1785 | } |
| 1786 | } |
| 1787 | |
| 1788 | if resp.NextPage == 0 { |
| 1789 | break |
| 1790 | } |
| 1791 | opts.ListOptions.Page = resp.NextPage |
| 1792 | } |
| 1793 | } |
| 1794 | } |
| 1795 | |
| 1796 | // ListCheckSuitesForRefIter returns an iterator that paginates through all results of ListCheckSuitesForRef. |
| 1797 | func (s *ChecksService) ListCheckSuitesForRefIter(ctx context.Context, owner string, repo string, ref string, opts *ListCheckSuiteOptions) iter.Seq2[*CheckSuite, error] { |