ListTeamsIter returns an iterator that paginates through all results of ListTeams.
(ctx context.Context, org string, opts *ListOptions)
| 7163 | |
| 7164 | // ListTeamsIter returns an iterator that paginates through all results of ListTeams. |
| 7165 | func (s *TeamsService) ListTeamsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Team, error] { |
| 7166 | return func(yield func(*Team, error) bool) { |
| 7167 | // Create a copy of opts to avoid mutating the caller's struct |
| 7168 | if opts == nil { |
| 7169 | opts = &ListOptions{} |
| 7170 | } else { |
| 7171 | opts = Ptr(*opts) |
| 7172 | } |
| 7173 | |
| 7174 | for { |
| 7175 | results, resp, err := s.ListTeams(ctx, org, opts) |
| 7176 | if err != nil { |
| 7177 | yield(nil, err) |
| 7178 | return |
| 7179 | } |
| 7180 | |
| 7181 | for _, item := range results { |
| 7182 | if !yield(item, nil) { |
| 7183 | return |
| 7184 | } |
| 7185 | } |
| 7186 | |
| 7187 | if resp.NextPage == 0 { |
| 7188 | break |
| 7189 | } |
| 7190 | opts.Page = resp.NextPage |
| 7191 | } |
| 7192 | } |
| 7193 | } |
| 7194 | |
| 7195 | // ListUserTeamsIter returns an iterator that paginates through all results of ListUserTeams. |
| 7196 | func (s *TeamsService) ListUserTeamsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Team, error] { |