< Summary

Class:Microsoft.Azure.CognitiveServices.Search.LocalSearch.LocalSearchClient
Assembly:Microsoft.Azure.CognitiveServices.Search.BingLocalSearch
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingLocalSearch\src\Generated\LocalSearch\LocalSearchClient.cs
Covered lines:0
Uncovered lines:103
Coverable lines:103
Total lines:333
Line coverage:0% (0 of 103)
Covered branches:0
Total branches:28
Branch coverage:0% (0 of 28)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_BaseUri()-0%100%
get_SerializationSettings()-0%100%
get_DeserializationSettings()-0%100%
get_Credentials()-0%100%
get_Local()-0%100%
.ctor(...)-0%100%
.ctor(...)-0%100%
.ctor(...)-0%100%
.ctor(...)-0%0%
.ctor(...)-0%0%
.ctor(...)-0%0%
.ctor(...)-0%0%
.ctor(...)-0%0%
.ctor(...)-0%0%
.ctor(...)-0%0%
Initialize()-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingLocalSearch\src\Generated\LocalSearch\LocalSearchClient.cs

#LineLine coverage
 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
 7namespace 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>
 030        public System.Uri BaseUri { get; set; }
 31
 32        /// <summary>
 33        /// Gets or sets json serialization settings.
 34        /// </summary>
 035        public JsonSerializerSettings SerializationSettings { get; private set; }
 36
 37        /// <summary>
 38        /// Gets or sets json deserialization settings.
 39        /// </summary>
 040        public JsonSerializerSettings DeserializationSettings { get; private set; }
 41
 42        /// <summary>
 43        /// Subscription credentials which uniquely identify client subscription.
 44        /// </summary>
 045        public ServiceClientCredentials Credentials { get; private set; }
 46
 47        /// <summary>
 48        /// Gets the ILocal.
 49        /// </summary>
 050        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
 060        protected LocalSearchClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient)
 61        {
 062            Initialize();
 063        }
 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>
 071        protected LocalSearchClient(params DelegatingHandler[] handlers) : base(handlers)
 72        {
 073            Initialize();
 074        }
 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>
 085        protected LocalSearchClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandl
 86        {
 087            Initialize();
 088        }
 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>
 0102        protected LocalSearchClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers)
 103        {
 0104            if (baseUri == null)
 105            {
 0106                throw new System.ArgumentNullException("baseUri");
 107            }
 0108            BaseUri = baseUri;
 0109        }
 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>
 0126        protected LocalSearchClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handle
 127        {
 0128            if (baseUri == null)
 129            {
 0130                throw new System.ArgumentNullException("baseUri");
 131            }
 0132            BaseUri = baseUri;
 0133        }
 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>
 0147        public LocalSearchClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handl
 148        {
 0149            if (credentials == null)
 150            {
 0151                throw new System.ArgumentNullException("credentials");
 152            }
 0153            Credentials = credentials;
 0154            if (Credentials != null)
 155            {
 0156                Credentials.InitializeServiceClient(this);
 157            }
 0158        }
 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>
 0174        public LocalSearchClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : 
 175        {
 0176            if (credentials == null)
 177            {
 0178                throw new System.ArgumentNullException("credentials");
 179            }
 0180            Credentials = credentials;
 0181            if (Credentials != null)
 182            {
 0183                Credentials.InitializeServiceClient(this);
 184            }
 0185        }
 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>
 0202        public LocalSearchClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingH
 203        {
 0204            if (credentials == null)
 205            {
 0206                throw new System.ArgumentNullException("credentials");
 207            }
 0208            Credentials = credentials;
 0209            if (Credentials != null)
 210            {
 0211                Credentials.InitializeServiceClient(this);
 212            }
 0213        }
 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>
 0230        public LocalSearchClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] ha
 231        {
 0232            if (baseUri == null)
 233            {
 0234                throw new System.ArgumentNullException("baseUri");
 235            }
 0236            if (credentials == null)
 237            {
 0238                throw new System.ArgumentNullException("credentials");
 239            }
 0240            BaseUri = baseUri;
 0241            Credentials = credentials;
 0242            if (Credentials != null)
 243            {
 0244                Credentials.InitializeServiceClient(this);
 245            }
 0246        }
 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>
 0266        public LocalSearchClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler
 267        {
 0268            if (baseUri == null)
 269            {
 0270                throw new System.ArgumentNullException("baseUri");
 271            }
 0272            if (credentials == null)
 273            {
 0274                throw new System.ArgumentNullException("credentials");
 275            }
 0276            BaseUri = baseUri;
 0277            Credentials = credentials;
 0278            if (Credentials != null)
 279            {
 0280                Credentials.InitializeServiceClient(this);
 281            }
 0282        }
 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        {
 0293            Local = new Local(this);
 0294            BaseUri = new System.Uri("https://api.cognitive.microsoft.com/localbusinesses/v7.0/search");
 0295            SerializationSettings = new JsonSerializerSettings
 0296            {
 0297                Formatting = Newtonsoft.Json.Formatting.Indented,
 0298                DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
 0299                DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
 0300                NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
 0301                ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
 0302                ContractResolver = new ReadOnlyJsonContractResolver(),
 0303                Converters = new  List<JsonConverter>
 0304                    {
 0305                        new Iso8601TimeSpanConverter()
 0306                    }
 0307            };
 0308            DeserializationSettings = new JsonSerializerSettings
 0309            {
 0310                DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
 0311                DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
 0312                NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
 0313                ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
 0314                ContractResolver = new ReadOnlyJsonContractResolver(),
 0315                Converters = new List<JsonConverter>
 0316                    {
 0317                        new Iso8601TimeSpanConverter()
 0318                    }
 0319            };
 0320            SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<QueryContext>("_type"));
 0321            DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter<QueryContext>("_type"));
 0322            SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<EntitiesEntityPresentationInfo>("
 0323            DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter<EntitiesEntityPresentationIn
 0324            SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<GeoCoordinates>("_type"));
 0325            DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter<GeoCoordinates>("_type"));
 0326            SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<Error>("_type"));
 0327            DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter<Error>("_type"));
 0328            SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<ResponseBase>("_type"));
 0329            DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter<ResponseBase>("_type"));
 330            CustomInitialize();
 0331        }
 332    }
 333}