ListCopilotSeatsIter returns an iterator that paginates through all results of ListCopilotSeats.
(ctx context.Context, org string, opts *ListOptions)
| 2434 | |
| 2435 | // ListCopilotSeatsIter returns an iterator that paginates through all results of ListCopilotSeats. |
| 2436 | func (s *CopilotService) ListCopilotSeatsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*CopilotSeatDetails, error] { |
| 2437 | return func(yield func(*CopilotSeatDetails, error) bool) { |
| 2438 | // Create a copy of opts to avoid mutating the caller's struct |
| 2439 | if opts == nil { |
| 2440 | opts = &ListOptions{} |
| 2441 | } else { |
| 2442 | opts = Ptr(*opts) |
| 2443 | } |
| 2444 | |
| 2445 | for { |
| 2446 | results, resp, err := s.ListCopilotSeats(ctx, org, opts) |
| 2447 | if err != nil { |
| 2448 | yield(nil, err) |
| 2449 | return |
| 2450 | } |
| 2451 | |
| 2452 | var iterItems []*CopilotSeatDetails |
| 2453 | if results != nil { |
| 2454 | iterItems = results.Seats |
| 2455 | } |
| 2456 | for _, item := range iterItems { |
| 2457 | if !yield(item, nil) { |
| 2458 | return |
| 2459 | } |
| 2460 | } |
| 2461 | |
| 2462 | if resp.NextPage == 0 { |
| 2463 | break |
| 2464 | } |
| 2465 | opts.Page = resp.NextPage |
| 2466 | } |
| 2467 | } |
| 2468 | } |
| 2469 | |
| 2470 | // ListOrganizationCodingAgentRepositoriesIter returns an iterator that paginates through all results of ListOrganizationCodingAgentRepositories. |
| 2471 | func (s *CopilotService) ListOrganizationCodingAgentRepositoriesIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Repository, error] { |