| | 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.CustomSearch.Models |
| | 8 | | { |
| | 9 | | using Microsoft.Rest; |
| | 10 | | using Newtonsoft.Json; |
| | 11 | | using System.Linq; |
| | 12 | |
|
| | 13 | | /// <summary> |
| | 14 | | /// Defines the query context that Bing used for the request. |
| | 15 | | /// </summary> |
| | 16 | | public partial class QueryContext |
| | 17 | | { |
| | 18 | | /// <summary> |
| | 19 | | /// Initializes a new instance of the QueryContext class. |
| | 20 | | /// </summary> |
| 0 | 21 | | public QueryContext() |
| | 22 | | { |
| | 23 | | CustomInit(); |
| 0 | 24 | | } |
| | 25 | |
|
| | 26 | | /// <summary> |
| | 27 | | /// Initializes a new instance of the QueryContext class. |
| | 28 | | /// </summary> |
| | 29 | | /// <param name="originalQuery">The query string as specified in the |
| | 30 | | /// request.</param> |
| | 31 | | /// <param name="alteredQuery">The query string used by Bing to perform |
| | 32 | | /// the query. Bing uses the altered query string if the original query |
| | 33 | | /// string contained spelling mistakes. For example, if the query |
| | 34 | | /// string is "saling downwind", the altered query string will be |
| | 35 | | /// "sailing downwind". This field is included only if the original |
| | 36 | | /// query string contains a spelling mistake.</param> |
| | 37 | | /// <param name="alterationOverrideQuery">The query string to use to |
| | 38 | | /// force Bing to use the original string. For example, if the query |
| | 39 | | /// string is "saling downwind", the override query string will be |
| | 40 | | /// "+saling downwind". Remember to encode the query string which |
| | 41 | | /// results in "%2Bsaling+downwind". This field is included only if the |
| | 42 | | /// original query string contains a spelling mistake.</param> |
| | 43 | | /// <param name="adultIntent">A Boolean value that indicates whether |
| | 44 | | /// the specified query has adult intent. The value is true if the |
| | 45 | | /// query has adult intent; otherwise, false.</param> |
| 0 | 46 | | public QueryContext(string originalQuery, string alteredQuery = default(string), string alterationOverrideQuery |
| | 47 | | { |
| 0 | 48 | | OriginalQuery = originalQuery; |
| 0 | 49 | | AlteredQuery = alteredQuery; |
| 0 | 50 | | AlterationOverrideQuery = alterationOverrideQuery; |
| 0 | 51 | | AdultIntent = adultIntent; |
| | 52 | | CustomInit(); |
| 0 | 53 | | } |
| | 54 | |
|
| | 55 | | /// <summary> |
| | 56 | | /// An initialization method that performs custom operations like setting defaults |
| | 57 | | /// </summary> |
| | 58 | | partial void CustomInit(); |
| | 59 | |
|
| | 60 | | /// <summary> |
| | 61 | | /// Gets or sets the query string as specified in the request. |
| | 62 | | /// </summary> |
| | 63 | | [JsonProperty(PropertyName = "originalQuery")] |
| 0 | 64 | | public string OriginalQuery { get; set; } |
| | 65 | |
|
| | 66 | | /// <summary> |
| | 67 | | /// Gets the query string used by Bing to perform the query. Bing uses |
| | 68 | | /// the altered query string if the original query string contained |
| | 69 | | /// spelling mistakes. For example, if the query string is "saling |
| | 70 | | /// downwind", the altered query string will be "sailing downwind". |
| | 71 | | /// This field is included only if the original query string contains a |
| | 72 | | /// spelling mistake. |
| | 73 | | /// </summary> |
| | 74 | | [JsonProperty(PropertyName = "alteredQuery")] |
| 0 | 75 | | public string AlteredQuery { get; private set; } |
| | 76 | |
|
| | 77 | | /// <summary> |
| | 78 | | /// Gets the query string to use to force Bing to use the original |
| | 79 | | /// string. For example, if the query string is "saling downwind", the |
| | 80 | | /// override query string will be "+saling downwind". Remember to |
| | 81 | | /// encode the query string which results in "%2Bsaling+downwind". This |
| | 82 | | /// field is included only if the original query string contains a |
| | 83 | | /// spelling mistake. |
| | 84 | | /// </summary> |
| | 85 | | [JsonProperty(PropertyName = "alterationOverrideQuery")] |
| 0 | 86 | | public string AlterationOverrideQuery { get; private set; } |
| | 87 | |
|
| | 88 | | /// <summary> |
| | 89 | | /// Gets a Boolean value that indicates whether the specified query has |
| | 90 | | /// adult intent. The value is true if the query has adult intent; |
| | 91 | | /// otherwise, false. |
| | 92 | | /// </summary> |
| | 93 | | [JsonProperty(PropertyName = "adultIntent")] |
| 0 | 94 | | public bool? AdultIntent { get; private set; } |
| | 95 | |
|
| | 96 | | /// <summary> |
| | 97 | | /// Validate the object. |
| | 98 | | /// </summary> |
| | 99 | | /// <exception cref="ValidationException"> |
| | 100 | | /// Thrown if validation fails |
| | 101 | | /// </exception> |
| | 102 | | public virtual void Validate() |
| | 103 | | { |
| 0 | 104 | | if (OriginalQuery == null) |
| | 105 | | { |
| 0 | 106 | | throw new ValidationException(ValidationRules.CannotBeNull, "OriginalQuery"); |
| | 107 | | } |
| 0 | 108 | | } |
| | 109 | | } |
| | 110 | | } |