Exemplo n.º 1
0
        public async Task <List <TfsRestProjectCollection> > GetBuildDefinitionsGrouped(string url, string username, string password)
        {
            var resultProjectCollections = new List <TfsRestProjectCollection>();

            TfsConnectionDetails connection = new TfsConnectionDetails(url, username, password);
            var projectCollections          = await _tfsJsonService.GetProjectCollections(connection);

            foreach (var projectCollection in projectCollections)
            {
                //substitue the project name with DefaultCollection as defined in VSO REST API documenation
                projectCollection.Name = SubstituteName(url, projectCollection.Name);
                var resultProjectCollection = new TfsRestProjectCollection(projectCollection);
                var projects = await _tfsJsonService.GetProjects(connection, projectCollection.Name);

                foreach (var project in projects)
                {
                    var resultProject = new TfsRestProject(project);
                    resultProjectCollection.Projects.Add(resultProject);
                    var buildDefinitions = await GetBuildDefinitions(connection, projectCollection, project);

                    resultProject.BuildDefinitions = buildDefinitions;
                }
                resultProjectCollections.Add(resultProjectCollection);
            }
            return(resultProjectCollections);
        }
 public async Task<List<TfsRestProjectCollection>>  GetBuildDefinitionsGrouped(string url, string username, string password)
 {
     TfsConnectionDetails connection = new TfsConnectionDetails(url, username, password);
     var projectCollections = await _tfsJsonService.GetProjectCollections(connection);
     var resultProjectCollections = new List<TfsRestProjectCollection>();
     foreach (var projectCollection in projectCollections)
     {
         var resultProjectCollection = new TfsRestProjectCollection(projectCollection);
         var projects = await _tfsJsonService.GetProjects(connection, projectCollection.Name);
         foreach (var project in projects)
         {
             var resultProject = new TfsRestProject(project);
             resultProjectCollection.Projects.Add(resultProject);
             var buildDefinitions = await GetBuildDefinitions(connection, projectCollection, project);
             resultProject.BuildDefinitions = buildDefinitions;
         }
         resultProjectCollections.Add(resultProjectCollection);
     }
     return resultProjectCollections;
 }