Exemplo n.º 1
0
        public static async Task <GetReportResult> FindReport(this ServerApiClient client, int incidentId,
                                                              string partOfErrorMessage, Func <GetReportResult, bool> filter = null)
        {
            var reportListItem = await client.GetReportListItem(incidentId, partOfErrorMessage);

            if (reportListItem == null)
            {
                throw new InvalidOperationException("Failed to find our uploaded report");
            }

            GetReportResult result = null;

            await Repeat(async() =>
            {
                var query3 = new GetReport(reportListItem.Id);
                result     = await client.QueryAsync(query3);
                if (result == null)
                {
                    return(false);
                }

                if (filter != null && filter(result))
                {
                    return(true);
                }

                return(result.ContextCollections.Any());
            });

            if (result != null)
            {
                Console.WriteLine($"Got report {result.CreatedAtUtc:yyyyMMdd hh:mm:ss.fff}");
            }
            return(result);
        }