Exemplo n.º 1
0
 /// <summary>
 /// Initializes a instance of <seealso cref="TimeRangeItem"/> class.
 /// </summary>
 public TimeRangeItem(
     string caption,
     string timedCountDuration,
     EventGroupTimeRangeEnum timeRange,
     EventTimeRangeEnum eventTimeRange)
 {
     Caption            = caption;
     TimedCountDuration = timedCountDuration;
     EventTimeRange     = eventTimeRange;
     GroupTimeRange     = timeRange;
 }
        /// <summary>
        /// Gets a page of <seealso cref="ErrorEvent"/> for an error group.
        /// The result is divided into pages when the result set is too large.
        /// This call get one page of results.
        /// </summary>
        /// <param name="errorGroup">An error group. <seealso cref="ErrorGroupStats"/>.</param>
        /// <param name="period">
        /// The time period for the query.
        /// Optional, defaults to 30 days.
        /// </param>
        /// <param name="nextPageToken">optional, A next page token provided by a previous response.</param>
        /// <returns>
        /// A task with <seealso cref="ListEventsResponse"/> as result.
        /// </returns>
        public Task <ListEventsResponse> GetPageOfEventsAsync(
            ErrorGroupStats errorGroup,
            EventTimeRange period = EventTimeRange.PERIOD30DAYS,
            string nextPageToken  = null)
        {
            var request = Service.Projects.Events.List(ProjectResourceName);

            request.TimeRangePeriod = period;
            request.PageToken       = nextPageToken;
            request.GroupId         = errorGroup.Group.GroupId;
            try
            {
                return(request.ExecuteAsync());
            }
            catch (GoogleApiException ex)
            {
                Debug.WriteLine($"Failed to get ErrorEvents: {ex.Message}");
                throw new DataSourceException(ex.Message, ex);
            }
        }