diff --git a/Examples/GetPredictionsBasic/Program.cs b/Examples/GetPredictionsBasic/Program.cs index 889bbe0..8216c14 100644 --- a/Examples/GetPredictionsBasic/Program.cs +++ b/Examples/GetPredictionsBasic/Program.cs @@ -1,9 +1,7 @@ using System; using System.IO; -using System.Linq; using System.Threading.Tasks; using IndicoV2; -using Newtonsoft.Json.Linq; namespace Examples { @@ -18,23 +16,10 @@ private static string GetToken() => public static async Task Main() { - var client = new IndicoClient(GetToken(), new Uri("https://app.indico.io")); - - var submissionClient = client.Submissions(); - - var storageClient = client.Storage(); - - int submissionId = 152070; - var submission = await submissionClient.GetAsync(submissionId); - - string resultFileUrl = submission.ResultFile; - var storageResult = await storageClient.GetAsync(new Uri(resultFileUrl), default); - using (var reader = new StreamReader(storageResult)) - { - string resultAsString = reader.ReadToEnd(); - JObject resultObject = JObject.Parse(resultAsString); - Console.WriteLine(resultObject); - } + var client = new IndicoClient(GetToken(), new Uri("https://try.indico.io")); + int submissionId = 91345; + var jobResult = await client.GetSubmissionResultAwaiter().WaitReady(submissionId); + Console.WriteLine(jobResult); } } } diff --git a/Examples/GetPredictionsWithReview/Program.cs b/Examples/GetPredictionsWithReview/Program.cs index 940369b..23f5264 100644 --- a/Examples/GetPredictionsWithReview/Program.cs +++ b/Examples/GetPredictionsWithReview/Program.cs @@ -1,6 +1,5 @@ using System; using System.IO; -using System.Linq; using System.Threading.Tasks; using IndicoV2; using Newtonsoft.Json.Linq; @@ -18,26 +17,18 @@ private static string GetToken() => public static async Task Main() { - var client = new IndicoClient(GetToken(), new Uri("https://app.indico.io")); + var client = new IndicoClient(GetToken(), new Uri("https://try.indico.io")); + int submissionId = 91345; - var submissionClient = client.Submissions(); - - var jobClient = client.Jobs(); - - var storageClient = client.Storage(); - - int submissionId = 152070; - var submission = await submissionClient.GetAsync(submissionId); - - string jobId = await submissionClient.GenerateSubmissionResultAsync(submissionId); - JToken jobResult = await jobClient.GetResultAsync(jobId); + string jobId = await client.Submissions().GenerateSubmissionResultAsync(submissionId); + var jobResult = await client.JobAwaiter().WaitReadyAsync(jobId, default, default); string jobResultUrl = jobResult.Value("url"); - var storageResult = await storageClient.GetAsync(new Uri(jobResultUrl), default); + var storageResult = await client.Storage().GetAsync(new Uri(jobResultUrl), default); using (var reader = new StreamReader(storageResult)) { string resultAsString = reader.ReadToEnd(); - JObject resultObject = JObject.Parse(resultAsString); + var resultObject = JObject.Parse(resultAsString); Console.WriteLine(resultObject); } }