static void Main(string[] _) { try { // Create a session into the platform... using (ISession session = Sessions.GetSession()) { // Open the session session.Open(); Console.WriteLine("Online Report\t\tReport IDs"); Console.WriteLine("=============\t\t================================================================"); // Online Reports Listing var listing = OnlineReportsListing.Definition().GetData(); if (listing.IsSuccess) { foreach (IOnlineReport report in listing.Data.OnlineReports) { Console.Write($"{report.Name}\t"); foreach (var regionReport in report.Reports) { Console.Write($"{regionReport["reportId"]} "); } Console.WriteLine(); } // Get Online Report details IOnlineReportsResponse reportStory = OnlineReports.Definition("OLUSSCIENCE").GetData(); // US Science reports if (reportStory.IsSuccess) { foreach (IOnlineReportStory story in reportStory.Data.OnlineReportStories) { Console.WriteLine("----------------------------------------------------------------------------------"); Console.WriteLine($"{story.CreationDate}: {story.HeadlineTitle}"); Console.WriteLine($"content Type: {story.ContentType}\n{story.NewsStory}"); } } } else { Console.WriteLine(listing.HttpStatus); } } } catch (Exception e) { Console.WriteLine($"\n**************\nFailed to execute: {e.Message}\n{e.InnerException}\n***************"); } }
static void Main(string[] _) { try { // Create a session into the platform... using (ISession session = Configuration.Sessions.GetSession()) { // Open the session session.Open(); // Display Image - hardcoded ID Console.WriteLine("\nImage based on hardcoded ID"); RetrieveImage("d42c794f-7650-48a4-9eb9-362f2722f9c6"); // Display Image - based on OnlineReports query string imageId = null; var reportStory = OnlineReports.Definition("OLGBTOPNEWS").GetData(); // US Top News if (reportStory.IsSuccess) { // Walk through the reports until we find an Image foreach (IOnlineReportStory story in reportStory.Data.OnlineReportStories) { // The images are buried within the body of the report var link = story.Raw["newsItem"]?["itemMeta"]?["link"] as JArray; if (link != null) { imageId = (string)link[0]["_residref"]; break; } } } if (imageId != null) { Console.WriteLine("\nImage based on US Top News online reports"); RetrieveImage(imageId); } } } catch (Exception e) { Console.WriteLine($"\n**************\nFailed to execute: {e.Message}\n{e.InnerException}\n***************"); } }