public async Task <BlogPostDetails> GetBlogPostDetails(string postId, bool detailed) { var metadataUri = BlogPostUriHelper.GetMetadataFileUri(postId); var metadata = await httpClient.GetFromJsonAsync <BlogPostMetadata>(metadataUri); var markdownFile = detailed ? metadata.MarkdownFile ?? metadata.SummaryMarkdownFile : metadata.SummaryMarkdownFile; var markdownUri = BlogPostUriHelper.GetContentFileUri(postId, markdownFile); var markdown = await httpClient.GetStringAsync(markdownUri); return(new BlogPostDetails(postId, metadata, markdown)); }
private async Task <IEnumerable <string> > GetPostIds() { #if DEBUG return(new[] { "test-post" }); #else var hitHubContentUrl = BlogPostUriHelper.GetGitHubContentUrl(); var postIds = await Observable .FromAsync(() => httpClient.GetFromJsonAsync <GitHubContent[]>(hitHubContentUrl)) .SelectMany(x => x) .Select(x => x.Name) .ToList(); return(postIds); #endif }