-
Notifications
You must be signed in to change notification settings - Fork 1
[DEV-14516]: RetrySubmission #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * @IndicoDataSolutions/pr-be-indicodata-ai |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -140,6 +140,45 @@ | |
| return GetSubmissionToSubmission(result); | ||
| } | ||
|
|
||
| public async Task<IEnumerable<ISubmission>> RetrySubmissionsAsync(IEnumerable<int> submissionIds, CancellationToken cancellationToken = default) | ||
| { | ||
| var submissionIdsList = submissionIds?.ToList() ?? throw new ArgumentException("You must specify submission ids", nameof(submissionIds)); | ||
| if (submissionIdsList.Count == 0) | ||
| throw new ArgumentException("You must specify submission ids", nameof(submissionIds)); | ||
|
|
||
| var result = await _strawberryShakeClient.Submissions().Retry(submissionIdsList, cancellationToken); | ||
| return result?.Select(r => | ||
|
Check failure on line 150 in IndicoV2/Submissions/SubmissionsClient.cs
|
||
| { | ||
| if (!Enum.IsDefined(typeof(StrawberryShake.SubmissionStatus), r.Status)) | ||
| { | ||
| throw new NotSupportedException($"Cannot read submission status: {r.Status}"); | ||
| } | ||
|
|
||
| return new Submission | ||
| { | ||
| Id = r.Id ?? 0, | ||
| Status = (Models.SubmissionStatus)r.Status, | ||
| Errors = r.Errors ?? null, | ||
| Retries = r.Retries?.Select(retry => | ||
| { | ||
| if (!Enum.IsDefined(typeof(StrawberryShake.SubmissionStatus), retry.PreviousStatus)) | ||
| { | ||
| throw new NotSupportedException($"Cannot read submission retry previous status: {retry.PreviousStatus}"); | ||
| } | ||
|
|
||
| return new SubmissionRetry | ||
| { | ||
| Id = retry.Id ?? 0, | ||
| SubmissionId = retry.SubmissionId ?? 0, | ||
| PreviousErrors = retry.PreviousErrors, | ||
| PreviousStatus = (Models.SubmissionStatus)retry.PreviousStatus, | ||
| RetryErrors = retry.RetryErrors | ||
| }; | ||
| }).ToArray() ?? Array.Empty<SubmissionRetry>() | ||
| }; | ||
| }).ToList() ?? new List<ISubmission>(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing null checks for collection elements in SelectMedium Severity The Additional Locations (1) |
||
| } | ||
|
|
||
| private ISubmission ToSubmissionFromSs(IListSubmissions_Submissions_Submissions submission) => new SubmissionSs(submission); | ||
|
|
||
| private ISubmission GetSubmissionToSubmission(IGetSubmission_Submission result) => new Submission | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.