| | 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's caption. |
| | 17 | | /// </summary> |
| | 18 | | public partial class ImageInsightsImageCaption |
| | 19 | | { |
| | 20 | | /// <summary> |
| | 21 | | /// Initializes a new instance of the ImageInsightsImageCaption class. |
| | 22 | | /// </summary> |
| 2 | 23 | | public ImageInsightsImageCaption() |
| | 24 | | { |
| | 25 | | CustomInit(); |
| 2 | 26 | | } |
| | 27 | |
|
| | 28 | | /// <summary> |
| | 29 | | /// Initializes a new instance of the ImageInsightsImageCaption class. |
| | 30 | | /// </summary> |
| | 31 | | /// <param name="caption">A caption about the image.</param> |
| | 32 | | /// <param name="dataSourceUrl">The URL to the website where the |
| | 33 | | /// caption was found. You must attribute the caption to the source. |
| | 34 | | /// For example, by displaying the domain name from the URL next to the |
| | 35 | | /// caption and using the URL to link to the source website.</param> |
| | 36 | | /// <param name="relatedSearches">A list of entities found in the |
| | 37 | | /// caption. Use the contents of the Query object to find the entity in |
| | 38 | | /// the caption and create a link. The link takes the user to images of |
| | 39 | | /// the entity.</param> |
| 0 | 40 | | public ImageInsightsImageCaption(string caption, string dataSourceUrl, IList<Query> relatedSearches) |
| | 41 | | { |
| 0 | 42 | | Caption = caption; |
| 0 | 43 | | DataSourceUrl = dataSourceUrl; |
| 0 | 44 | | RelatedSearches = relatedSearches; |
| | 45 | | CustomInit(); |
| 0 | 46 | | } |
| | 47 | |
|
| | 48 | | /// <summary> |
| | 49 | | /// An initialization method that performs custom operations like setting defaults |
| | 50 | | /// </summary> |
| | 51 | | partial void CustomInit(); |
| | 52 | |
|
| | 53 | | /// <summary> |
| | 54 | | /// Gets or sets a caption about the image. |
| | 55 | | /// </summary> |
| | 56 | | [JsonProperty(PropertyName = "caption")] |
| 0 | 57 | | public string Caption { get; set; } |
| | 58 | |
|
| | 59 | | /// <summary> |
| | 60 | | /// Gets or sets the URL to the website where the caption was found. |
| | 61 | | /// You must attribute the caption to the source. For example, by |
| | 62 | | /// displaying the domain name from the URL next to the caption and |
| | 63 | | /// using the URL to link to the source website. |
| | 64 | | /// </summary> |
| | 65 | | [JsonProperty(PropertyName = "dataSourceUrl")] |
| 0 | 66 | | public string DataSourceUrl { get; set; } |
| | 67 | |
|
| | 68 | | /// <summary> |
| | 69 | | /// Gets or sets a list of entities found in the caption. Use the |
| | 70 | | /// contents of the Query object to find the entity in the caption and |
| | 71 | | /// create a link. The link takes the user to images of the entity. |
| | 72 | | /// </summary> |
| | 73 | | [JsonProperty(PropertyName = "relatedSearches")] |
| 4 | 74 | | public IList<Query> RelatedSearches { get; set; } |
| | 75 | |
|
| | 76 | | /// <summary> |
| | 77 | | /// Validate the object. |
| | 78 | | /// </summary> |
| | 79 | | /// <exception cref="ValidationException"> |
| | 80 | | /// Thrown if validation fails |
| | 81 | | /// </exception> |
| | 82 | | public virtual void Validate() |
| | 83 | | { |
| 0 | 84 | | if (Caption == null) |
| | 85 | | { |
| 0 | 86 | | throw new ValidationException(ValidationRules.CannotBeNull, "Caption"); |
| | 87 | | } |
| 0 | 88 | | if (DataSourceUrl == null) |
| | 89 | | { |
| 0 | 90 | | throw new ValidationException(ValidationRules.CannotBeNull, "DataSourceUrl"); |
| | 91 | | } |
| 0 | 92 | | if (RelatedSearches == null) |
| | 93 | | { |
| 0 | 94 | | throw new ValidationException(ValidationRules.CannotBeNull, "RelatedSearches"); |
| | 95 | | } |
| 0 | 96 | | if (RelatedSearches != null) |
| | 97 | | { |
| 0 | 98 | | foreach (var element in RelatedSearches) |
| | 99 | | { |
| 0 | 100 | | if (element != null) |
| | 101 | | { |
| 0 | 102 | | element.Validate(); |
| | 103 | | } |
| | 104 | | } |
| | 105 | | } |
| 0 | 106 | | } |
| | 107 | | } |
| | 108 | | } |