| | | 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 an image answer |
| | | 17 | | /// </summary> |
| | | 18 | | public partial class Images : SearchResultsAnswer |
| | | 19 | | { |
| | | 20 | | /// <summary> |
| | | 21 | | /// Initializes a new instance of the Images class. |
| | | 22 | | /// </summary> |
| | 2 | 23 | | public Images() |
| | | 24 | | { |
| | | 25 | | CustomInit(); |
| | 2 | 26 | | } |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Initializes a new instance of the Images class. |
| | | 30 | | /// </summary> |
| | | 31 | | /// <param name="value">A list of image objects that are relevant to |
| | | 32 | | /// the query. If there are no results, the List is empty.</param> |
| | | 33 | | /// <param name="id">A String identifier.</param> |
| | | 34 | | /// <param name="readLink">The URL that returns this resource.</param> |
| | | 35 | | /// <param name="webSearchUrl">The URL To Bing's search result for this |
| | | 36 | | /// item.</param> |
| | | 37 | | /// <param name="totalEstimatedMatches">The estimated number of |
| | | 38 | | /// webpages that are relevant to the query. Use this number along with |
| | | 39 | | /// the count and offset query parameters to page the results.</param> |
| | | 40 | | /// <param name="nextOffset">Used as part of deduping. Tells client the |
| | | 41 | | /// next offset that client should use in the next pagination |
| | | 42 | | /// request</param> |
| | | 43 | | /// <param name="queryExpansions">A list of expanded queries that |
| | | 44 | | /// narrows the original query. For example, if the query was Microsoft |
| | | 45 | | /// Surface, the expanded queries might be: Microsoft Surface Pro 3, |
| | | 46 | | /// Microsoft Surface RT, Microsoft Surface Phone, and Microsoft |
| | | 47 | | /// Surface Hub.</param> |
| | | 48 | | /// <param name="pivotSuggestions">A list of segments in the original |
| | | 49 | | /// query. For example, if the query was Red Flowers, Bing might |
| | | 50 | | /// segment the query into Red and Flowers. The Flowers pivot may |
| | | 51 | | /// contain query suggestions such as Red Peonies and Red Daisies, and |
| | | 52 | | /// the Red pivot may contain query suggestions such as Green Flowers |
| | | 53 | | /// and Yellow Flowers.</param> |
| | | 54 | | /// <param name="similarTerms">A list of terms that are similar in |
| | | 55 | | /// meaning to the user's query term.</param> |
| | | 56 | | public Images(IList<ImageObject> value, string id = default(string), string readLink = default(string), string w |
| | 0 | 57 | | : base(id, readLink, webSearchUrl, totalEstimatedMatches) |
| | | 58 | | { |
| | 0 | 59 | | NextOffset = nextOffset; |
| | 0 | 60 | | Value = value; |
| | 0 | 61 | | QueryExpansions = queryExpansions; |
| | 0 | 62 | | PivotSuggestions = pivotSuggestions; |
| | 0 | 63 | | SimilarTerms = similarTerms; |
| | | 64 | | CustomInit(); |
| | 0 | 65 | | } |
| | | 66 | | |
| | | 67 | | /// <summary> |
| | | 68 | | /// An initialization method that performs custom operations like setting defaults |
| | | 69 | | /// </summary> |
| | | 70 | | partial void CustomInit(); |
| | | 71 | | |
| | | 72 | | /// <summary> |
| | | 73 | | /// Gets used as part of deduping. Tells client the next offset that |
| | | 74 | | /// client should use in the next pagination request |
| | | 75 | | /// </summary> |
| | | 76 | | [JsonProperty(PropertyName = "nextOffset")] |
| | 0 | 77 | | public int? NextOffset { get; private set; } |
| | | 78 | | |
| | | 79 | | /// <summary> |
| | | 80 | | /// Gets or sets a list of image objects that are relevant to the |
| | | 81 | | /// query. If there are no results, the List is empty. |
| | | 82 | | /// </summary> |
| | | 83 | | [JsonProperty(PropertyName = "value")] |
| | 8 | 84 | | public IList<ImageObject> Value { get; set; } |
| | | 85 | | |
| | | 86 | | /// <summary> |
| | | 87 | | /// Gets a list of expanded queries that narrows the original query. |
| | | 88 | | /// For example, if the query was Microsoft Surface, the expanded |
| | | 89 | | /// queries might be: Microsoft Surface Pro 3, Microsoft Surface RT, |
| | | 90 | | /// Microsoft Surface Phone, and Microsoft Surface Hub. |
| | | 91 | | /// </summary> |
| | | 92 | | [JsonProperty(PropertyName = "queryExpansions")] |
| | 8 | 93 | | public IList<Query> QueryExpansions { get; private set; } |
| | | 94 | | |
| | | 95 | | /// <summary> |
| | | 96 | | /// Gets a list of segments in the original query. For example, if the |
| | | 97 | | /// query was Red Flowers, Bing might segment the query into Red and |
| | | 98 | | /// Flowers. The Flowers pivot may contain query suggestions such as |
| | | 99 | | /// Red Peonies and Red Daisies, and the Red pivot may contain query |
| | | 100 | | /// suggestions such as Green Flowers and Yellow Flowers. |
| | | 101 | | /// </summary> |
| | | 102 | | [JsonProperty(PropertyName = "pivotSuggestions")] |
| | 0 | 103 | | public IList<PivotSuggestions> PivotSuggestions { get; private set; } |
| | | 104 | | |
| | | 105 | | /// <summary> |
| | | 106 | | /// Gets a list of terms that are similar in meaning to the user's |
| | | 107 | | /// query term. |
| | | 108 | | /// </summary> |
| | | 109 | | [JsonProperty(PropertyName = "similarTerms")] |
| | 0 | 110 | | public IList<Query> SimilarTerms { get; private set; } |
| | | 111 | | |
| | | 112 | | /// <summary> |
| | | 113 | | /// Validate the object. |
| | | 114 | | /// </summary> |
| | | 115 | | /// <exception cref="ValidationException"> |
| | | 116 | | /// Thrown if validation fails |
| | | 117 | | /// </exception> |
| | | 118 | | public virtual void Validate() |
| | | 119 | | { |
| | 0 | 120 | | if (Value == null) |
| | | 121 | | { |
| | 0 | 122 | | throw new ValidationException(ValidationRules.CannotBeNull, "Value"); |
| | | 123 | | } |
| | 0 | 124 | | if (QueryExpansions != null) |
| | | 125 | | { |
| | 0 | 126 | | foreach (var element in QueryExpansions) |
| | | 127 | | { |
| | 0 | 128 | | if (element != null) |
| | | 129 | | { |
| | 0 | 130 | | element.Validate(); |
| | | 131 | | } |
| | | 132 | | } |
| | | 133 | | } |
| | 0 | 134 | | if (PivotSuggestions != null) |
| | | 135 | | { |
| | 0 | 136 | | foreach (var element1 in PivotSuggestions) |
| | | 137 | | { |
| | 0 | 138 | | if (element1 != null) |
| | | 139 | | { |
| | 0 | 140 | | element1.Validate(); |
| | | 141 | | } |
| | | 142 | | } |
| | | 143 | | } |
| | 0 | 144 | | if (SimilarTerms != null) |
| | | 145 | | { |
| | 0 | 146 | | foreach (var element2 in SimilarTerms) |
| | | 147 | | { |
| | 0 | 148 | | if (element2 != null) |
| | | 149 | | { |
| | 0 | 150 | | element2.Validate(); |
| | | 151 | | } |
| | | 152 | | } |
| | | 153 | | } |
| | 0 | 154 | | } |
| | | 155 | | } |
| | | 156 | | } |