public async Task <HttpResponse> Get(string slug = "", string searchTerm = "", string searchFolder = "", string currentUrl = "")
        {
            var url          = _urlGenerator.UrlFor <Article>(slug);
            var httpResponse = await _httpClient.Get(url, authenticationHeaders);

            if (!httpResponse.IsSuccessful())
            {
                return(httpResponse);
            }

            var model   = HttpResponse.Build <Article>(httpResponse);
            var article = (Article)model.Content;
            var bucket  = new S3BucketSearch();

            bucket.Files        = new List <string>();
            bucket.Folders      = new List <string>();
            bucket.Slug         = slug;
            bucket.SearchTerm   = searchTerm;
            bucket.SearchFolder = searchFolder;
            bucket.AWSLink      = ServiceUrl;
            bucket.S3Bucket     = BucketName;
            bucket.CurrentUrl   = currentUrl;
            if (!string.IsNullOrEmpty(searchTerm) && !string.IsNullOrEmpty(searchFolder))
            {
                bucket.Files = await ListFilesIn(searchFolder, searchTerm);
            }
            article.S3Bucket = bucket;

            var processedModel = _articleFactory.Build(article);

            return(HttpResponse.Successful(200, processedModel));
        }
        private async Task AddNewArticle(Guid mediaId, FeedItem feedItem)
        {
            try {
                var article = await _articleFactory.Build(mediaId, feedItem);

                await _repository.Save(article);
            }
            catch (UnreachableWebDocumentException) { }
        }
Beispiel #3
0
        public async Task Build_new_article_from_external_article()
        {
            var mediaId = Guid.NewGuid();

            var feedItem = SomeFeedItem();

            var article = await _articleFactory.Build(mediaId, feedItem);

            article
            .GetUncommittedChanges()
            .Should()
            .BeEquivalentTo(new DomainEvent[] {
                new ArticleImported(