public override async Task <int> OnExecute(CommandLineApplication app) { if (!DateTime.TryParse(FromDate, out var fromDate)) { throw new InvalidOperationException(); } if (!DateTime.TryParse(ToDateTime, out var toDate)) { throw new InvalidOperationException(); } var response = await _topicService.Search(SpaceKey, TopicId, fromDate, toDate); var layout = _layoutRepository.Get(Layout); layout.Output(response.Select(r => new { r.TopicId, PostId = r.Id, Url = $"https://typetalk.com/topics/{r.TopicId}/posts/{r.Id}", r.CreatedAt, AccoutName = r.Account.Name, Message = r.Message, LikesCount = r.Likes.Length }).OrderBy(p => p.CreatedAt)); return(0); }
public override async Task <int> OnExecute(CommandLineApplication app) { if (!DateTime.TryParse(FromDate, out var fromDate)) { throw new InvalidOperationException(); } if (!DateTime.TryParse(ToDateTime, out var toDate)) { throw new InvalidOperationException(); } var response = await _topicService.Search(SpaceKey, TopicId, fromDate, toDate); var layout = _layoutRepository.Get(Layout); if (!int.TryParse(Take, out var takeCount)) { takeCount = 100; } layout.Output(response .Select(r => new { r.CreatedAt, r.Message, r.Account.Name, LikedCount = r.Likes?.Length ?? 0 }) .OrderByDescending(r => r.LikedCount) .Take(takeCount) ); return(0); }
public override async Task <int> OnExecute(CommandLineApplication app) { if (!DateTime.TryParse(FromDate, out var fromDate)) { throw new InvalidOperationException(); } if (!DateTime.TryParse(ToDateTime, out var toDate)) { throw new InvalidOperationException(); } var response = await _topicService.Search(SpaceKey, TopicId, fromDate, toDate); var layout = _layoutRepository.Get(Layout); if (!int.TryParse(Take, out var takeCount)) { takeCount = 100; } layout.Output(response .SelectMany(r => r.Talks) .GroupBy(t => t.Name) .Select(t => new { Name = t.Key, Count = t.Count() }) .OrderByDescending(t => t.Count) .Take(takeCount) ); return(0); }
public override async Task <int> OnExecute(CommandLineApplication app) { var response = await _spaceService.GetMySpaces(); var layout = _layoutRepository.Get(Layout); layout.Output(response.MySpaces.Select(s => new { s.Space.Key, s.Space.Name })); return(0); }
public override async Task <int> OnExecute(CommandLineApplication app) { var response = await _topicService.GetTopics(SpaceKey); var layout = _layoutRepository.Get(Layout); layout.Output(response.Topics.Select(t => new { t.Topic.Id, t.Topic.Name, t.Topic.Description })); return(0); }
public OutputFile Impose(BatchMetadata batch) { var layout = _layoutRepository.Get(batch.LayoutKey); _validator.ValidateLayout(layout); var imposition = _impositionRepository.Get(batch.ImpositionKey); var outputFileBuilder = _fileBuilderFactory.Get(layout, imposition); var sourceFiles = batch.AlbumIds.Select(albumId => _sourceFilesRepository.Get(albumId)).ToList(); _validator.ValidateSourceFiles(sourceFiles, layout, imposition); var outputFile = outputFileBuilder.Build(sourceFiles); return(outputFile); }
public override async Task <int> OnExecute(CommandLineApplication app) { if (!DateTime.TryParse(FromDate, out var fromDate)) { throw new InvalidOperationException(); } if (!DateTime.TryParse(ToDateTime, out var toDate)) { throw new InvalidOperationException(); } var response = await _topicService.Search(SpaceKey, TopicId, fromDate, toDate); var layout = _layoutRepository.Get(Layout); layout.Output(response.SelectMany(p => p.Likes.Select(l => l.Account.Name), (p, a) => a).GroupBy(a => a) .OrderByDescending(g => g.Count()).Select(g => new { UserId = g.Key, LikeCount = g.Count() })); return(0); }