| | 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 | | /// Returns which action to use as rewardActionId, and additional |
| | 21 | | /// information about each action as a result of a Rank request. |
| | 22 | | /// </summary> |
| | 23 | | public partial class RankResponse |
| | 24 | | { |
| | 25 | | /// <summary> |
| | 26 | | /// Initializes a new instance of the RankResponse class. |
| | 27 | | /// </summary> |
| 4 | 28 | | public RankResponse() |
| | 29 | | { |
| | 30 | | CustomInit(); |
| 4 | 31 | | } |
| | 32 | |
|
| | 33 | | /// <summary> |
| | 34 | | /// Initializes a new instance of the RankResponse class. |
| | 35 | | /// </summary> |
| | 36 | | /// <param name="ranking">The calculated ranking for the current |
| | 37 | | /// request.</param> |
| | 38 | | /// <param name="eventId">The eventId for the round trip from request |
| | 39 | | /// to response.</param> |
| | 40 | | /// <param name="rewardActionId">The action chosen by the Personalizer |
| | 41 | | /// service. This is the action your application should display, and |
| | 42 | | /// for which to report the reward. This might not be the |
| | 43 | | /// first found in 'ranking' if an action in the request in first |
| | 44 | | /// position was part of the excluded ids.</param> |
| 0 | 45 | | public RankResponse(IList<RankedAction> ranking = default(IList<RankedAction>), string eventId = default(string) |
| | 46 | | { |
| 0 | 47 | | Ranking = ranking; |
| 0 | 48 | | EventId = eventId; |
| 0 | 49 | | RewardActionId = rewardActionId; |
| | 50 | | CustomInit(); |
| 0 | 51 | | } |
| | 52 | |
|
| | 53 | | /// <summary> |
| | 54 | | /// An initialization method that performs custom operations like setting defaults |
| | 55 | | /// </summary> |
| | 56 | | partial void CustomInit(); |
| | 57 | |
|
| | 58 | | /// <summary> |
| | 59 | | /// Gets the calculated ranking for the current request. |
| | 60 | | /// </summary> |
| | 61 | | [JsonProperty(PropertyName = "ranking")] |
| 28 | 62 | | public IList<RankedAction> Ranking { get; private set; } |
| | 63 | |
|
| | 64 | | /// <summary> |
| | 65 | | /// Gets the eventId for the round trip from request to response. |
| | 66 | | /// </summary> |
| | 67 | | [JsonProperty(PropertyName = "eventId")] |
| 6 | 68 | | public string EventId { get; private set; } |
| | 69 | |
|
| | 70 | | /// <summary> |
| | 71 | | /// Gets the action chosen by the Personalizer service. This is the |
| | 72 | | /// action your application should display, and for which to report the |
| | 73 | | /// reward. This might not be the |
| | 74 | | /// first found in 'ranking' if an action in the request in first |
| | 75 | | /// position was part of the excluded ids. |
| | 76 | | /// </summary> |
| | 77 | | [JsonProperty(PropertyName = "rewardActionId")] |
| 0 | 78 | | public string RewardActionId { get; private set; } |
| | 79 | |
|
| | 80 | | /// <summary> |
| | 81 | | /// Validate the object. |
| | 82 | | /// </summary> |
| | 83 | | /// <exception cref="ValidationException"> |
| | 84 | | /// Thrown if validation fails |
| | 85 | | /// </exception> |
| | 86 | | public virtual void Validate() |
| | 87 | | { |
| 0 | 88 | | if (Ranking != null) |
| | 89 | | { |
| 0 | 90 | | foreach (var element in Ranking) |
| | 91 | | { |
| 0 | 92 | | if (element != null) |
| | 93 | | { |
| 0 | 94 | | element.Validate(); |
| | 95 | | } |
| | 96 | | } |
| | 97 | | } |
| 0 | 98 | | if (EventId != null) |
| | 99 | | { |
| 0 | 100 | | if (EventId.Length > 256) |
| | 101 | | { |
| 0 | 102 | | throw new ValidationException(ValidationRules.MaxLength, "EventId", 256); |
| | 103 | | } |
| | 104 | | } |
| 0 | 105 | | if (RewardActionId != null) |
| | 106 | | { |
| 0 | 107 | | if (RewardActionId.Length > 256) |
| | 108 | | { |
| 0 | 109 | | throw new ValidationException(ValidationRules.MaxLength, "RewardActionId", 256); |
| | 110 | | } |
| | 111 | | } |
| 0 | 112 | | } |
| | 113 | | } |
| | 114 | | } |