ListOrgMembershipsIter returns an iterator that paginates through all results of ListOrgMemberships.
(ctx context.Context, opts *ListOrgMembershipsOptions)
| 4578 | |
| 4579 | // ListOrgMembershipsIter returns an iterator that paginates through all results of ListOrgMemberships. |
| 4580 | func (s *OrganizationsService) ListOrgMembershipsIter(ctx context.Context, opts *ListOrgMembershipsOptions) iter.Seq2[*Membership, error] { |
| 4581 | return func(yield func(*Membership, error) bool) { |
| 4582 | // Create a copy of opts to avoid mutating the caller's struct |
| 4583 | if opts == nil { |
| 4584 | opts = &ListOrgMembershipsOptions{} |
| 4585 | } else { |
| 4586 | opts = Ptr(*opts) |
| 4587 | } |
| 4588 | |
| 4589 | for { |
| 4590 | results, resp, err := s.ListOrgMemberships(ctx, opts) |
| 4591 | if err != nil { |
| 4592 | yield(nil, err) |
| 4593 | return |
| 4594 | } |
| 4595 | |
| 4596 | for _, item := range results { |
| 4597 | if !yield(item, nil) { |
| 4598 | return |
| 4599 | } |
| 4600 | } |
| 4601 | |
| 4602 | if resp.NextPage == 0 { |
| 4603 | break |
| 4604 | } |
| 4605 | opts.ListOptions.Page = resp.NextPage |
| 4606 | } |
| 4607 | } |
| 4608 | } |
| 4609 | |
| 4610 | // ListOutsideCollaboratorsIter returns an iterator that paginates through all results of ListOutsideCollaborators. |
| 4611 | func (s *OrganizationsService) ListOutsideCollaboratorsIter(ctx context.Context, org string, opts *ListOutsideCollaboratorsOptions) iter.Seq2[*User, error] { |