From 3f61ede716463bcda023eab9bd0905faafeaf3cb Mon Sep 17 00:00:00 2001 From: Nathanael Shim Date: Wed, 13 Mar 2024 13:17:13 -0700 Subject: [PATCH] update submission filter examples and remove console logs --- Examples/SubmissionFilterExample/Program.cs | 91 ++++++++++++++----- .../Submissions/Models/FilterConverter.cs | 2 - 2 files changed, 69 insertions(+), 24 deletions(-) diff --git a/Examples/SubmissionFilterExample/Program.cs b/Examples/SubmissionFilterExample/Program.cs index 05e4404..93a20dd 100644 --- a/Examples/SubmissionFilterExample/Program.cs +++ b/Examples/SubmissionFilterExample/Program.cs @@ -23,10 +23,10 @@ public static async Task Main() var workflowIds = new List() { 3106 }; // Example 1 - // List all submissions that are complete or failed - var orFilter = new OrFilter + // List all submissions that are COMPLETE and not retrieved + var andFilter = new AndFilter { - Or = new List + And = new List { new SubmissionFilter { @@ -34,40 +34,69 @@ public static async Task Main() }, new SubmissionFilter { - Status = SubmissionStatus.FAILED, + Retrieved = false, } } }; - var submissions = await submissionClient.ListAsync(submissionIds, workflowIds, orFilter, limit: 10); + submissions = await submissionClient.ListAsync(submissionIds, workflowIds, andFilter, limit: 10); Console.WriteLine(submissions); // Example 2 - // List all submissions that are COMPLETE and FAILED - var andFilter = new AndFilter + // List all submissions that are complete and not retrieved or failed and not retrieved + var orFilter = new OrFilter { - And = new List + Or = new List { - new SubmissionFilter + new AndFilter { - Status = SubmissionStatus.COMPLETE, + And = new List + { + new SubmissionFilter + { + Status = SubmissionStatus.COMPLETE, + }, + new SubmissionFilter + { + Retrieved = false, + } + } }, - new SubmissionFilter + new AndFilter { - Status = SubmissionStatus.FAILED, + And = new List + { + new SubmissionFilter + { + Status = SubmissionStatus.FAILED, + }, + new SubmissionFilter + { + Retrieved = false, + } + } } } }; - submissions = await submissionClient.ListAsync(submissionIds, workflowIds, andFilter, limit: 10); + var submissions = await submissionClient.ListAsync(submissionIds, workflowIds, orFilter, limit: 10); Console.WriteLine(submissions); // Example 3 // List all submissions that are retrieved and have a filename that contains 'property' - var subFilter = new SubmissionFilter + var subFilter = new AndFilter { - Retrieved = true, - InputFilename = "property" + And = new List + { + new SubmissionFilter + { + Retrieved = true, + }, + new SubmissionFilter + { + InputFilename = "property", + } + } }; submissions = await submissionClient.ListAsync(submissionIds, workflowIds, subFilter, limit: 10); @@ -80,10 +109,19 @@ public static async Task Main() From = "2022-01-01", To = DateTime.Now.ToString("yyyy-MM-dd") }; - subFilter = new SubmissionFilter + subFilter = new AndFilter { - CreatedAt = dateRangeFilter, - UpdatedAt = dateRangeFilter + And = new List + { + new SubmissionFilter + { + CreatedAt = dateRangeFilter, + }, + new SubmissionFilter + { + UpdatedAt = dateRangeFilter, + }, + } }; submissions = await submissionClient.ListAsync(submissionIds, workflowIds, subFilter, limit: 10); @@ -91,10 +129,19 @@ public static async Task Main() // Example 5 // List all submissions that are not in progress of being reviewed and are completed - subFilter = new SubmissionFilter + subFilter = new AndFilter { - Status = SubmissionStatus.COMPLETE, - ReviewInProgress = false + And = new List + { + new SubmissionFilter + { + Status = SubmissionStatus.COMPLETE, + }, + new SubmissionFilter + { + ReviewInProgress = false, + } + } }; submissions = await submissionClient.ListAsync(submissionIds, workflowIds, subFilter, limit: 10); diff --git a/IndicoV2.Abstractions/Submissions/Models/FilterConverter.cs b/IndicoV2.Abstractions/Submissions/Models/FilterConverter.cs index e06e704..b229395 100644 --- a/IndicoV2.Abstractions/Submissions/Models/FilterConverter.cs +++ b/IndicoV2.Abstractions/Submissions/Models/FilterConverter.cs @@ -71,7 +71,6 @@ public static ssSubmissionFilter ConvertToSs(this IFilter filter) } else if (filter is AndFilter andfilter) { - Console.WriteLine("and"); return new ssSubmissionFilter() { AND = andfilter.And.Select(a => a.ConvertToSs()).ToList() @@ -80,7 +79,6 @@ public static ssSubmissionFilter ConvertToSs(this IFilter filter) } else if (filter is OrFilter orFilter) { - Console.WriteLine("or"); return new ssSubmissionFilter() { OR = orFilter.Or.Select(a => a.ConvertToSs()).ToList()