ListUserProjectsIter returns an iterator that paginates through all results of ListUserProjects.
(ctx context.Context, username string, opts *ListProjectsOptions)
| 4954 | |
| 4955 | // ListUserProjectsIter returns an iterator that paginates through all results of ListUserProjects. |
| 4956 | func (s *ProjectsService) ListUserProjectsIter(ctx context.Context, username string, opts *ListProjectsOptions) iter.Seq2[*ProjectV2, error] { |
| 4957 | return func(yield func(*ProjectV2, error) bool) { |
| 4958 | // Create a copy of opts to avoid mutating the caller's struct |
| 4959 | if opts == nil { |
| 4960 | opts = &ListProjectsOptions{} |
| 4961 | } else { |
| 4962 | opts = Ptr(*opts) |
| 4963 | } |
| 4964 | |
| 4965 | for { |
| 4966 | results, resp, err := s.ListUserProjects(ctx, username, opts) |
| 4967 | if err != nil { |
| 4968 | yield(nil, err) |
| 4969 | return |
| 4970 | } |
| 4971 | |
| 4972 | for _, item := range results { |
| 4973 | if !yield(item, nil) { |
| 4974 | return |
| 4975 | } |
| 4976 | } |
| 4977 | |
| 4978 | if resp.After == "" { |
| 4979 | break |
| 4980 | } |
| 4981 | opts.After = resp.After |
| 4982 | } |
| 4983 | } |
| 4984 | } |
| 4985 | |
| 4986 | // ListIter returns an iterator that paginates through all results of List. |
| 4987 | func (s *PullRequestsService) ListIter(ctx context.Context, owner string, repo string, opts *PullRequestListOptions) iter.Seq2[*PullRequest, error] { |