ListClassroomsIter returns an iterator that paginates through all results of ListClassrooms.
(ctx context.Context, opts *ListOptions)
| 1892 | |
| 1893 | // ListClassroomsIter returns an iterator that paginates through all results of ListClassrooms. |
| 1894 | func (s *ClassroomService) ListClassroomsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Classroom, error] { |
| 1895 | return func(yield func(*Classroom, error) bool) { |
| 1896 | // Create a copy of opts to avoid mutating the caller's struct |
| 1897 | if opts == nil { |
| 1898 | opts = &ListOptions{} |
| 1899 | } else { |
| 1900 | opts = Ptr(*opts) |
| 1901 | } |
| 1902 | |
| 1903 | for { |
| 1904 | results, resp, err := s.ListClassrooms(ctx, opts) |
| 1905 | if err != nil { |
| 1906 | yield(nil, err) |
| 1907 | return |
| 1908 | } |
| 1909 | |
| 1910 | for _, item := range results { |
| 1911 | if !yield(item, nil) { |
| 1912 | return |
| 1913 | } |
| 1914 | } |
| 1915 | |
| 1916 | if resp.NextPage == 0 { |
| 1917 | break |
| 1918 | } |
| 1919 | opts.Page = resp.NextPage |
| 1920 | } |
| 1921 | } |
| 1922 | } |
| 1923 | |
| 1924 | // ListAlertInstancesIter returns an iterator that paginates through all results of ListAlertInstances. |
| 1925 | func (s *CodeScanningService) ListAlertInstancesIter(ctx context.Context, owner string, repo string, id int64, opts *AlertInstancesListOptions) iter.Seq2[*MostRecentInstance, error] { |