Esempio n. 1
0
        /// <summary> Initializes a new <see cref="MetricCommentFeedback"/> 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="comment"> The comment content for the feedback. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="dimensionFilter"/> or <paramref name="comment"/> is null. </exception>
        public MetricCommentFeedback(string metricId, FeedbackDimensionFilter dimensionFilter, string comment) : base(metricId, dimensionFilter)
        {
            Argument.AssertNotNullOrEmpty(comment, nameof(comment));

            ValueInternal = new CommentFeedbackValue(comment);
            Type          = FeedbackType.Comment;
        }
Esempio n. 2
0
        /// <summary> Initializes a new <see cref="MetricCommentFeedback"/> 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="comment"> The comment content for the feedback. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="dimensionFilter"/> or <paramref name="comment"/> is null. </exception>
        internal MetricCommentFeedback(string metricId, FeedbackDimensionFilter dimensionFilter, CommentFeedbackValue comment) : base(metricId, dimensionFilter)
        {
            Argument.AssertNotNullOrEmpty(comment?.CommentValue, nameof(comment.CommentValue));

            ValueInternal = comment;
            Type          = FeedbackType.Comment;
        }
 internal MetricCommentFeedback(MetricFeedbackKind feedbackKind, string id, DateTimeOffset?createdOn, string userPrincipal, string metricId, FeedbackFilter dimensionFilter, DateTimeOffset?startsOn, DateTimeOffset?endsOn, CommentFeedbackValue valueInternal) : base(feedbackKind, id, createdOn, userPrincipal, metricId, dimensionFilter)
 {
     StartsOn      = startsOn;
     EndsOn        = endsOn;
     ValueInternal = valueInternal;
     FeedbackKind  = feedbackKind;
 }
Esempio n. 4
0
 internal MetricCommentFeedback(FeedbackType type, string id, DateTimeOffset?createdTime, string userPrincipal, string metricId, FeedbackDimensionFilter dimensionFilter, DateTimeOffset?startTime, DateTimeOffset?endTime, CommentFeedbackValue valueInternal) : base(type, id, createdTime, userPrincipal, metricId, dimensionFilter)
 {
     StartTime     = startTime;
     EndTime       = endTime;
     ValueInternal = valueInternal;
     Type          = type;
 }
Esempio n. 5
0
        /// <summary> Initializes a new <see cref="MetricCommentFeedback"/> instance. </summary>
        /// <param name="metricId"> The metric unique id. </param>
        /// <param name="feedbackFilter"> The <see cref="FeedbackFilter"/> to apply to the feedback. </param>
        /// <param name="comment"> The comment content for the feedback. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="feedbackFilter"/> or <paramref name="comment"/> is null. </exception>
        internal MetricCommentFeedback(string metricId, FeedbackFilter feedbackFilter, CommentFeedbackValue comment)
            : base(metricId, feedbackFilter.DimensionKey)
        {
            Argument.AssertNotNullOrEmpty(comment?.CommentValue, nameof(comment.CommentValue));

            ValueInternal = comment;
            FeedbackKind  = MetricFeedbackKind.Comment;
        }
Esempio n. 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MetricCommentFeedback"/> class.
        /// </summary>
        /// <param name="metricId">The identifier of the metric to which the <see cref="MetricCommentFeedback"/> applies.</param>
        /// <param name="dimensionKey">
        /// A key that identifies a set of time series to which the <see cref="MetricCommentFeedback"/> 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="comment">The comment content for the feedback.</param>
        /// <exception cref="ArgumentNullException"><paramref name="metricId"/>, <paramref name="dimensionKey"/>, or <paramref name="comment"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentException"><paramref name="metricId"/> or <paramref name="comment"/> is empty.</exception>
        public MetricCommentFeedback(string metricId, DimensionKey dimensionKey, string comment)
            : base(metricId, dimensionKey)
        {
            Argument.AssertNotNullOrEmpty(comment, nameof(comment));

            ValueInternal = new CommentFeedbackValue(comment);
            FeedbackKind  = MetricFeedbackKind.Comment;
        }
Esempio n. 7
0
        internal static MetricCommentFeedback DeserializeMetricCommentFeedback(JsonElement element)
        {
            Optional <DateTimeOffset?> startTime    = default;
            Optional <DateTimeOffset?> endTime      = default;
            CommentFeedbackValue       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("startTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        startTime = null;
                        continue;
                    }
                    startTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("endTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        endTime = null;
                        continue;
                    }
                    endTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("value"))
                {
                    value = CommentFeedbackValue.DeserializeCommentFeedbackValue(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 MetricCommentFeedback(feedbackType, feedbackId.Value, Optional.ToNullable(createdTime), userPrincipal.Value, metricId, dimensionFilter, Optional.ToNullable(startTime), Optional.ToNullable(endTime), value));
        }