/// <summary> /// Создает экземпляр <see cref="List{SearchBuildsRequestModel}"/>. /// </summary> /// <param name="response">Ответ на запрос на сканирование билдов.</param> /// <param name="patterns">Список билдов.</param> /// <returns>Список результатов сканирования.</returns> public static List <SearchBuildsResultModel> Create(ScanForBuildsListResponse response, IList <BuildMatchPatternReadModel> patterns) { return(response .Items .Select(s => { BuildMatchPatternReadModel pattern = patterns.FirstOrDefault(x => x?.Regexp?.Equals(s.PatternMatch, StringComparison.OrdinalIgnoreCase) ?? false); return new SearchBuildsResultModel { BuildsCount = s.BuildsCount, PatternMatchId = pattern?.Id.ToString() }; }) .ToList()); }
/// <inheritdoc /> public Task <IResponseMessage> SearchBuilds(string path, BuildSourceType sourceType, IEnumerable <string> patternsToCheck) { var response = new ScanForBuildsListResponse() { Items = new List <ScanForBuildsResult> { new ScanForBuildsResult { PatternMatch = Guid.NewGuid().ToString(), BuildsCount = 25 } } }; return(Task.FromResult <IResponseMessage>(response)); }