/// <summary> Initializes a new <see cref="MetricPeriodFeedback"/> instance. </summary> /// <param name="metricId"> The metric unique id. </param> /// <param name="dimensionFilter"> The <see cref="FeedbackDimensionFilter"/> to apply to the feedback. </param> /// <param name="periodType"> The <see cref="Models.PeriodType"/>. </param> /// <param name="periodValue"> The period value. </param> /// <exception cref="ArgumentNullException"> <paramref name="metricId"/> or <paramref name="dimensionFilter"/> is null. </exception> /// <exception cref="ArgumentException"> <paramref name="metricId"/> is empty. </exception> public MetricPeriodFeedback(string metricId, FeedbackDimensionFilter dimensionFilter, PeriodType periodType, int periodValue) : base(metricId, dimensionFilter) { Argument.AssertNotNullOrEmpty(metricId, nameof(metricId)); Argument.AssertNotNull(dimensionFilter, nameof(dimensionFilter)); ValueInternal = new PeriodFeedbackValue(periodType, periodValue); Type = FeedbackType.Period; }
internal static MetricPeriodFeedback DeserializeMetricPeriodFeedback(JsonElement element) { PeriodFeedbackValue value = default; FeedbackType feedbackType = default; Optional <string> feedbackId = default; Optional <DateTimeOffset> createdTime = default; Optional <string> userPrincipal = default; string metricId = default; FeedbackDimensionFilter dimensionFilter = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value")) { value = PeriodFeedbackValue.DeserializePeriodFeedbackValue(property.Value); continue; } if (property.NameEquals("feedbackType")) { feedbackType = new FeedbackType(property.Value.GetString()); continue; } if (property.NameEquals("feedbackId")) { feedbackId = property.Value.GetString(); continue; } if (property.NameEquals("createdTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } createdTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("userPrincipal")) { userPrincipal = property.Value.GetString(); continue; } if (property.NameEquals("metricId")) { metricId = property.Value.GetString(); continue; } if (property.NameEquals("dimensionFilter")) { dimensionFilter = FeedbackDimensionFilter.DeserializeFeedbackDimensionFilter(property.Value); continue; } } return(new MetricPeriodFeedback(feedbackType, feedbackId.Value, Optional.ToNullable(createdTime), userPrincipal.Value, metricId, dimensionFilter, value)); }
/// <summary> Initializes a new instance of MetricPeriodFeedback. </summary> /// <param name="metricId"> metric unique id. </param> /// <param name="feedbackFilter"> . </param> /// <param name="valueInternal"> . </param> /// <exception cref="ArgumentNullException"> <paramref name="metricId"/>, <paramref name="feedbackFilter"/>, or <paramref name="valueInternal"/> is null. </exception> internal MetricPeriodFeedback(string metricId, FeedbackFilter feedbackFilter, PeriodFeedbackValue valueInternal) : base(metricId, feedbackFilter.DimensionKey) { if (valueInternal == null) { throw new ArgumentNullException(nameof(valueInternal)); } ValueInternal = valueInternal; FeedbackKind = MetricFeedbackKind.Period; }
/// <summary> Initializes a new instance of MetricPeriodFeedback. </summary> /// <param name="metricId"> metric unique id. </param> /// <param name="dimensionFilter"> . </param> /// <param name="valueInternal"> . </param> /// <exception cref="ArgumentNullException"> <paramref name="metricId"/>, <paramref name="dimensionFilter"/>, or <paramref name="valueInternal"/> is null. </exception> internal MetricPeriodFeedback(string metricId, FeedbackDimensionFilter dimensionFilter, PeriodFeedbackValue valueInternal) : base(metricId, dimensionFilter) { if (metricId == null) { throw new ArgumentNullException(nameof(metricId)); } if (dimensionFilter == null) { throw new ArgumentNullException(nameof(dimensionFilter)); } if (valueInternal == null) { throw new ArgumentNullException(nameof(valueInternal)); } ValueInternal = valueInternal; Type = FeedbackType.Period; }
internal MetricPeriodFeedback(MetricFeedbackKind feedbackKind, string id, DateTimeOffset?createdOn, string userPrincipal, string metricId, FeedbackFilter dimensionFilter, PeriodFeedbackValue valueInternal) : base(feedbackKind, id, createdOn, userPrincipal, metricId, dimensionFilter) { ValueInternal = valueInternal; FeedbackKind = feedbackKind; }
internal MetricPeriodFeedback(FeedbackType type, string id, DateTimeOffset?createdTime, string userPrincipal, string metricId, FeedbackDimensionFilter dimensionFilter, PeriodFeedbackValue valueInternal) : base(type, id, createdTime, userPrincipal, metricId, dimensionFilter) { ValueInternal = valueInternal; Type = type; }
/// <summary> /// Initializes a new instance of the <see cref="MetricPeriodFeedback"/> class. /// </summary> /// <param name="metricId">The identifier of the metric to which the <see cref="MetricPeriodFeedback"/> applies.</param> /// <param name="dimensionKey"> /// A key that identifies a set of time series to which the <see cref="MetricPeriodFeedback"/> applies. /// If all possible dimensions are set, this key uniquely identifies a single time series /// for the specified <paramref name="metricId"/>. If only a subset of dimensions are set, this /// key uniquely identifies a group of time series. /// </param> /// <param name="periodType">Tells the service how to determine the period of the seasonal data.</param> /// <param name="periodValue">The expected value of the period, measured in amount of data points. 0 means non-seasonal data.</param> /// <exception cref="ArgumentNullException"><paramref name="metricId"/> or <paramref name="dimensionKey"/> is <c>null</c>.</exception> /// <exception cref="ArgumentException"><paramref name="metricId"/> is empty.</exception> public MetricPeriodFeedback(string metricId, DimensionKey dimensionKey, MetricPeriodType periodType, int periodValue) : base(metricId, dimensionKey) { ValueInternal = new PeriodFeedbackValue(periodType, periodValue); FeedbackKind = MetricFeedbackKind.Period; }