public TaskGroup GetTaskGroup(long?id) { return(_taskGroupService.GetTaskGroup(id.Value)); }
public async Task <CustomBuildDefinitionPayload> GetAsync( string id) { try { var project = getProject(id); var buildId = getAdosId(id); var client = await _azureClient.GetBuildClientAsync(); var definitions = await client .GetFullDefinitionsAsync(project : project, definitionIds : new List <int> { Convert.ToInt32(buildId) }); if (definitions.Count > 1) { throw new Exception("Error: Found more thant one build with the same id"); } if (definitions.Count == 0) { throw new NotFoundException($"Error: Build wit ID: {buildId} not found"); } var result = definitions.FirstOrDefault(); if (result != null) { var appName = result.Name.Split('-'); var name = appName.Length == 0 ? $"Modified+{id}" : appName[0]; var definition = new CustomBuildDefinitionPayload { ApplicationName = name, Branch = result.Repository.DefaultBranch, Repository = result.Repository.Name, QueuePool = result.Queue.Name, BuildRevision = result.Revision.ToString(), Path = result.Path, Project = result.Project.Name, Tags = result.Tags.ToArray(), VariableGroups = result.VariableGroups.Select(x => x.Name).ToArray(), Variables = _variableService.GetVariables(result), CITriggers = new List <CITriggers> { _triggersService.GetCITriggers(result) }, ScheduleTriggers = _triggersService.GetScheduleTriggers(result) }; await _taskGroupService.GetTaskGroup(result, definition); return(definition); } return(null); } catch (NotFoundException) { throw; } catch (Exception e) { throw new Exception("Error: Something went wrong when calling the AzureDevOps API", e); } }