ListByUserIter returns an iterator that paginates through all results of ListByUser.
(ctx context.Context, user string, opts *RepositoryListByUserOptions)
| 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] { |
| 5717 | return func(yield func(*Repository, error) bool) { |
| 5718 | // Create a copy of opts to avoid mutating the caller's struct |
| 5719 | if opts == nil { |
| 5720 | opts = &RepositoryListByUserOptions{} |
| 5721 | } else { |
| 5722 | opts = Ptr(*opts) |
| 5723 | } |
| 5724 | |
| 5725 | for { |
| 5726 | results, resp, err := s.ListByUser(ctx, user, opts) |
| 5727 | if err != nil { |
| 5728 | yield(nil, err) |
| 5729 | return |
| 5730 | } |
| 5731 | |
| 5732 | for _, item := range results { |
| 5733 | if !yield(item, nil) { |
| 5734 | return |
| 5735 | } |
| 5736 | } |
| 5737 | |
| 5738 | if resp.NextPage == 0 { |
| 5739 | break |
| 5740 | } |
| 5741 | opts.ListOptions.Page = resp.NextPage |
| 5742 | } |
| 5743 | } |
| 5744 | } |
| 5745 | |
| 5746 | // ListCollaboratorsIter returns an iterator that paginates through all results of ListCollaborators. |
| 5747 | func (s *RepositoriesService) ListCollaboratorsIter(ctx context.Context, owner string, repo string, opts *ListCollaboratorsOptions) iter.Seq2[*User, error] { |