< Summary

Class:Microsoft.Azure.CognitiveServices.Search.EntitySearch.EntitySearchClient
Assembly:Microsoft.Azure.CognitiveServices.Search.BingEntitySearch
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingEntitySearch\src\Generated\EntitySearch\EntitySearchClient.cs
Covered lines:48
Uncovered lines:21
Coverable lines:69
Total lines:223
Line coverage:69.5% (48 of 69)
Covered branches:3
Total branches:12
Branch coverage:25% (3 of 12)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_BaseUri()-100%100%
get_SerializationSettings()-100%100%
get_DeserializationSettings()-100%100%
get_Endpoint()-100%100%
get_Credentials()-100%100%
get_Entities()-100%100%
.ctor(...)-0%100%
.ctor(...)-100%100%
.ctor(...)-0%100%
.ctor(...)-85.71%75%
.ctor(...)-0%0%
.ctor(...)-0%0%
Initialize()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingEntitySearch\src\Generated\EntitySearch\EntitySearchClient.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.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>
 432        internal string BaseUri {get; set;}
 33
 34        /// <summary>
 35        /// Gets or sets json serialization settings.
 36        /// </summary>
 637        public JsonSerializerSettings SerializationSettings { get; private set; }
 38
 39        /// <summary>
 40        /// Gets or sets json deserialization settings.
 41        /// </summary>
 842        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>
 649        public string Endpoint { get; set; }
 50
 51        /// <summary>
 52        /// Subscription credentials which uniquely identify client subscription.
 53        /// </summary>
 1054        public ServiceClientCredentials Credentials { get; private set; }
 55
 56        /// <summary>
 57        /// Gets the IEntitiesOperations.
 58        /// </summary>
 459        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 
 069        protected EntitySearchClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient
 70        {
 071            Initialize();
 072        }
 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>
 280        protected EntitySearchClient(params DelegatingHandler[] handlers) : base(handlers)
 81        {
 282            Initialize();
 283        }
 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>
 094        protected EntitySearchClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHand
 95        {
 096            Initialize();
 097        }
 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>
 2111        public EntitySearchClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(hand
 112        {
 2113            if (credentials == null)
 114            {
 0115                throw new System.ArgumentNullException("credentials");
 116            }
 2117            Credentials = credentials;
 2118            if (Credentials != null)
 119            {
 2120                Credentials.InitializeServiceClient(this);
 121            }
 2122        }
 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>
 0138        public EntitySearchClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) :
 139        {
 0140            if (credentials == null)
 141            {
 0142                throw new System.ArgumentNullException("credentials");
 143            }
 0144            Credentials = credentials;
 0145            if (Credentials != null)
 146            {
 0147                Credentials.InitializeServiceClient(this);
 148            }
 0149        }
 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>
 0166        public EntitySearchClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params Delegating
 167        {
 0168            if (credentials == null)
 169            {
 0170                throw new System.ArgumentNullException("credentials");
 171            }
 0172            Credentials = credentials;
 0173            if (Credentials != null)
 174            {
 0175                Credentials.InitializeServiceClient(this);
 176            }
 0177        }
 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        {
 2188            Entities = new EntitiesOperations(this);
 2189            BaseUri = "{Endpoint}/bing/v7.0";
 2190            Endpoint = "https://api.cognitive.microsoft.com";
 2191            SerializationSettings = new JsonSerializerSettings
 2192            {
 2193                Formatting = Newtonsoft.Json.Formatting.Indented,
 2194                DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
 2195                DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
 2196                NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
 2197                ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
 2198                ContractResolver = new ReadOnlyJsonContractResolver(),
 2199                Converters = new  List<JsonConverter>
 2200                    {
 2201                        new Iso8601TimeSpanConverter()
 2202                    }
 2203            };
 2204            DeserializationSettings = new JsonSerializerSettings
 2205            {
 2206                DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
 2207                DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
 2208                NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
 2209                ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
 2210                ContractResolver = new ReadOnlyJsonContractResolver(),
 2211                Converters = new List<JsonConverter>
 2212                    {
 2213                        new Iso8601TimeSpanConverter()
 2214                    }
 2215            };
 2216            SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<ContractualRulesContractualRule>(
 2217            DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter<ContractualRulesContractualR
 2218            SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<ResponseBase>("_type"));
 2219            DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter<ResponseBase>("_type"));
 220            CustomInitialize();
 2221        }
 222    }
 223}