< Summary

Class:Microsoft.Azure.CognitiveServices.Search.CustomImageSearch.CustomImageSearchClient
Assembly:Microsoft.Azure.CognitiveServices.Search.BingCustomImageSearch
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingCustomImageSearch\src\Generated\CustomImageSearch\CustomImageSearchClient.cs
Covered lines:46
Uncovered lines:21
Coverable lines:67
Total lines:217
Line coverage:68.6% (46 of 67)
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_CustomInstance()-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.BingCustomImageSearch\src\Generated\CustomImageSearch\CustomImageSearchClient.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.CustomImageSearch
 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 Bing Custom Image Search API lets you send an image search query to
 20    /// Bing and get back image search results customized to meet your custom
 21    /// search definition.
 22    /// </summary>
 23    public partial class CustomImageSearchClient : ServiceClient<CustomImageSearchClient>, ICustomImageSearchClient
 24    {
 25        /// <summary>
 26        /// The base URI of the service.
 27        /// </summary>
 428        internal string BaseUri {get; set;}
 29
 30        /// <summary>
 31        /// Gets or sets json serialization settings.
 32        /// </summary>
 433        public JsonSerializerSettings SerializationSettings { get; private set; }
 34
 35        /// <summary>
 36        /// Gets or sets json deserialization settings.
 37        /// </summary>
 638        public JsonSerializerSettings DeserializationSettings { get; private set; }
 39
 40        /// <summary>
 41        /// Supported Cognitive Services endpoints (protocol and hostname, for example:
 42        /// "https://westus.api.cognitive.microsoft.com",
 43        /// "https://api.cognitive.microsoft.com").
 44        /// </summary>
 645        public string Endpoint { get; set; }
 46
 47        /// <summary>
 48        /// Subscription credentials which uniquely identify client subscription.
 49        /// </summary>
 1050        public ServiceClientCredentials Credentials { get; private set; }
 51
 52        /// <summary>
 53        /// Gets the ICustomInstance.
 54        /// </summary>
 455        public virtual ICustomInstance CustomInstance { get; private set; }
 56
 57        /// <summary>
 58        /// Initializes a new instance of the CustomImageSearchClient class.
 59        /// </summary>
 60        /// <param name='httpClient'>
 61        /// HttpClient to be used
 62        /// </param>
 63        /// <param name='disposeHttpClient'>
 64        /// True: will dispose the provided httpClient on calling CustomImageSearchClient.Dispose(). False: will not dis
 065        protected CustomImageSearchClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpC
 66        {
 067            Initialize();
 068        }
 69
 70        /// <summary>
 71        /// Initializes a new instance of the CustomImageSearchClient class.
 72        /// </summary>
 73        /// <param name='handlers'>
 74        /// Optional. The delegating handlers to add to the http client pipeline.
 75        /// </param>
 276        protected CustomImageSearchClient(params DelegatingHandler[] handlers) : base(handlers)
 77        {
 278            Initialize();
 279        }
 80
 81        /// <summary>
 82        /// Initializes a new instance of the CustomImageSearchClient class.
 83        /// </summary>
 84        /// <param name='rootHandler'>
 85        /// Optional. The http client handler used to handle http transport.
 86        /// </param>
 87        /// <param name='handlers'>
 88        /// Optional. The delegating handlers to add to the http client pipeline.
 89        /// </param>
 090        protected CustomImageSearchClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(roo
 91        {
 092            Initialize();
 093        }
 94
 95        /// <summary>
 96        /// Initializes a new instance of the CustomImageSearchClient class.
 97        /// </summary>
 98        /// <param name='credentials'>
 99        /// Required. Subscription credentials which uniquely identify client subscription.
 100        /// </param>
 101        /// <param name='handlers'>
 102        /// Optional. The delegating handlers to add to the http client pipeline.
 103        /// </param>
 104        /// <exception cref="System.ArgumentNullException">
 105        /// Thrown when a required parameter is null
 106        /// </exception>
 2107        public CustomImageSearchClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this
 108        {
 2109            if (credentials == null)
 110            {
 0111                throw new System.ArgumentNullException("credentials");
 112            }
 2113            Credentials = credentials;
 2114            if (Credentials != null)
 115            {
 2116                Credentials.InitializeServiceClient(this);
 117            }
 2118        }
 119
 120        /// <summary>
 121        /// Initializes a new instance of the CustomImageSearchClient class.
 122        /// </summary>
 123        /// <param name='credentials'>
 124        /// Required. Subscription credentials which uniquely identify client subscription.
 125        /// </param>
 126        /// <param name='httpClient'>
 127        /// HttpClient to be used
 128        /// </param>
 129        /// <param name='disposeHttpClient'>
 130        /// True: will dispose the provided httpClient on calling CustomImageSearchClient.Dispose(). False: will not dis
 131        /// <exception cref="System.ArgumentNullException">
 132        /// Thrown when a required parameter is null
 133        /// </exception>
 0134        public CustomImageSearchClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClie
 135        {
 0136            if (credentials == null)
 137            {
 0138                throw new System.ArgumentNullException("credentials");
 139            }
 0140            Credentials = credentials;
 0141            if (Credentials != null)
 142            {
 0143                Credentials.InitializeServiceClient(this);
 144            }
 0145        }
 146
 147        /// <summary>
 148        /// Initializes a new instance of the CustomImageSearchClient class.
 149        /// </summary>
 150        /// <param name='credentials'>
 151        /// Required. Subscription credentials which uniquely identify client subscription.
 152        /// </param>
 153        /// <param name='rootHandler'>
 154        /// Optional. The http client handler used to handle http transport.
 155        /// </param>
 156        /// <param name='handlers'>
 157        /// Optional. The delegating handlers to add to the http client pipeline.
 158        /// </param>
 159        /// <exception cref="System.ArgumentNullException">
 160        /// Thrown when a required parameter is null
 161        /// </exception>
 0162        public CustomImageSearchClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params Deleg
 163        {
 0164            if (credentials == null)
 165            {
 0166                throw new System.ArgumentNullException("credentials");
 167            }
 0168            Credentials = credentials;
 0169            if (Credentials != null)
 170            {
 0171                Credentials.InitializeServiceClient(this);
 172            }
 0173        }
 174
 175        /// <summary>
 176        /// An optional partial-method to perform custom initialization.
 177        ///</summary>
 178        partial void CustomInitialize();
 179        /// <summary>
 180        /// Initializes client properties.
 181        /// </summary>
 182        private void Initialize()
 183        {
 2184            CustomInstance = new CustomInstance(this);
 2185            BaseUri = "{Endpoint}/bingcustomsearch/v7.0";
 2186            Endpoint = "https://api.cognitive.microsoft.com";
 2187            SerializationSettings = new JsonSerializerSettings
 2188            {
 2189                Formatting = Newtonsoft.Json.Formatting.Indented,
 2190                DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
 2191                DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
 2192                NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
 2193                ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
 2194                ContractResolver = new ReadOnlyJsonContractResolver(),
 2195                Converters = new  List<JsonConverter>
 2196                    {
 2197                        new Iso8601TimeSpanConverter()
 2198                    }
 2199            };
 2200            DeserializationSettings = new JsonSerializerSettings
 2201            {
 2202                DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
 2203                DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
 2204                NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
 2205                ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
 2206                ContractResolver = new ReadOnlyJsonContractResolver(),
 2207                Converters = new List<JsonConverter>
 2208                    {
 2209                        new Iso8601TimeSpanConverter()
 2210                    }
 2211            };
 2212            SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<ResponseBase>("_type"));
 2213            DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter<ResponseBase>("_type"));
 214            CustomInitialize();
 2215        }
 216    }
 217}