| | 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.EntitySearch |
| | 8 | | { |
| | 9 | | using Microsoft.Rest; |
| | 10 | | using Microsoft.Rest.Serialization; |
| | 11 | | using Models; |
| | 12 | | using Newtonsoft.Json; |
| | 13 | | using System.Collections; |
| | 14 | | using System.Collections.Generic; |
| | 15 | | using System.Net; |
| | 16 | | using System.Net.Http; |
| | 17 | |
|
| | 18 | | /// <summary> |
| | 19 | | /// The Entity Search API lets you send a search query to Bing and get back |
| | 20 | | /// search results that include entities and places. Place results include |
| | 21 | | /// restaurants, hotel, or other local businesses. For places, the query |
| | 22 | | /// can specify the name of the local business or it can ask for a list |
| | 23 | | /// (for example, restaurants near me). Entity results include persons, |
| | 24 | | /// places, or things. Place in this context is tourist attractions, |
| | 25 | | /// states, countries, etc. |
| | 26 | | /// </summary> |
| | 27 | | public partial class EntitySearchClient : ServiceClient<EntitySearchClient>, IEntitySearchClient |
| | 28 | | { |
| | 29 | | /// <summary> |
| | 30 | | /// The base URI of the service. |
| | 31 | | /// </summary> |
| 4 | 32 | | internal string BaseUri {get; set;} |
| | 33 | |
|
| | 34 | | /// <summary> |
| | 35 | | /// Gets or sets json serialization settings. |
| | 36 | | /// </summary> |
| 6 | 37 | | public JsonSerializerSettings SerializationSettings { get; private set; } |
| | 38 | |
|
| | 39 | | /// <summary> |
| | 40 | | /// Gets or sets json deserialization settings. |
| | 41 | | /// </summary> |
| 8 | 42 | | public JsonSerializerSettings DeserializationSettings { get; private set; } |
| | 43 | |
|
| | 44 | | /// <summary> |
| | 45 | | /// Supported Cognitive Services endpoints (protocol and hostname, for example: |
| | 46 | | /// "https://westus.api.cognitive.microsoft.com", |
| | 47 | | /// "https://api.cognitive.microsoft.com"). |
| | 48 | | /// </summary> |
| 6 | 49 | | public string Endpoint { get; set; } |
| | 50 | |
|
| | 51 | | /// <summary> |
| | 52 | | /// Subscription credentials which uniquely identify client subscription. |
| | 53 | | /// </summary> |
| 10 | 54 | | public ServiceClientCredentials Credentials { get; private set; } |
| | 55 | |
|
| | 56 | | /// <summary> |
| | 57 | | /// Gets the IEntitiesOperations. |
| | 58 | | /// </summary> |
| 4 | 59 | | public virtual IEntitiesOperations Entities { get; private set; } |
| | 60 | |
|
| | 61 | | /// <summary> |
| | 62 | | /// Initializes a new instance of the EntitySearchClient class. |
| | 63 | | /// </summary> |
| | 64 | | /// <param name='httpClient'> |
| | 65 | | /// HttpClient to be used |
| | 66 | | /// </param> |
| | 67 | | /// <param name='disposeHttpClient'> |
| | 68 | | /// True: will dispose the provided httpClient on calling EntitySearchClient.Dispose(). False: will not dispose |
| 0 | 69 | | protected EntitySearchClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient |
| | 70 | | { |
| 0 | 71 | | Initialize(); |
| 0 | 72 | | } |
| | 73 | |
|
| | 74 | | /// <summary> |
| | 75 | | /// Initializes a new instance of the EntitySearchClient class. |
| | 76 | | /// </summary> |
| | 77 | | /// <param name='handlers'> |
| | 78 | | /// Optional. The delegating handlers to add to the http client pipeline. |
| | 79 | | /// </param> |
| 2 | 80 | | protected EntitySearchClient(params DelegatingHandler[] handlers) : base(handlers) |
| | 81 | | { |
| 2 | 82 | | Initialize(); |
| 2 | 83 | | } |
| | 84 | |
|
| | 85 | | /// <summary> |
| | 86 | | /// Initializes a new instance of the EntitySearchClient class. |
| | 87 | | /// </summary> |
| | 88 | | /// <param name='rootHandler'> |
| | 89 | | /// Optional. The http client handler used to handle http transport. |
| | 90 | | /// </param> |
| | 91 | | /// <param name='handlers'> |
| | 92 | | /// Optional. The delegating handlers to add to the http client pipeline. |
| | 93 | | /// </param> |
| 0 | 94 | | protected EntitySearchClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHand |
| | 95 | | { |
| 0 | 96 | | Initialize(); |
| 0 | 97 | | } |
| | 98 | |
|
| | 99 | | /// <summary> |
| | 100 | | /// Initializes a new instance of the EntitySearchClient class. |
| | 101 | | /// </summary> |
| | 102 | | /// <param name='credentials'> |
| | 103 | | /// Required. Subscription credentials which uniquely identify client subscription. |
| | 104 | | /// </param> |
| | 105 | | /// <param name='handlers'> |
| | 106 | | /// Optional. The delegating handlers to add to the http client pipeline. |
| | 107 | | /// </param> |
| | 108 | | /// <exception cref="System.ArgumentNullException"> |
| | 109 | | /// Thrown when a required parameter is null |
| | 110 | | /// </exception> |
| 2 | 111 | | public EntitySearchClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(hand |
| | 112 | | { |
| 2 | 113 | | if (credentials == null) |
| | 114 | | { |
| 0 | 115 | | throw new System.ArgumentNullException("credentials"); |
| | 116 | | } |
| 2 | 117 | | Credentials = credentials; |
| 2 | 118 | | if (Credentials != null) |
| | 119 | | { |
| 2 | 120 | | Credentials.InitializeServiceClient(this); |
| | 121 | | } |
| 2 | 122 | | } |
| | 123 | |
|
| | 124 | | /// <summary> |
| | 125 | | /// Initializes a new instance of the EntitySearchClient class. |
| | 126 | | /// </summary> |
| | 127 | | /// <param name='credentials'> |
| | 128 | | /// Required. Subscription credentials which uniquely identify client subscription. |
| | 129 | | /// </param> |
| | 130 | | /// <param name='httpClient'> |
| | 131 | | /// HttpClient to be used |
| | 132 | | /// </param> |
| | 133 | | /// <param name='disposeHttpClient'> |
| | 134 | | /// True: will dispose the provided httpClient on calling EntitySearchClient.Dispose(). False: will not dispose |
| | 135 | | /// <exception cref="System.ArgumentNullException"> |
| | 136 | | /// Thrown when a required parameter is null |
| | 137 | | /// </exception> |
| 0 | 138 | | public EntitySearchClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : |
| | 139 | | { |
| 0 | 140 | | if (credentials == null) |
| | 141 | | { |
| 0 | 142 | | throw new System.ArgumentNullException("credentials"); |
| | 143 | | } |
| 0 | 144 | | Credentials = credentials; |
| 0 | 145 | | if (Credentials != null) |
| | 146 | | { |
| 0 | 147 | | Credentials.InitializeServiceClient(this); |
| | 148 | | } |
| 0 | 149 | | } |
| | 150 | |
|
| | 151 | | /// <summary> |
| | 152 | | /// Initializes a new instance of the EntitySearchClient class. |
| | 153 | | /// </summary> |
| | 154 | | /// <param name='credentials'> |
| | 155 | | /// Required. Subscription credentials which uniquely identify client subscription. |
| | 156 | | /// </param> |
| | 157 | | /// <param name='rootHandler'> |
| | 158 | | /// Optional. The http client handler used to handle http transport. |
| | 159 | | /// </param> |
| | 160 | | /// <param name='handlers'> |
| | 161 | | /// Optional. The delegating handlers to add to the http client pipeline. |
| | 162 | | /// </param> |
| | 163 | | /// <exception cref="System.ArgumentNullException"> |
| | 164 | | /// Thrown when a required parameter is null |
| | 165 | | /// </exception> |
| 0 | 166 | | public EntitySearchClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params Delegating |
| | 167 | | { |
| 0 | 168 | | if (credentials == null) |
| | 169 | | { |
| 0 | 170 | | throw new System.ArgumentNullException("credentials"); |
| | 171 | | } |
| 0 | 172 | | Credentials = credentials; |
| 0 | 173 | | if (Credentials != null) |
| | 174 | | { |
| 0 | 175 | | Credentials.InitializeServiceClient(this); |
| | 176 | | } |
| 0 | 177 | | } |
| | 178 | |
|
| | 179 | | /// <summary> |
| | 180 | | /// An optional partial-method to perform custom initialization. |
| | 181 | | ///</summary> |
| | 182 | | partial void CustomInitialize(); |
| | 183 | | /// <summary> |
| | 184 | | /// Initializes client properties. |
| | 185 | | /// </summary> |
| | 186 | | private void Initialize() |
| | 187 | | { |
| 2 | 188 | | Entities = new EntitiesOperations(this); |
| 2 | 189 | | BaseUri = "{Endpoint}/bing/v7.0"; |
| 2 | 190 | | Endpoint = "https://api.cognitive.microsoft.com"; |
| 2 | 191 | | SerializationSettings = new JsonSerializerSettings |
| 2 | 192 | | { |
| 2 | 193 | | Formatting = Newtonsoft.Json.Formatting.Indented, |
| 2 | 194 | | DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, |
| 2 | 195 | | DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, |
| 2 | 196 | | NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, |
| 2 | 197 | | ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, |
| 2 | 198 | | ContractResolver = new ReadOnlyJsonContractResolver(), |
| 2 | 199 | | Converters = new List<JsonConverter> |
| 2 | 200 | | { |
| 2 | 201 | | new Iso8601TimeSpanConverter() |
| 2 | 202 | | } |
| 2 | 203 | | }; |
| 2 | 204 | | DeserializationSettings = new JsonSerializerSettings |
| 2 | 205 | | { |
| 2 | 206 | | DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, |
| 2 | 207 | | DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, |
| 2 | 208 | | NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, |
| 2 | 209 | | ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, |
| 2 | 210 | | ContractResolver = new ReadOnlyJsonContractResolver(), |
| 2 | 211 | | Converters = new List<JsonConverter> |
| 2 | 212 | | { |
| 2 | 213 | | new Iso8601TimeSpanConverter() |
| 2 | 214 | | } |
| 2 | 215 | | }; |
| 2 | 216 | | SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<ContractualRulesContractualRule>( |
| 2 | 217 | | DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter<ContractualRulesContractualR |
| 2 | 218 | | SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<ResponseBase>("_type")); |
| 2 | 219 | | DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter<ResponseBase>("_type")); |
| | 220 | | CustomInitialize(); |
| 2 | 221 | | } |
| | 222 | | } |
| | 223 | | } |