| | 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.LocalSearch.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="alterationDisplayQuery">AlteredQuery that is formatted |
| | 38 | | /// for display purpose. The query string in the AlterationDisplayQuery |
| | 39 | | /// can be html-escaped and can contain hit-highlighting |
| | 40 | | /// characters</param> |
| | 41 | | /// <param name="alterationOverrideQuery">The query string to use to |
| | 42 | | /// force Bing to use the original string. For example, if the query |
| | 43 | | /// string is "saling downwind", the override query string will be |
| | 44 | | /// "+saling downwind". Remember to encode the query string which |
| | 45 | | /// results in "%2Bsaling+downwind". This field is included only if the |
| | 46 | | /// original query string contains a spelling mistake.</param> |
| | 47 | | /// <param name="adultIntent">A Boolean value that indicates whether |
| | 48 | | /// the specified query has adult intent. The value is true if the |
| | 49 | | /// query has adult intent; otherwise, false.</param> |
| | 50 | | /// <param name="askUserForLocation">A Boolean value that indicates |
| | 51 | | /// whether Bing requires the user's location to provide accurate |
| | 52 | | /// results. If you specified the user's location by using the |
| | 53 | | /// X-MSEdge-ClientIP and X-Search-Location headers, you can ignore |
| | 54 | | /// this field. For location aware queries, such as "today's weather" |
| | 55 | | /// or "restaurants near me" that need the user's location to provide |
| | 56 | | /// accurate results, this field is set to true. For location aware |
| | 57 | | /// queries that include the location (for example, "Seattle weather"), |
| | 58 | | /// this field is set to false. This field is also set to false for |
| | 59 | | /// queries that are not location aware, such as "best |
| | 60 | | /// sellers".</param> |
| 0 | 61 | | public QueryContext(string originalQuery, string alteredQuery = default(string), string alterationDisplayQuery = |
| | 62 | | { |
| 0 | 63 | | OriginalQuery = originalQuery; |
| 0 | 64 | | AlteredQuery = alteredQuery; |
| 0 | 65 | | AlterationDisplayQuery = alterationDisplayQuery; |
| 0 | 66 | | AlterationOverrideQuery = alterationOverrideQuery; |
| 0 | 67 | | AdultIntent = adultIntent; |
| 0 | 68 | | AskUserForLocation = askUserForLocation; |
| 0 | 69 | | IsTransactional = isTransactional; |
| | 70 | | CustomInit(); |
| 0 | 71 | | } |
| | 72 | |
|
| | 73 | | /// <summary> |
| | 74 | | /// An initialization method that performs custom operations like setting defaults |
| | 75 | | /// </summary> |
| | 76 | | partial void CustomInit(); |
| | 77 | |
|
| | 78 | | /// <summary> |
| | 79 | | /// Gets or sets the query string as specified in the request. |
| | 80 | | /// </summary> |
| | 81 | | [JsonProperty(PropertyName = "originalQuery")] |
| 0 | 82 | | public string OriginalQuery { get; set; } |
| | 83 | |
|
| | 84 | | /// <summary> |
| | 85 | | /// Gets the query string used by Bing to perform the query. Bing uses |
| | 86 | | /// the altered query string if the original query string contained |
| | 87 | | /// spelling mistakes. For example, if the query string is "saling |
| | 88 | | /// downwind", the altered query string will be "sailing downwind". |
| | 89 | | /// This field is included only if the original query string contains a |
| | 90 | | /// spelling mistake. |
| | 91 | | /// </summary> |
| | 92 | | [JsonProperty(PropertyName = "alteredQuery")] |
| 0 | 93 | | public string AlteredQuery { get; private set; } |
| | 94 | |
|
| | 95 | | /// <summary> |
| | 96 | | /// Gets alteredQuery that is formatted for display purpose. The query |
| | 97 | | /// string in the AlterationDisplayQuery can be html-escaped and can |
| | 98 | | /// contain hit-highlighting characters |
| | 99 | | /// </summary> |
| | 100 | | [JsonProperty(PropertyName = "alterationDisplayQuery")] |
| 0 | 101 | | public string AlterationDisplayQuery { get; private set; } |
| | 102 | |
|
| | 103 | | /// <summary> |
| | 104 | | /// Gets the query string to use to force Bing to use the original |
| | 105 | | /// string. For example, if the query string is "saling downwind", the |
| | 106 | | /// override query string will be "+saling downwind". Remember to |
| | 107 | | /// encode the query string which results in "%2Bsaling+downwind". This |
| | 108 | | /// field is included only if the original query string contains a |
| | 109 | | /// spelling mistake. |
| | 110 | | /// </summary> |
| | 111 | | [JsonProperty(PropertyName = "alterationOverrideQuery")] |
| 0 | 112 | | public string AlterationOverrideQuery { get; private set; } |
| | 113 | |
|
| | 114 | | /// <summary> |
| | 115 | | /// Gets a Boolean value that indicates whether the specified query has |
| | 116 | | /// adult intent. The value is true if the query has adult intent; |
| | 117 | | /// otherwise, false. |
| | 118 | | /// </summary> |
| | 119 | | [JsonProperty(PropertyName = "adultIntent")] |
| 0 | 120 | | public bool? AdultIntent { get; private set; } |
| | 121 | |
|
| | 122 | | /// <summary> |
| | 123 | | /// Gets a Boolean value that indicates whether Bing requires the |
| | 124 | | /// user's location to provide accurate results. If you specified the |
| | 125 | | /// user's location by using the X-MSEdge-ClientIP and |
| | 126 | | /// X-Search-Location headers, you can ignore this field. For location |
| | 127 | | /// aware queries, such as "today's weather" or "restaurants near me" |
| | 128 | | /// that need the user's location to provide accurate results, this |
| | 129 | | /// field is set to true. For location aware queries that include the |
| | 130 | | /// location (for example, "Seattle weather"), this field is set to |
| | 131 | | /// false. This field is also set to false for queries that are not |
| | 132 | | /// location aware, such as "best sellers". |
| | 133 | | /// </summary> |
| | 134 | | [JsonProperty(PropertyName = "askUserForLocation")] |
| 0 | 135 | | public bool? AskUserForLocation { get; private set; } |
| | 136 | |
|
| | 137 | | /// <summary> |
| | 138 | | /// </summary> |
| | 139 | | [JsonProperty(PropertyName = "isTransactional")] |
| 0 | 140 | | public bool? IsTransactional { get; private set; } |
| | 141 | |
|
| | 142 | | /// <summary> |
| | 143 | | /// Validate the object. |
| | 144 | | /// </summary> |
| | 145 | | /// <exception cref="ValidationException"> |
| | 146 | | /// Thrown if validation fails |
| | 147 | | /// </exception> |
| | 148 | | public virtual void Validate() |
| | 149 | | { |
| 0 | 150 | | if (OriginalQuery == null) |
| | 151 | | { |
| 0 | 152 | | throw new ValidationException(ValidationRules.CannotBeNull, "OriginalQuery"); |
| | 153 | | } |
| 0 | 154 | | } |
| | 155 | | } |
| | 156 | | } |