public async IAsyncEnumerable <List <BuildDefinition> > GetFullBuildDefinitionsWithRetryAsync(string projectName)
        {
            IPagedList <BuildDefinition> currentDefinitions;
            string continuationToken = null;

            do
            {
                currentDefinitions = await RetryHelper.SleepAndRetry(VssClientHelper.GetRetryAfter(this.LastResponseContext), this.logger, async() =>
                {
                    this.logger.LogInformation($"Retrieving full build definitions from Azure DevOps for project {projectName}");
                    IPagedList <BuildDefinition> retrievedBuildDefs = await this.GetFullDefinitionsAsync2(project: projectName, top: 2000, queryOrder: DefinitionQueryOrder.LastModifiedAscending, continuationToken: continuationToken);
                    this.logger.LogInformation($"Done Retrieving {retrievedBuildDefs.Count} build definitions");
                    return(retrievedBuildDefs);
                });

                continuationToken = currentDefinitions.ContinuationToken;
                yield return(currentDefinitions.ToList());
            }while (continuationToken != null);
        }
 internal VssGitClient(Uri baseUrl, VssCredentials credentials, ILogger logger) : base(baseUrl, credentials)
 {
     this.logger     = logger;
     this.retryAfter = VssClientHelper.GetRetryAfter(this.LastResponseContext);
 }
        public async Task <List <BuildDefinitionReference> > GetBuildDefinitionsAsync(string projectName)
        {
            this.logger.LogInformation($"Retrieving build definitions from Azure DevOps for project {projectName}...");

            List <BuildDefinitionReference> buildDefinitionReferences = await RetryHelper.SleepAndRetry(VssClientHelper.GetRetryAfter(this.LastResponseContext), this.logger, async() =>
            {
                List <BuildDefinitionReference> buildDefinitionReferences = new List <BuildDefinitionReference>();
                IPagedList <BuildDefinitionReference> currentDefinitionReferences;
                do
                {
                    currentDefinitionReferences = await this.GetDefinitionsAsync2(project: projectName);
                    buildDefinitionReferences.AddRange(currentDefinitionReferences);
                }while (!currentDefinitionReferences.ContinuationToken.IsNullOrEmpty());

                return(buildDefinitionReferences);
            });

            this.logger.LogInformation($"Done retrieving {buildDefinitionReferences.Count} build definitions");
            return(buildDefinitionReferences);
        }