< Summary

Class:Microsoft.Azure.CognitiveServices.Search.ImageSearch.ImageSearchClient
Assembly:Microsoft.Azure.CognitiveServices.Search.BingImageSearch
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingImageSearch\src\Generated\ImageSearch\ImageSearchClient.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.BingImageSearch\src\Generated\ImageSearch\ImageSearchClient.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.ImageSearch
 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 Image Search API lets you send a search query to Bing and get back
 20    /// a list of relevant images. This section provides technical details
 21    /// about the query parameters and headers that you use to request images
 22    /// and the JSON response objects that contain them. For examples that show
 23    /// how to make requests, see [Searching the Web for
 24    /// Images](https://docs.microsoft.com/azure/cognitive-services/bing-image-search/search-the-web).
 25    /// </summary>
 26    public partial class ImageSearchClient : ServiceClient<ImageSearchClient>, IImageSearchClient
 27    {
 28        /// <summary>
 29        /// The base URI of the service.
 30        /// </summary>
 1231        internal string BaseUri {get; set;}
 32
 33        /// <summary>
 34        /// Gets or sets json serialization settings.
 35        /// </summary>
 1836        public JsonSerializerSettings SerializationSettings { get; private set; }
 37
 38        /// <summary>
 39        /// Gets or sets json deserialization settings.
 40        /// </summary>
 2441        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>
 1848        public string Endpoint { get; set; }
 49
 50        /// <summary>
 51        /// Subscription credentials which uniquely identify client subscription.
 52        /// </summary>
 3053        public ServiceClientCredentials Credentials { get; private set; }
 54
 55        /// <summary>
 56        /// Gets the IImagesOperations.
 57        /// </summary>
 1258        public virtual IImagesOperations Images { get; private set; }
 59
 60        /// <summary>
 61        /// Initializes a new instance of the ImageSearchClient 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 ImageSearchClient.Dispose(). False: will not dispose p
 068        protected ImageSearchClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient)
 69        {
 070            Initialize();
 071        }
 72
 73        /// <summary>
 74        /// Initializes a new instance of the ImageSearchClient class.
 75        /// </summary>
 76        /// <param name='handlers'>
 77        /// Optional. The delegating handlers to add to the http client pipeline.
 78        /// </param>
 679        protected ImageSearchClient(params DelegatingHandler[] handlers) : base(handlers)
 80        {
 681            Initialize();
 682        }
 83
 84        /// <summary>
 85        /// Initializes a new instance of the ImageSearchClient 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 ImageSearchClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandl
 94        {
 095            Initialize();
 096        }
 97
 98        /// <summary>
 99        /// Initializes a new instance of the ImageSearchClient 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>
 6110        public ImageSearchClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handl
 111        {
 6112            if (credentials == null)
 113            {
 0114                throw new System.ArgumentNullException("credentials");
 115            }
 6116            Credentials = credentials;
 6117            if (Credentials != null)
 118            {
 6119                Credentials.InitializeServiceClient(this);
 120            }
 6121        }
 122
 123        /// <summary>
 124        /// Initializes a new instance of the ImageSearchClient 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 ImageSearchClient.Dispose(). False: will not dispose p
 134        /// <exception cref="System.ArgumentNullException">
 135        /// Thrown when a required parameter is null
 136        /// </exception>
 0137        public ImageSearchClient(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 ImageSearchClient 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 ImageSearchClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingH
 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        {
 6187            Images = new ImagesOperations(this);
 6188            BaseUri = "{Endpoint}/bing/v7.0";
 6189            Endpoint = "https://api.cognitive.microsoft.com";
 6190            SerializationSettings = new JsonSerializerSettings
 6191            {
 6192                Formatting = Newtonsoft.Json.Formatting.Indented,
 6193                DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
 6194                DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
 6195                NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
 6196                ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
 6197                ContractResolver = new ReadOnlyJsonContractResolver(),
 6198                Converters = new  List<JsonConverter>
 6199                    {
 6200                        new Iso8601TimeSpanConverter()
 6201                    }
 6202            };
 6203            DeserializationSettings = new JsonSerializerSettings
 6204            {
 6205                DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
 6206                DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
 6207                NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
 6208                ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
 6209                ContractResolver = new ReadOnlyJsonContractResolver(),
 6210                Converters = new List<JsonConverter>
 6211                    {
 6212                        new Iso8601TimeSpanConverter()
 6213                    }
 6214            };
 6215            SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<PropertiesItem>("_type"));
 6216            DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter<PropertiesItem>("_type"));
 6217            SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<ResponseBase>("_type"));
 6218            DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter<ResponseBase>("_type"));
 219            CustomInitialize();
 6220        }
 221    }
 222}