| | 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 a search query. |
| | 15 | | /// </summary> |
| | 16 | | public partial class Query |
| | 17 | | { |
| | 18 | | /// <summary> |
| | 19 | | /// Initializes a new instance of the Query class. |
| | 20 | | /// </summary> |
| 0 | 21 | | public Query() |
| | 22 | | { |
| | 23 | | CustomInit(); |
| 0 | 24 | | } |
| | 25 | |
|
| | 26 | | /// <summary> |
| | 27 | | /// Initializes a new instance of the Query class. |
| | 28 | | /// </summary> |
| | 29 | | /// <param name="text">The query string. Use this string as the query |
| | 30 | | /// term in a new search request.</param> |
| | 31 | | /// <param name="displayText">The display version of the query term. |
| | 32 | | /// This version of the query term may contain special characters that |
| | 33 | | /// highlight the search term found in the query string. The string |
| | 34 | | /// contains the highlighting characters only if the query enabled hit |
| | 35 | | /// highlighting</param> |
| | 36 | | /// <param name="webSearchUrl">The URL that takes the user to the Bing |
| | 37 | | /// search results page for the query.Only related search results |
| | 38 | | /// include this field.</param> |
| 0 | 39 | | public Query(string text, string displayText = default(string), string webSearchUrl = default(string), string se |
| | 40 | | { |
| 0 | 41 | | Text = text; |
| 0 | 42 | | DisplayText = displayText; |
| 0 | 43 | | WebSearchUrl = webSearchUrl; |
| 0 | 44 | | SearchLink = searchLink; |
| | 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 the query string. Use this string as the query term in |
| | 55 | | /// a new search request. |
| | 56 | | /// </summary> |
| | 57 | | [JsonProperty(PropertyName = "text")] |
| 0 | 58 | | public string Text { get; set; } |
| | 59 | |
|
| | 60 | | /// <summary> |
| | 61 | | /// Gets the display version of the query term. This version of the |
| | 62 | | /// query term may contain special characters that highlight the search |
| | 63 | | /// term found in the query string. The string contains the |
| | 64 | | /// highlighting characters only if the query enabled hit highlighting |
| | 65 | | /// </summary> |
| | 66 | | [JsonProperty(PropertyName = "displayText")] |
| 0 | 67 | | public string DisplayText { get; private set; } |
| | 68 | |
|
| | 69 | | /// <summary> |
| | 70 | | /// Gets the URL that takes the user to the Bing search results page |
| | 71 | | /// for the query.Only related search results include this field. |
| | 72 | | /// </summary> |
| | 73 | | [JsonProperty(PropertyName = "webSearchUrl")] |
| 0 | 74 | | public string WebSearchUrl { get; private set; } |
| | 75 | |
|
| | 76 | | /// <summary> |
| | 77 | | /// </summary> |
| | 78 | | [JsonProperty(PropertyName = "searchLink")] |
| 0 | 79 | | public string SearchLink { get; private set; } |
| | 80 | |
|
| | 81 | | /// <summary> |
| | 82 | | /// Validate the object. |
| | 83 | | /// </summary> |
| | 84 | | /// <exception cref="ValidationException"> |
| | 85 | | /// Thrown if validation fails |
| | 86 | | /// </exception> |
| | 87 | | public virtual void Validate() |
| | 88 | | { |
| 0 | 89 | | if (Text == null) |
| | 90 | | { |
| 0 | 91 | | throw new ValidationException(ValidationRules.CannotBeNull, "Text"); |
| | 92 | | } |
| 0 | 93 | | } |
| | 94 | | } |
| | 95 | | } |