< Summary

Class:Microsoft.Azure.CognitiveServices.Search.VisualSearch.VisualSearchClient
Assembly:Microsoft.Azure.CognitiveServices.Search.BingVisualSearch
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingVisualSearch\src\Generated\VisualSearchClient.cs
Covered lines:48
Uncovered lines:21
Coverable lines:69
Total lines:222
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_Images()-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.BingVisualSearch\src\Generated\VisualSearchClient.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.VisualSearch
 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    /// Visual Search API lets you discover insights about an image such as
 20    /// visually similar images, shopping sources, and related searches. The
 21    /// API can also perform text recognition, identify entities (people,
 22    /// places, things), return other topical content for the user to explore,
 23    /// and more. For more information, see [Visual Search
 24    /// Overview](https://docs.microsoft.com/azure/cognitive-services/bing-visual-search/overview).
 25    /// </summary>
 26    public partial class VisualSearchClient : ServiceClient<VisualSearchClient>, IVisualSearchClient
 27    {
 28        /// <summary>
 29        /// The base URI of the service.
 30        /// </summary>
 1631        internal string BaseUri {get; set;}
 32
 33        /// <summary>
 34        /// Gets or sets json serialization settings.
 35        /// </summary>
 2436        public JsonSerializerSettings SerializationSettings { get; private set; }
 37
 38        /// <summary>
 39        /// Gets or sets json deserialization settings.
 40        /// </summary>
 3241        public JsonSerializerSettings DeserializationSettings { get; private set; }
 42
 43        /// <summary>
 44        /// Supported Cognitive Services endpoints (protocol and hostname, for example:
 45        /// "https://westus.api.cognitive.microsoft.com",
 46        /// "https://api.cognitive.microsoft.com").
 47        /// </summary>
 2448        public string Endpoint { get; set; }
 49
 50        /// <summary>
 51        /// Subscription credentials which uniquely identify client subscription.
 52        /// </summary>
 4053        public ServiceClientCredentials Credentials { get; private set; }
 54
 55        /// <summary>
 56        /// Gets the IImages.
 57        /// </summary>
 1658        public virtual IImages Images { get; private set; }
 59
 60        /// <summary>
 61        /// Initializes a new instance of the VisualSearchClient class.
 62        /// </summary>
 63        /// <param name='httpClient'>
 64        /// HttpClient to be used
 65        /// </param>
 66        /// <param name='disposeHttpClient'>
 67        /// True: will dispose the provided httpClient on calling VisualSearchClient.Dispose(). False: will not dispose 
 068        protected VisualSearchClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient
 69        {
 070            Initialize();
 071        }
 72
 73        /// <summary>
 74        /// Initializes a new instance of the VisualSearchClient class.
 75        /// </summary>
 76        /// <param name='handlers'>
 77        /// Optional. The delegating handlers to add to the http client pipeline.
 78        /// </param>
 879        protected VisualSearchClient(params DelegatingHandler[] handlers) : base(handlers)
 80        {
 881            Initialize();
 882        }
 83
 84        /// <summary>
 85        /// Initializes a new instance of the VisualSearchClient class.
 86        /// </summary>
 87        /// <param name='rootHandler'>
 88        /// Optional. The http client handler used to handle http transport.
 89        /// </param>
 90        /// <param name='handlers'>
 91        /// Optional. The delegating handlers to add to the http client pipeline.
 92        /// </param>
 093        protected VisualSearchClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHand
 94        {
 095            Initialize();
 096        }
 97
 98        /// <summary>
 99        /// Initializes a new instance of the VisualSearchClient class.
 100        /// </summary>
 101        /// <param name='credentials'>
 102        /// Required. Subscription credentials which uniquely identify client subscription.
 103        /// </param>
 104        /// <param name='handlers'>
 105        /// Optional. The delegating handlers to add to the http client pipeline.
 106        /// </param>
 107        /// <exception cref="System.ArgumentNullException">
 108        /// Thrown when a required parameter is null
 109        /// </exception>
 8110        public VisualSearchClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(hand
 111        {
 8112            if (credentials == null)
 113            {
 0114                throw new System.ArgumentNullException("credentials");
 115            }
 8116            Credentials = credentials;
 8117            if (Credentials != null)
 118            {
 8119                Credentials.InitializeServiceClient(this);
 120            }
 8121        }
 122
 123        /// <summary>
 124        /// Initializes a new instance of the VisualSearchClient class.
 125        /// </summary>
 126        /// <param name='credentials'>
 127        /// Required. Subscription credentials which uniquely identify client subscription.
 128        /// </param>
 129        /// <param name='httpClient'>
 130        /// HttpClient to be used
 131        /// </param>
 132        /// <param name='disposeHttpClient'>
 133        /// True: will dispose the provided httpClient on calling VisualSearchClient.Dispose(). False: will not dispose 
 134        /// <exception cref="System.ArgumentNullException">
 135        /// Thrown when a required parameter is null
 136        /// </exception>
 0137        public VisualSearchClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) :
 138        {
 0139            if (credentials == null)
 140            {
 0141                throw new System.ArgumentNullException("credentials");
 142            }
 0143            Credentials = credentials;
 0144            if (Credentials != null)
 145            {
 0146                Credentials.InitializeServiceClient(this);
 147            }
 0148        }
 149
 150        /// <summary>
 151        /// Initializes a new instance of the VisualSearchClient class.
 152        /// </summary>
 153        /// <param name='credentials'>
 154        /// Required. Subscription credentials which uniquely identify client subscription.
 155        /// </param>
 156        /// <param name='rootHandler'>
 157        /// Optional. The http client handler used to handle http transport.
 158        /// </param>
 159        /// <param name='handlers'>
 160        /// Optional. The delegating handlers to add to the http client pipeline.
 161        /// </param>
 162        /// <exception cref="System.ArgumentNullException">
 163        /// Thrown when a required parameter is null
 164        /// </exception>
 0165        public VisualSearchClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params Delegating
 166        {
 0167            if (credentials == null)
 168            {
 0169                throw new System.ArgumentNullException("credentials");
 170            }
 0171            Credentials = credentials;
 0172            if (Credentials != null)
 173            {
 0174                Credentials.InitializeServiceClient(this);
 175            }
 0176        }
 177
 178        /// <summary>
 179        /// An optional partial-method to perform custom initialization.
 180        ///</summary>
 181        partial void CustomInitialize();
 182        /// <summary>
 183        /// Initializes client properties.
 184        /// </summary>
 185        private void Initialize()
 186        {
 8187            Images = new Images(this);
 8188            BaseUri = "{Endpoint}/bing/v7.0";
 8189            Endpoint = "https://api.cognitive.microsoft.com";
 8190            SerializationSettings = new JsonSerializerSettings
 8191            {
 8192                Formatting = Newtonsoft.Json.Formatting.Indented,
 8193                DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
 8194                DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
 8195                NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
 8196                ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
 8197                ContractResolver = new ReadOnlyJsonContractResolver(),
 8198                Converters = new  List<JsonConverter>
 8199                    {
 8200                        new Iso8601TimeSpanConverter()
 8201                    }
 8202            };
 8203            DeserializationSettings = new JsonSerializerSettings
 8204            {
 8205                DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
 8206                DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
 8207                NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
 8208                ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
 8209                ContractResolver = new ReadOnlyJsonContractResolver(),
 8210                Converters = new List<JsonConverter>
 8211                    {
 8212                        new Iso8601TimeSpanConverter()
 8213                    }
 8214            };
 8215            SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<ResponseBase>("_type"));
 8216            DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter<ResponseBase>("_type"));
 8217            SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<PropertiesItem>("_type"));
 8218            DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter<PropertiesItem>("_type"));
 219            CustomInitialize();
 8220        }
 221    }
 222}