| | 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.VisualSearch.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> |
| 52 | 21 | | public Query() |
| | 22 | | { |
| | 23 | | CustomInit(); |
| 52 | 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 |
| | 32 | | /// term.</param> |
| | 33 | | /// <param name="webSearchUrl">The URL that takes the user to the Bing |
| | 34 | | /// search results page for the query.</param> |
| | 35 | | /// <param name="searchLink">The URL that you use to get the results of |
| | 36 | | /// the related search. Before using the URL, you must append query |
| | 37 | | /// parameters as appropriate and include the Ocp-Apim-Subscription-Key |
| | 38 | | /// header. Use this URL if you're displaying the results in your own |
| | 39 | | /// user interface. Otherwise, use the webSearchUrl URL.</param> |
| | 40 | | /// <param name="thumbnail">The URL to a thumbnail of a related |
| | 41 | | /// image.</param> |
| 0 | 42 | | public Query(string text, string displayText = default(string), string webSearchUrl = default(string), string se |
| | 43 | | { |
| 0 | 44 | | Text = text; |
| 0 | 45 | | DisplayText = displayText; |
| 0 | 46 | | WebSearchUrl = webSearchUrl; |
| 0 | 47 | | SearchLink = searchLink; |
| 0 | 48 | | Thumbnail = thumbnail; |
| | 49 | | CustomInit(); |
| 0 | 50 | | } |
| | 51 | |
|
| | 52 | | /// <summary> |
| | 53 | | /// An initialization method that performs custom operations like setting defaults |
| | 54 | | /// </summary> |
| | 55 | | partial void CustomInit(); |
| | 56 | |
|
| | 57 | | /// <summary> |
| | 58 | | /// Gets or sets the query string. Use this string as the query term in |
| | 59 | | /// a new search request. |
| | 60 | | /// </summary> |
| | 61 | | [JsonProperty(PropertyName = "text")] |
| 0 | 62 | | public string Text { get; set; } |
| | 63 | |
|
| | 64 | | /// <summary> |
| | 65 | | /// Gets the display version of the query term. |
| | 66 | | /// </summary> |
| | 67 | | [JsonProperty(PropertyName = "displayText")] |
| 0 | 68 | | public string DisplayText { get; private set; } |
| | 69 | |
|
| | 70 | | /// <summary> |
| | 71 | | /// Gets the URL that takes the user to the Bing search results page |
| | 72 | | /// for the query. |
| | 73 | | /// </summary> |
| | 74 | | [JsonProperty(PropertyName = "webSearchUrl")] |
| 0 | 75 | | public string WebSearchUrl { get; private set; } |
| | 76 | |
|
| | 77 | | /// <summary> |
| | 78 | | /// Gets the URL that you use to get the results of the related search. |
| | 79 | | /// Before using the URL, you must append query parameters as |
| | 80 | | /// appropriate and include the Ocp-Apim-Subscription-Key header. Use |
| | 81 | | /// this URL if you're displaying the results in your own user |
| | 82 | | /// interface. Otherwise, use the webSearchUrl URL. |
| | 83 | | /// </summary> |
| | 84 | | [JsonProperty(PropertyName = "searchLink")] |
| 0 | 85 | | public string SearchLink { get; private set; } |
| | 86 | |
|
| | 87 | | /// <summary> |
| | 88 | | /// Gets the URL to a thumbnail of a related image. |
| | 89 | | /// </summary> |
| | 90 | | [JsonProperty(PropertyName = "thumbnail")] |
| 104 | 91 | | public ImageObject Thumbnail { get; private set; } |
| | 92 | |
|
| | 93 | | /// <summary> |
| | 94 | | /// Validate the object. |
| | 95 | | /// </summary> |
| | 96 | | /// <exception cref="ValidationException"> |
| | 97 | | /// Thrown if validation fails |
| | 98 | | /// </exception> |
| | 99 | | public virtual void Validate() |
| | 100 | | { |
| 0 | 101 | | if (Text == null) |
| | 102 | | { |
| 0 | 103 | | throw new ValidationException(ValidationRules.CannotBeNull, "Text"); |
| | 104 | | } |
| 0 | 105 | | } |
| | 106 | | } |
| | 107 | | } |