| | 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.EntitySearch.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 entity answer. |
| | 17 | | /// </summary> |
| | 18 | | public partial class Entities : SearchResultsAnswer |
| | 19 | | { |
| | 20 | | /// <summary> |
| | 21 | | /// Initializes a new instance of the Entities class. |
| | 22 | | /// </summary> |
| 2 | 23 | | public Entities() |
| | 24 | | { |
| | 25 | | CustomInit(); |
| 2 | 26 | | } |
| | 27 | |
|
| | 28 | | /// <summary> |
| | 29 | | /// Initializes a new instance of the Entities class. |
| | 30 | | /// </summary> |
| | 31 | | /// <param name="value">A list of entities.</param> |
| | 32 | | /// <param name="id">A String identifier.</param> |
| | 33 | | /// <param name="contractualRules">A list of rules that you must adhere |
| | 34 | | /// to if you display the item.</param> |
| | 35 | | /// <param name="webSearchUrl">The URL To Bing's search result for this |
| | 36 | | /// item.</param> |
| | 37 | | /// <param name="queryScenario">The supported query scenario. This |
| | 38 | | /// field is set to DominantEntity or DisambiguationItem. The field is |
| | 39 | | /// set to DominantEntity if Bing determines that only a single entity |
| | 40 | | /// satisfies the request. For example, a book, movie, person, or |
| | 41 | | /// attraction. If multiple entities could satisfy the request, the |
| | 42 | | /// field is set to DisambiguationItem. For example, if the request |
| | 43 | | /// uses the generic title of a movie franchise, the entity's type |
| | 44 | | /// would likely be DisambiguationItem. But, if the request specifies a |
| | 45 | | /// specific title from the franchise, the entity's type would likely |
| | 46 | | /// be DominantEntity. Possible values include: 'DominantEntity', |
| | 47 | | /// 'DominantEntityWithDisambiguation', 'Disambiguation', 'List', |
| | 48 | | /// 'ListWithPivot'</param> |
| | 49 | | public Entities(IList<Thing> value, string id = default(string), IList<ContractualRulesContractualRule> contract |
| 0 | 50 | | : base(id, contractualRules, webSearchUrl, queryContext) |
| | 51 | | { |
| 0 | 52 | | QueryScenario = queryScenario; |
| 0 | 53 | | Value = value; |
| | 54 | | CustomInit(); |
| 0 | 55 | | } |
| | 56 | |
|
| | 57 | | /// <summary> |
| | 58 | | /// An initialization method that performs custom operations like setting defaults |
| | 59 | | /// </summary> |
| | 60 | | partial void CustomInit(); |
| | 61 | |
|
| | 62 | | /// <summary> |
| | 63 | | /// Gets the supported query scenario. This field is set to |
| | 64 | | /// DominantEntity or DisambiguationItem. The field is set to |
| | 65 | | /// DominantEntity if Bing determines that only a single entity |
| | 66 | | /// satisfies the request. For example, a book, movie, person, or |
| | 67 | | /// attraction. If multiple entities could satisfy the request, the |
| | 68 | | /// field is set to DisambiguationItem. For example, if the request |
| | 69 | | /// uses the generic title of a movie franchise, the entity's type |
| | 70 | | /// would likely be DisambiguationItem. But, if the request specifies a |
| | 71 | | /// specific title from the franchise, the entity's type would likely |
| | 72 | | /// be DominantEntity. Possible values include: 'DominantEntity', |
| | 73 | | /// 'DominantEntityWithDisambiguation', 'Disambiguation', 'List', |
| | 74 | | /// 'ListWithPivot' |
| | 75 | | /// </summary> |
| | 76 | | [JsonProperty(PropertyName = "queryScenario")] |
| 0 | 77 | | public string QueryScenario { get; private set; } |
| | 78 | |
|
| | 79 | | /// <summary> |
| | 80 | | /// Gets or sets a list of entities. |
| | 81 | | /// </summary> |
| | 82 | | [JsonProperty(PropertyName = "value")] |
| 12 | 83 | | public IList<Thing> Value { get; set; } |
| | 84 | |
|
| | 85 | | /// <summary> |
| | 86 | | /// Validate the object. |
| | 87 | | /// </summary> |
| | 88 | | /// <exception cref="ValidationException"> |
| | 89 | | /// Thrown if validation fails |
| | 90 | | /// </exception> |
| | 91 | | public override void Validate() |
| | 92 | | { |
| 0 | 93 | | base.Validate(); |
| 0 | 94 | | if (Value == null) |
| | 95 | | { |
| 0 | 96 | | throw new ValidationException(ValidationRules.CannotBeNull, "Value"); |
| | 97 | | } |
| 0 | 98 | | if (Value != null) |
| | 99 | | { |
| 0 | 100 | | foreach (var element in Value) |
| | 101 | | { |
| 0 | 102 | | if (element != null) |
| | 103 | | { |
| 0 | 104 | | element.Validate(); |
| | 105 | | } |
| | 106 | | } |
| | 107 | | } |
| 0 | 108 | | } |
| | 109 | | } |
| | 110 | | } |