| | 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 |
| | 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 Local Search client lets you send a search query to Bing and get |
| | 20 | | /// back search results that include local businesses such as restaurants, |
| | 21 | | /// hotels, retail stores, or other local businesses. The query can specify |
| | 22 | | /// the name of the local business or it can ask for a list (for example, |
| | 23 | | /// restaurants near me). |
| | 24 | | /// </summary> |
| | 25 | | public partial class LocalSearchClient : ServiceClient<LocalSearchClient>, ILocalSearchClient |
| | 26 | | { |
| | 27 | | /// <summary> |
| | 28 | | /// The base URI of the service. |
| | 29 | | /// </summary> |
| 0 | 30 | | public System.Uri BaseUri { get; set; } |
| | 31 | |
|
| | 32 | | /// <summary> |
| | 33 | | /// Gets or sets json serialization settings. |
| | 34 | | /// </summary> |
| 0 | 35 | | public JsonSerializerSettings SerializationSettings { get; private set; } |
| | 36 | |
|
| | 37 | | /// <summary> |
| | 38 | | /// Gets or sets json deserialization settings. |
| | 39 | | /// </summary> |
| 0 | 40 | | public JsonSerializerSettings DeserializationSettings { get; private set; } |
| | 41 | |
|
| | 42 | | /// <summary> |
| | 43 | | /// Subscription credentials which uniquely identify client subscription. |
| | 44 | | /// </summary> |
| 0 | 45 | | public ServiceClientCredentials Credentials { get; private set; } |
| | 46 | |
|
| | 47 | | /// <summary> |
| | 48 | | /// Gets the ILocal. |
| | 49 | | /// </summary> |
| 0 | 50 | | public virtual ILocal Local { get; private set; } |
| | 51 | |
|
| | 52 | | /// <summary> |
| | 53 | | /// Initializes a new instance of the LocalSearchClient class. |
| | 54 | | /// </summary> |
| | 55 | | /// <param name='httpClient'> |
| | 56 | | /// HttpClient to be used |
| | 57 | | /// </param> |
| | 58 | | /// <param name='disposeHttpClient'> |
| | 59 | | /// True: will dispose the provided httpClient on calling LocalSearchClient.Dispose(). False: will not dispose p |
| 0 | 60 | | protected LocalSearchClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) |
| | 61 | | { |
| 0 | 62 | | Initialize(); |
| 0 | 63 | | } |
| | 64 | |
|
| | 65 | | /// <summary> |
| | 66 | | /// Initializes a new instance of the LocalSearchClient class. |
| | 67 | | /// </summary> |
| | 68 | | /// <param name='handlers'> |
| | 69 | | /// Optional. The delegating handlers to add to the http client pipeline. |
| | 70 | | /// </param> |
| 0 | 71 | | protected LocalSearchClient(params DelegatingHandler[] handlers) : base(handlers) |
| | 72 | | { |
| 0 | 73 | | Initialize(); |
| 0 | 74 | | } |
| | 75 | |
|
| | 76 | | /// <summary> |
| | 77 | | /// Initializes a new instance of the LocalSearchClient class. |
| | 78 | | /// </summary> |
| | 79 | | /// <param name='rootHandler'> |
| | 80 | | /// Optional. The http client handler used to handle http transport. |
| | 81 | | /// </param> |
| | 82 | | /// <param name='handlers'> |
| | 83 | | /// Optional. The delegating handlers to add to the http client pipeline. |
| | 84 | | /// </param> |
| 0 | 85 | | protected LocalSearchClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandl |
| | 86 | | { |
| 0 | 87 | | Initialize(); |
| 0 | 88 | | } |
| | 89 | |
|
| | 90 | | /// <summary> |
| | 91 | | /// Initializes a new instance of the LocalSearchClient class. |
| | 92 | | /// </summary> |
| | 93 | | /// <param name='baseUri'> |
| | 94 | | /// Optional. The base URI of the service. |
| | 95 | | /// </param> |
| | 96 | | /// <param name='handlers'> |
| | 97 | | /// Optional. The delegating handlers to add to the http client pipeline. |
| | 98 | | /// </param> |
| | 99 | | /// <exception cref="System.ArgumentNullException"> |
| | 100 | | /// Thrown when a required parameter is null |
| | 101 | | /// </exception> |
| 0 | 102 | | protected LocalSearchClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) |
| | 103 | | { |
| 0 | 104 | | if (baseUri == null) |
| | 105 | | { |
| 0 | 106 | | throw new System.ArgumentNullException("baseUri"); |
| | 107 | | } |
| 0 | 108 | | BaseUri = baseUri; |
| 0 | 109 | | } |
| | 110 | |
|
| | 111 | | /// <summary> |
| | 112 | | /// Initializes a new instance of the LocalSearchClient class. |
| | 113 | | /// </summary> |
| | 114 | | /// <param name='baseUri'> |
| | 115 | | /// Optional. The base URI of the service. |
| | 116 | | /// </param> |
| | 117 | | /// <param name='rootHandler'> |
| | 118 | | /// Optional. The http client handler used to handle http transport. |
| | 119 | | /// </param> |
| | 120 | | /// <param name='handlers'> |
| | 121 | | /// Optional. The delegating handlers to add to the http client pipeline. |
| | 122 | | /// </param> |
| | 123 | | /// <exception cref="System.ArgumentNullException"> |
| | 124 | | /// Thrown when a required parameter is null |
| | 125 | | /// </exception> |
| 0 | 126 | | protected LocalSearchClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handle |
| | 127 | | { |
| 0 | 128 | | if (baseUri == null) |
| | 129 | | { |
| 0 | 130 | | throw new System.ArgumentNullException("baseUri"); |
| | 131 | | } |
| 0 | 132 | | BaseUri = baseUri; |
| 0 | 133 | | } |
| | 134 | |
|
| | 135 | | /// <summary> |
| | 136 | | /// Initializes a new instance of the LocalSearchClient class. |
| | 137 | | /// </summary> |
| | 138 | | /// <param name='credentials'> |
| | 139 | | /// Required. Subscription credentials which uniquely identify client subscription. |
| | 140 | | /// </param> |
| | 141 | | /// <param name='handlers'> |
| | 142 | | /// Optional. The delegating handlers to add to the http client pipeline. |
| | 143 | | /// </param> |
| | 144 | | /// <exception cref="System.ArgumentNullException"> |
| | 145 | | /// Thrown when a required parameter is null |
| | 146 | | /// </exception> |
| 0 | 147 | | public LocalSearchClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handl |
| | 148 | | { |
| 0 | 149 | | if (credentials == null) |
| | 150 | | { |
| 0 | 151 | | throw new System.ArgumentNullException("credentials"); |
| | 152 | | } |
| 0 | 153 | | Credentials = credentials; |
| 0 | 154 | | if (Credentials != null) |
| | 155 | | { |
| 0 | 156 | | Credentials.InitializeServiceClient(this); |
| | 157 | | } |
| 0 | 158 | | } |
| | 159 | |
|
| | 160 | | /// <summary> |
| | 161 | | /// Initializes a new instance of the LocalSearchClient class. |
| | 162 | | /// </summary> |
| | 163 | | /// <param name='credentials'> |
| | 164 | | /// Required. Subscription credentials which uniquely identify client subscription. |
| | 165 | | /// </param> |
| | 166 | | /// <param name='httpClient'> |
| | 167 | | /// HttpClient to be used |
| | 168 | | /// </param> |
| | 169 | | /// <param name='disposeHttpClient'> |
| | 170 | | /// True: will dispose the provided httpClient on calling LocalSearchClient.Dispose(). False: will not dispose p |
| | 171 | | /// <exception cref="System.ArgumentNullException"> |
| | 172 | | /// Thrown when a required parameter is null |
| | 173 | | /// </exception> |
| 0 | 174 | | public LocalSearchClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : |
| | 175 | | { |
| 0 | 176 | | if (credentials == null) |
| | 177 | | { |
| 0 | 178 | | throw new System.ArgumentNullException("credentials"); |
| | 179 | | } |
| 0 | 180 | | Credentials = credentials; |
| 0 | 181 | | if (Credentials != null) |
| | 182 | | { |
| 0 | 183 | | Credentials.InitializeServiceClient(this); |
| | 184 | | } |
| 0 | 185 | | } |
| | 186 | |
|
| | 187 | | /// <summary> |
| | 188 | | /// Initializes a new instance of the LocalSearchClient class. |
| | 189 | | /// </summary> |
| | 190 | | /// <param name='credentials'> |
| | 191 | | /// Required. Subscription credentials which uniquely identify client subscription. |
| | 192 | | /// </param> |
| | 193 | | /// <param name='rootHandler'> |
| | 194 | | /// Optional. The http client handler used to handle http transport. |
| | 195 | | /// </param> |
| | 196 | | /// <param name='handlers'> |
| | 197 | | /// Optional. The delegating handlers to add to the http client pipeline. |
| | 198 | | /// </param> |
| | 199 | | /// <exception cref="System.ArgumentNullException"> |
| | 200 | | /// Thrown when a required parameter is null |
| | 201 | | /// </exception> |
| 0 | 202 | | public LocalSearchClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingH |
| | 203 | | { |
| 0 | 204 | | if (credentials == null) |
| | 205 | | { |
| 0 | 206 | | throw new System.ArgumentNullException("credentials"); |
| | 207 | | } |
| 0 | 208 | | Credentials = credentials; |
| 0 | 209 | | if (Credentials != null) |
| | 210 | | { |
| 0 | 211 | | Credentials.InitializeServiceClient(this); |
| | 212 | | } |
| 0 | 213 | | } |
| | 214 | |
|
| | 215 | | /// <summary> |
| | 216 | | /// Initializes a new instance of the LocalSearchClient class. |
| | 217 | | /// </summary> |
| | 218 | | /// <param name='baseUri'> |
| | 219 | | /// Optional. The base URI of the service. |
| | 220 | | /// </param> |
| | 221 | | /// <param name='credentials'> |
| | 222 | | /// Required. Subscription credentials which uniquely identify client subscription. |
| | 223 | | /// </param> |
| | 224 | | /// <param name='handlers'> |
| | 225 | | /// Optional. The delegating handlers to add to the http client pipeline. |
| | 226 | | /// </param> |
| | 227 | | /// <exception cref="System.ArgumentNullException"> |
| | 228 | | /// Thrown when a required parameter is null |
| | 229 | | /// </exception> |
| 0 | 230 | | public LocalSearchClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] ha |
| | 231 | | { |
| 0 | 232 | | if (baseUri == null) |
| | 233 | | { |
| 0 | 234 | | throw new System.ArgumentNullException("baseUri"); |
| | 235 | | } |
| 0 | 236 | | if (credentials == null) |
| | 237 | | { |
| 0 | 238 | | throw new System.ArgumentNullException("credentials"); |
| | 239 | | } |
| 0 | 240 | | BaseUri = baseUri; |
| 0 | 241 | | Credentials = credentials; |
| 0 | 242 | | if (Credentials != null) |
| | 243 | | { |
| 0 | 244 | | Credentials.InitializeServiceClient(this); |
| | 245 | | } |
| 0 | 246 | | } |
| | 247 | |
|
| | 248 | | /// <summary> |
| | 249 | | /// Initializes a new instance of the LocalSearchClient class. |
| | 250 | | /// </summary> |
| | 251 | | /// <param name='baseUri'> |
| | 252 | | /// Optional. The base URI of the service. |
| | 253 | | /// </param> |
| | 254 | | /// <param name='credentials'> |
| | 255 | | /// Required. Subscription credentials which uniquely identify client subscription. |
| | 256 | | /// </param> |
| | 257 | | /// <param name='rootHandler'> |
| | 258 | | /// Optional. The http client handler used to handle http transport. |
| | 259 | | /// </param> |
| | 260 | | /// <param name='handlers'> |
| | 261 | | /// Optional. The delegating handlers to add to the http client pipeline. |
| | 262 | | /// </param> |
| | 263 | | /// <exception cref="System.ArgumentNullException"> |
| | 264 | | /// Thrown when a required parameter is null |
| | 265 | | /// </exception> |
| 0 | 266 | | public LocalSearchClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler |
| | 267 | | { |
| 0 | 268 | | if (baseUri == null) |
| | 269 | | { |
| 0 | 270 | | throw new System.ArgumentNullException("baseUri"); |
| | 271 | | } |
| 0 | 272 | | if (credentials == null) |
| | 273 | | { |
| 0 | 274 | | throw new System.ArgumentNullException("credentials"); |
| | 275 | | } |
| 0 | 276 | | BaseUri = baseUri; |
| 0 | 277 | | Credentials = credentials; |
| 0 | 278 | | if (Credentials != null) |
| | 279 | | { |
| 0 | 280 | | Credentials.InitializeServiceClient(this); |
| | 281 | | } |
| 0 | 282 | | } |
| | 283 | |
|
| | 284 | | /// <summary> |
| | 285 | | /// An optional partial-method to perform custom initialization. |
| | 286 | | ///</summary> |
| | 287 | | partial void CustomInitialize(); |
| | 288 | | /// <summary> |
| | 289 | | /// Initializes client properties. |
| | 290 | | /// </summary> |
| | 291 | | private void Initialize() |
| | 292 | | { |
| 0 | 293 | | Local = new Local(this); |
| 0 | 294 | | BaseUri = new System.Uri("https://api.cognitive.microsoft.com/localbusinesses/v7.0/search"); |
| 0 | 295 | | SerializationSettings = new JsonSerializerSettings |
| 0 | 296 | | { |
| 0 | 297 | | Formatting = Newtonsoft.Json.Formatting.Indented, |
| 0 | 298 | | DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, |
| 0 | 299 | | DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, |
| 0 | 300 | | NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, |
| 0 | 301 | | ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, |
| 0 | 302 | | ContractResolver = new ReadOnlyJsonContractResolver(), |
| 0 | 303 | | Converters = new List<JsonConverter> |
| 0 | 304 | | { |
| 0 | 305 | | new Iso8601TimeSpanConverter() |
| 0 | 306 | | } |
| 0 | 307 | | }; |
| 0 | 308 | | DeserializationSettings = new JsonSerializerSettings |
| 0 | 309 | | { |
| 0 | 310 | | DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, |
| 0 | 311 | | DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, |
| 0 | 312 | | NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, |
| 0 | 313 | | ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, |
| 0 | 314 | | ContractResolver = new ReadOnlyJsonContractResolver(), |
| 0 | 315 | | Converters = new List<JsonConverter> |
| 0 | 316 | | { |
| 0 | 317 | | new Iso8601TimeSpanConverter() |
| 0 | 318 | | } |
| 0 | 319 | | }; |
| 0 | 320 | | SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<QueryContext>("_type")); |
| 0 | 321 | | DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter<QueryContext>("_type")); |
| 0 | 322 | | SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<EntitiesEntityPresentationInfo>(" |
| 0 | 323 | | DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter<EntitiesEntityPresentationIn |
| 0 | 324 | | SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<GeoCoordinates>("_type")); |
| 0 | 325 | | DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter<GeoCoordinates>("_type")); |
| 0 | 326 | | SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<Error>("_type")); |
| 0 | 327 | | DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter<Error>("_type")); |
| 0 | 328 | | SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<ResponseBase>("_type")); |
| 0 | 329 | | DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter<ResponseBase>("_type")); |
| | 330 | | CustomInitialize(); |
| 0 | 331 | | } |
| | 332 | | } |
| | 333 | | } |