| | 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.Personalizer.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 | | /// <summary> |
| | 20 | | /// An action with it's associated features used for ranking. |
| | 21 | | /// </summary> |
| | 22 | | public partial class RankableAction |
| | 23 | | { |
| | 24 | | /// <summary> |
| | 25 | | /// Initializes a new instance of the RankableAction class. |
| | 26 | | /// </summary> |
| 6 | 27 | | public RankableAction() |
| | 28 | | { |
| | 29 | | CustomInit(); |
| 6 | 30 | | } |
| | 31 | |
|
| | 32 | | /// <summary> |
| | 33 | | /// Initializes a new instance of the RankableAction class. |
| | 34 | | /// </summary> |
| | 35 | | /// <param name="id">Id of the action.</param> |
| | 36 | | /// <param name="features">List of dictionaries containing |
| | 37 | | /// features.</param> |
| 0 | 38 | | public RankableAction(string id, IList<object> features) |
| | 39 | | { |
| 0 | 40 | | Id = id; |
| 0 | 41 | | Features = features; |
| | 42 | | CustomInit(); |
| 0 | 43 | | } |
| | 44 | |
|
| | 45 | | /// <summary> |
| | 46 | | /// An initialization method that performs custom operations like setting defaults |
| | 47 | | /// </summary> |
| | 48 | | partial void CustomInit(); |
| | 49 | |
|
| | 50 | | /// <summary> |
| | 51 | | /// Gets or sets id of the action. |
| | 52 | | /// </summary> |
| | 53 | | [JsonProperty(PropertyName = "id")] |
| 36 | 54 | | public string Id { get; set; } |
| | 55 | |
|
| | 56 | | /// <summary> |
| | 57 | | /// Gets or sets list of dictionaries containing features. |
| | 58 | | /// </summary> |
| | 59 | | [JsonProperty(PropertyName = "features")] |
| 18 | 60 | | public IList<object> Features { get; set; } |
| | 61 | |
|
| | 62 | | /// <summary> |
| | 63 | | /// Validate the object. |
| | 64 | | /// </summary> |
| | 65 | | /// <exception cref="ValidationException"> |
| | 66 | | /// Thrown if validation fails |
| | 67 | | /// </exception> |
| | 68 | | public virtual void Validate() |
| | 69 | | { |
| 6 | 70 | | if (Id == null) |
| | 71 | | { |
| 0 | 72 | | throw new ValidationException(ValidationRules.CannotBeNull, "Id"); |
| | 73 | | } |
| 6 | 74 | | if (Features == null) |
| | 75 | | { |
| 0 | 76 | | throw new ValidationException(ValidationRules.CannotBeNull, "Features"); |
| | 77 | | } |
| 6 | 78 | | if (Id != null) |
| | 79 | | { |
| 6 | 80 | | if (Id.Length > 256) |
| | 81 | | { |
| 0 | 82 | | throw new ValidationException(ValidationRules.MaxLength, "Id", 256); |
| | 83 | | } |
| | 84 | | } |
| 6 | 85 | | } |
| | 86 | | } |
| | 87 | | } |