| | | 1 | | // <auto-generated> |
| | | 2 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | | 3 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | | 4 | | // regenerated. |
| | | 5 | | // </auto-generated> |
| | | 6 | | |
| | | 7 | | namespace Microsoft.Azure.CognitiveServices.Search.ImageSearch.Models |
| | | 8 | | { |
| | | 9 | | using Microsoft.Rest; |
| | | 10 | | using Newtonsoft.Json; |
| | | 11 | | using System.Collections; |
| | | 12 | | using System.Collections.Generic; |
| | | 13 | | using System.Linq; |
| | | 14 | | |
| | | 15 | | /// <summary> |
| | | 16 | | /// Defines the pivot segment. |
| | | 17 | | /// </summary> |
| | | 18 | | public partial class PivotSuggestions |
| | | 19 | | { |
| | | 20 | | /// <summary> |
| | | 21 | | /// Initializes a new instance of the PivotSuggestions class. |
| | | 22 | | /// </summary> |
| | 2 | 23 | | public PivotSuggestions() |
| | | 24 | | { |
| | | 25 | | CustomInit(); |
| | 2 | 26 | | } |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Initializes a new instance of the PivotSuggestions class. |
| | | 30 | | /// </summary> |
| | | 31 | | /// <param name="pivot">The segment from the original query to pivot |
| | | 32 | | /// on.</param> |
| | | 33 | | /// <param name="suggestions">A list of suggested queries for the |
| | | 34 | | /// pivot.</param> |
| | 0 | 35 | | public PivotSuggestions(string pivot, IList<Query> suggestions) |
| | | 36 | | { |
| | 0 | 37 | | Pivot = pivot; |
| | 0 | 38 | | Suggestions = suggestions; |
| | | 39 | | CustomInit(); |
| | 0 | 40 | | } |
| | | 41 | | |
| | | 42 | | /// <summary> |
| | | 43 | | /// An initialization method that performs custom operations like setting defaults |
| | | 44 | | /// </summary> |
| | | 45 | | partial void CustomInit(); |
| | | 46 | | |
| | | 47 | | /// <summary> |
| | | 48 | | /// Gets or sets the segment from the original query to pivot on. |
| | | 49 | | /// </summary> |
| | | 50 | | [JsonProperty(PropertyName = "pivot")] |
| | 0 | 51 | | public string Pivot { get; set; } |
| | | 52 | | |
| | | 53 | | /// <summary> |
| | | 54 | | /// Gets or sets a list of suggested queries for the pivot. |
| | | 55 | | /// </summary> |
| | | 56 | | [JsonProperty(PropertyName = "suggestions")] |
| | 4 | 57 | | public IList<Query> Suggestions { get; set; } |
| | | 58 | | |
| | | 59 | | /// <summary> |
| | | 60 | | /// Validate the object. |
| | | 61 | | /// </summary> |
| | | 62 | | /// <exception cref="ValidationException"> |
| | | 63 | | /// Thrown if validation fails |
| | | 64 | | /// </exception> |
| | | 65 | | public virtual void Validate() |
| | | 66 | | { |
| | 0 | 67 | | if (Pivot == null) |
| | | 68 | | { |
| | 0 | 69 | | throw new ValidationException(ValidationRules.CannotBeNull, "Pivot"); |
| | | 70 | | } |
| | 0 | 71 | | if (Suggestions == null) |
| | | 72 | | { |
| | 0 | 73 | | throw new ValidationException(ValidationRules.CannotBeNull, "Suggestions"); |
| | | 74 | | } |
| | 0 | 75 | | if (Suggestions != null) |
| | | 76 | | { |
| | 0 | 77 | | foreach (var element in Suggestions) |
| | | 78 | | { |
| | 0 | 79 | | if (element != null) |
| | | 80 | | { |
| | 0 | 81 | | element.Validate(); |
| | | 82 | | } |
| | | 83 | | } |
| | | 84 | | } |
| | 0 | 85 | | } |
| | | 86 | | } |
| | | 87 | | } |