public AsyncPageable <Models.Build> ListBuildsAsync( string azdoAccount = default, int?azdoBuildId = default, string azdoProject = default, string buildNumber = default, int?channelId = default, string commit = default, bool?loadCollections = default, DateTimeOffset?notAfter = default, DateTimeOffset?notBefore = default, string repository = default, CancellationToken cancellationToken = default ) { async IAsyncEnumerable <Page <Models.Build> > GetPages(string _continueToken, int?_pageSizeHint) { int?page = 1; int?perPage = _pageSizeHint; if (!string.IsNullOrEmpty(_continueToken)) { page = int.Parse(_continueToken); } while (true) { Page <Models.Build> _page = null; try { _page = await ListBuildsPageAsync( azdoAccount, azdoBuildId, azdoProject, buildNumber, channelId, commit, loadCollections, notAfter, notBefore, page, perPage, repository, cancellationToken ).ConfigureAwait(false); if (_page.Values.Count < 1) { yield break; } } catch (RestApiException e) when(e.Response.Status == 404) { yield break; } yield return(_page); page++; } } return(AsyncPageable.Create(GetPages)); }