ListByOrgIter returns an iterator that paginates through all results of ListByOrg.
(ctx context.Context, org string, opts *RepositoryListByOrgOptions)
| 5683 | |
| 5684 | // ListByOrgIter returns an iterator that paginates through all results of ListByOrg. |
| 5685 | func (s *RepositoriesService) ListByOrgIter(ctx context.Context, org string, opts *RepositoryListByOrgOptions) iter.Seq2[*Repository, error] { |
| 5686 | return func(yield func(*Repository, error) bool) { |
| 5687 | // Create a copy of opts to avoid mutating the caller's struct |
| 5688 | if opts == nil { |
| 5689 | opts = &RepositoryListByOrgOptions{} |
| 5690 | } else { |
| 5691 | opts = Ptr(*opts) |
| 5692 | } |
| 5693 | |
| 5694 | for { |
| 5695 | results, resp, err := s.ListByOrg(ctx, org, opts) |
| 5696 | if err != nil { |
| 5697 | yield(nil, err) |
| 5698 | return |
| 5699 | } |
| 5700 | |
| 5701 | for _, item := range results { |
| 5702 | if !yield(item, nil) { |
| 5703 | return |
| 5704 | } |
| 5705 | } |
| 5706 | |
| 5707 | if resp.NextPage == 0 { |
| 5708 | break |
| 5709 | } |
| 5710 | opts.ListOptions.Page = resp.NextPage |
| 5711 | } |
| 5712 | } |
| 5713 | } |
| 5714 | |
| 5715 | // ListByUserIter returns an iterator that paginates through all results of ListByUser. |
| 5716 | func (s *RepositoriesService) ListByUserIter(ctx context.Context, user string, opts *RepositoryListByUserOptions) iter.Seq2[*Repository, error] { |