public async Task <ArticleEntryResponse> GetLatestArticleEntryFromContext() { var articleContext = await _getArticleContextWorkflow.GetArticleContext(); if (articleContext == null) { return(null); } var getEntryLink = articleContext.GetApiLink(LinkRelValueObject.ENTRY); if (string.IsNullOrWhiteSpace(getEntryLink)) { return(null); } var responseMessage = await _client.GetMessage(getEntryLink); if (!responseMessage.IsSuccessStatusCode) { return(null); } var entryResponseContents = await responseMessage.Content.ReadAsStringAsync(); var articleEntry = JsonUtility.Deserialize <ArticleEntryResponse>(entryResponseContents); return(articleEntry); }
private async Task StoreArticleContext(string uri) { var getArticleResponse = await _client.GetMessage(uri); if (!getArticleResponse.IsSuccessStatusCode) { throw new HttpRequestException( $"failed HTTP request: {getArticleResponse.StatusCode}\n{getArticleResponse.ReasonPhrase}"); } var blogContentTask = getArticleResponse.Content.ReadAsStringAsync(); await _fileProvider.WriteMetaFile(MetaFileNameValues.ARTICLE, blogContentTask); var contents = await blogContentTask; contents = JsonUtility.Prettify <ArticleResponse>(contents); Console.WriteLine(contents); }
public async Task SendHealthCheckPing() { var response = await _client.GetMessage(BogApiRouteValues.PING); Console.WriteLine($"ping response: {response.StatusCode}\n{response}"); }