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