| | 1 | | // <auto-generated> |
| | 2 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 3 | | // Licensed under the MIT License. See License.txt in the project root for |
| | 4 | | // license information. |
| | 5 | | // |
| | 6 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | 7 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | 8 | | // regenerated. |
| | 9 | | // </auto-generated> |
| | 10 | |
|
| | 11 | | namespace Microsoft.Azure.CognitiveServices.AnomalyDetector.Models |
| | 12 | | { |
| | 13 | | using Microsoft.Rest; |
| | 14 | | using Newtonsoft.Json; |
| | 15 | | using System.Collections; |
| | 16 | | using System.Collections.Generic; |
| | 17 | | using System.Linq; |
| | 18 | |
|
| | 19 | | public partial class Request |
| | 20 | | { |
| | 21 | | /// <summary> |
| | 22 | | /// Initializes a new instance of the Request class. |
| | 23 | | /// </summary> |
| 0 | 24 | | public Request() |
| | 25 | | { |
| | 26 | | CustomInit(); |
| 0 | 27 | | } |
| | 28 | |
|
| | 29 | | /// <summary> |
| | 30 | | /// Initializes a new instance of the Request class. |
| | 31 | | /// </summary> |
| | 32 | | /// <param name="series">Time series data points. Points should be |
| | 33 | | /// sorted by timestamp in ascending order to match the anomaly |
| | 34 | | /// detection result. If the data is not sorted correctly or there is |
| | 35 | | /// duplicated timestamp, the API will not work. In such case, an error |
| | 36 | | /// message will be returned.</param> |
| | 37 | | /// <param name="granularity">Can only be one of yearly, monthly, |
| | 38 | | /// weekly, daily, hourly or minutely. Granularity is used for verify |
| | 39 | | /// whether input series is valid. Possible values include: 'yearly', |
| | 40 | | /// 'monthly', 'weekly', 'daily', 'hourly', 'minutely'</param> |
| | 41 | | /// <param name="customInterval">Custom Interval is used to set |
| | 42 | | /// non-standard time interval, for example, if the series is 5 |
| | 43 | | /// minutes, request can be set as {"granularity":"minutely", |
| | 44 | | /// "customInterval":5}.</param> |
| | 45 | | /// <param name="period">Optional argument, periodic value of a time |
| | 46 | | /// series. If the value is null or does not present, the API will |
| | 47 | | /// determine the period automatically.</param> |
| | 48 | | /// <param name="maxAnomalyRatio">Optional argument, advanced model |
| | 49 | | /// parameter, max anomaly ratio in a time series.</param> |
| | 50 | | /// <param name="sensitivity">Optional argument, advanced model |
| | 51 | | /// parameter, between 0-99, the lower the value is, the larger the |
| | 52 | | /// margin value will be which means less anomalies will be |
| | 53 | | /// accepted.</param> |
| 0 | 54 | | public Request(IList<Point> series, Granularity granularity, int? customInterval = default(int?), int? period = |
| | 55 | | { |
| 0 | 56 | | Series = series; |
| 0 | 57 | | Granularity = granularity; |
| 0 | 58 | | CustomInterval = customInterval; |
| 0 | 59 | | Period = period; |
| 0 | 60 | | MaxAnomalyRatio = maxAnomalyRatio; |
| 0 | 61 | | Sensitivity = sensitivity; |
| | 62 | | CustomInit(); |
| 0 | 63 | | } |
| | 64 | |
|
| | 65 | | /// <summary> |
| | 66 | | /// An initialization method that performs custom operations like setting defaults |
| | 67 | | /// </summary> |
| | 68 | | partial void CustomInit(); |
| | 69 | |
|
| | 70 | | /// <summary> |
| | 71 | | /// Gets or sets time series data points. Points should be sorted by |
| | 72 | | /// timestamp in ascending order to match the anomaly detection result. |
| | 73 | | /// If the data is not sorted correctly or there is duplicated |
| | 74 | | /// timestamp, the API will not work. In such case, an error message |
| | 75 | | /// will be returned. |
| | 76 | | /// </summary> |
| | 77 | | [JsonProperty(PropertyName = "series")] |
| 0 | 78 | | public IList<Point> Series { get; set; } |
| | 79 | |
|
| | 80 | | /// <summary> |
| | 81 | | /// Gets or sets can only be one of yearly, monthly, weekly, daily, |
| | 82 | | /// hourly or minutely. Granularity is used for verify whether input |
| | 83 | | /// series is valid. Possible values include: 'yearly', 'monthly', |
| | 84 | | /// 'weekly', 'daily', 'hourly', 'minutely' |
| | 85 | | /// </summary> |
| | 86 | | [JsonProperty(PropertyName = "granularity")] |
| 0 | 87 | | public Granularity Granularity { get; set; } |
| | 88 | |
|
| | 89 | | /// <summary> |
| | 90 | | /// Gets or sets custom Interval is used to set non-standard time |
| | 91 | | /// interval, for example, if the series is 5 minutes, request can be |
| | 92 | | /// set as {"granularity":"minutely", "customInterval":5}. |
| | 93 | | /// </summary> |
| | 94 | | [JsonProperty(PropertyName = "customInterval")] |
| 0 | 95 | | public int? CustomInterval { get; set; } |
| | 96 | |
|
| | 97 | | /// <summary> |
| | 98 | | /// Gets or sets optional argument, periodic value of a time series. If |
| | 99 | | /// the value is null or does not present, the API will determine the |
| | 100 | | /// period automatically. |
| | 101 | | /// </summary> |
| | 102 | | [JsonProperty(PropertyName = "period")] |
| 0 | 103 | | public int? Period { get; set; } |
| | 104 | |
|
| | 105 | | /// <summary> |
| | 106 | | /// Gets or sets optional argument, advanced model parameter, max |
| | 107 | | /// anomaly ratio in a time series. |
| | 108 | | /// </summary> |
| | 109 | | [JsonProperty(PropertyName = "maxAnomalyRatio")] |
| 0 | 110 | | public double? MaxAnomalyRatio { get; set; } |
| | 111 | |
|
| | 112 | | /// <summary> |
| | 113 | | /// Gets or sets optional argument, advanced model parameter, between |
| | 114 | | /// 0-99, the lower the value is, the larger the margin value will be |
| | 115 | | /// which means less anomalies will be accepted. |
| | 116 | | /// </summary> |
| | 117 | | [JsonProperty(PropertyName = "sensitivity")] |
| 0 | 118 | | public int? Sensitivity { get; set; } |
| | 119 | |
|
| | 120 | | /// <summary> |
| | 121 | | /// Validate the object. |
| | 122 | | /// </summary> |
| | 123 | | /// <exception cref="ValidationException"> |
| | 124 | | /// Thrown if validation fails |
| | 125 | | /// </exception> |
| | 126 | | public virtual void Validate() |
| | 127 | | { |
| 0 | 128 | | if (Series == null) |
| | 129 | | { |
| 0 | 130 | | throw new ValidationException(ValidationRules.CannotBeNull, "Series"); |
| | 131 | | } |
| 0 | 132 | | if (Series != null) |
| | 133 | | { |
| 0 | 134 | | foreach (var element in Series) |
| | 135 | | { |
| 0 | 136 | | if (element != null) |
| | 137 | | { |
| 0 | 138 | | element.Validate(); |
| | 139 | | } |
| | 140 | | } |
| | 141 | | } |
| 0 | 142 | | } |
| | 143 | | } |
| | 144 | | } |