| | | 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 category of trending images. |
| | | 17 | | /// </summary> |
| | | 18 | | public partial class TrendingImagesCategory |
| | | 19 | | { |
| | | 20 | | /// <summary> |
| | | 21 | | /// Initializes a new instance of the TrendingImagesCategory class. |
| | | 22 | | /// </summary> |
| | 14 | 23 | | public TrendingImagesCategory() |
| | | 24 | | { |
| | | 25 | | CustomInit(); |
| | 14 | 26 | | } |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Initializes a new instance of the TrendingImagesCategory class. |
| | | 30 | | /// </summary> |
| | | 31 | | /// <param name="title">The name of the image category. For example, |
| | | 32 | | /// Popular People Searches.</param> |
| | | 33 | | /// <param name="tiles">A list of images that are trending in the |
| | | 34 | | /// category. Each tile contains an image and a URL that returns more |
| | | 35 | | /// images of the subject. For example, if the category is Popular |
| | | 36 | | /// People Searches, the image is of a popular person and the URL would |
| | | 37 | | /// return more images of that person.</param> |
| | 0 | 38 | | public TrendingImagesCategory(string title, IList<TrendingImagesTile> tiles) |
| | | 39 | | { |
| | 0 | 40 | | Title = title; |
| | 0 | 41 | | Tiles = tiles; |
| | | 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 the name of the image category. For example, Popular |
| | | 52 | | /// People Searches. |
| | | 53 | | /// </summary> |
| | | 54 | | [JsonProperty(PropertyName = "title")] |
| | 16 | 55 | | public string Title { get; set; } |
| | | 56 | | |
| | | 57 | | /// <summary> |
| | | 58 | | /// Gets or sets a list of images that are trending in the category. |
| | | 59 | | /// Each tile contains an image and a URL that returns more images of |
| | | 60 | | /// the subject. For example, if the category is Popular People |
| | | 61 | | /// Searches, the image is of a popular person and the URL would return |
| | | 62 | | /// more images of that person. |
| | | 63 | | /// </summary> |
| | | 64 | | [JsonProperty(PropertyName = "tiles")] |
| | 34 | 65 | | public IList<TrendingImagesTile> Tiles { get; set; } |
| | | 66 | | |
| | | 67 | | /// <summary> |
| | | 68 | | /// Validate the object. |
| | | 69 | | /// </summary> |
| | | 70 | | /// <exception cref="ValidationException"> |
| | | 71 | | /// Thrown if validation fails |
| | | 72 | | /// </exception> |
| | | 73 | | public virtual void Validate() |
| | | 74 | | { |
| | 0 | 75 | | if (Title == null) |
| | | 76 | | { |
| | 0 | 77 | | throw new ValidationException(ValidationRules.CannotBeNull, "Title"); |
| | | 78 | | } |
| | 0 | 79 | | if (Tiles == null) |
| | | 80 | | { |
| | 0 | 81 | | throw new ValidationException(ValidationRules.CannotBeNull, "Tiles"); |
| | | 82 | | } |
| | 0 | 83 | | if (Tiles != null) |
| | | 84 | | { |
| | 0 | 85 | | foreach (var element in Tiles) |
| | | 86 | | { |
| | 0 | 87 | | if (element != null) |
| | | 88 | | { |
| | 0 | 89 | | element.Validate(); |
| | | 90 | | } |
| | | 91 | | } |
| | | 92 | | } |
| | 0 | 93 | | } |
| | | 94 | | } |
| | | 95 | | } |