ListCheckSuitesForRefIter returns an iterator that paginates through all results of ListCheckSuitesForRef.
(ctx context.Context, owner string, repo string, ref string, opts *ListCheckSuiteOptions)
| 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] { |
| 1798 | return func(yield func(*CheckSuite, error) bool) { |
| 1799 | // Create a copy of opts to avoid mutating the caller's struct |
| 1800 | if opts == nil { |
| 1801 | opts = &ListCheckSuiteOptions{} |
| 1802 | } else { |
| 1803 | opts = Ptr(*opts) |
| 1804 | } |
| 1805 | |
| 1806 | for { |
| 1807 | results, resp, err := s.ListCheckSuitesForRef(ctx, owner, repo, ref, opts) |
| 1808 | if err != nil { |
| 1809 | yield(nil, err) |
| 1810 | return |
| 1811 | } |
| 1812 | |
| 1813 | var iterItems []*CheckSuite |
| 1814 | if results != nil { |
| 1815 | iterItems = results.CheckSuites |
| 1816 | } |
| 1817 | for _, item := range iterItems { |
| 1818 | if !yield(item, nil) { |
| 1819 | return |
| 1820 | } |
| 1821 | } |
| 1822 | |
| 1823 | if resp.NextPage == 0 { |
| 1824 | break |
| 1825 | } |
| 1826 | opts.ListOptions.Page = resp.NextPage |
| 1827 | } |
| 1828 | } |
| 1829 | } |
| 1830 | |
| 1831 | // ListAcceptedAssignmentsIter returns an iterator that paginates through all results of ListAcceptedAssignments. |
| 1832 | func (s *ClassroomService) ListAcceptedAssignmentsIter(ctx context.Context, assignmentID int64, opts *ListOptions) iter.Seq2[*AcceptedAssignment, error] { |