ListUserMigrationsIter returns an iterator that paginates through all results of ListUserMigrations.
(ctx context.Context, opts *ListOptions)
| 3973 | |
| 3974 | // ListUserMigrationsIter returns an iterator that paginates through all results of ListUserMigrations. |
| 3975 | func (s *MigrationService) ListUserMigrationsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*UserMigration, error] { |
| 3976 | return func(yield func(*UserMigration, error) bool) { |
| 3977 | // Create a copy of opts to avoid mutating the caller's struct |
| 3978 | if opts == nil { |
| 3979 | opts = &ListOptions{} |
| 3980 | } else { |
| 3981 | opts = Ptr(*opts) |
| 3982 | } |
| 3983 | |
| 3984 | for { |
| 3985 | results, resp, err := s.ListUserMigrations(ctx, opts) |
| 3986 | if err != nil { |
| 3987 | yield(nil, err) |
| 3988 | return |
| 3989 | } |
| 3990 | |
| 3991 | for _, item := range results { |
| 3992 | if !yield(item, nil) { |
| 3993 | return |
| 3994 | } |
| 3995 | } |
| 3996 | |
| 3997 | if resp.NextPage == 0 { |
| 3998 | break |
| 3999 | } |
| 4000 | opts.Page = resp.NextPage |
| 4001 | } |
| 4002 | } |
| 4003 | } |
| 4004 | |
| 4005 | // ListIter returns an iterator that paginates through all results of List. |
| 4006 | func (s *OrganizationsService) ListIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*Organization, error] { |