< Summary

Class:Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.QnAMakerRuntimeClient
Assembly:Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Knowledge.QnAMaker\src\Generated\QnAMakerRuntimeClient.cs
Covered lines:43
Uncovered lines:21
Coverable lines:64
Total lines:215
Line coverage:67.1% (43 of 64)
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_RuntimeEndpoint()-100%100%
get_Credentials()-100%100%
get_Runtime()-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\Knowledge.QnAMaker\src\Generated\QnAMakerRuntimeClient.cs

#LineLine coverage
 1// <auto-generated>
 2// Copyright (c) Microsoft Corporation. All rights reserved.
 3// Licensed under the MIT License. See License.txt in the project root for
 4// license information.
 5//
 6// Code generated by Microsoft (R) AutoRest Code Generator.
 7// Changes may cause incorrect behavior and will be lost if the code is
 8// regenerated.
 9// </auto-generated>
 10
 11namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker
 12{
 13    using Microsoft.Rest;
 14    using Microsoft.Rest.Serialization;
 15    using Models;
 16    using Newtonsoft.Json;
 17    using System.Collections;
 18    using System.Collections.Generic;
 19    using System.Net;
 20    using System.Net.Http;
 21
 22    /// <summary>
 23    /// An API for QnAMaker runtime
 24    /// </summary>
 25    public partial class QnAMakerRuntimeClient : ServiceClient<QnAMakerRuntimeClient>, IQnAMakerRuntimeClient
 26    {
 27        /// <summary>
 28        /// The base URI of the service.
 29        /// </summary>
 430        internal string BaseUri {get; set;}
 31
 32        /// <summary>
 33        /// Gets or sets json serialization settings.
 34        /// </summary>
 435        public JsonSerializerSettings SerializationSettings { get; private set; }
 36
 37        /// <summary>
 38        /// Gets or sets json deserialization settings.
 39        /// </summary>
 440        public JsonSerializerSettings DeserializationSettings { get; private set; }
 41
 42        /// <summary>
 43        /// QnA Maker App Service endpoint (for example:
 44        /// https://{qnaservice-hostname}.azurewebsites.net).
 45        /// </summary>
 646        public string RuntimeEndpoint { get; set; }
 47
 48        /// <summary>
 49        /// Subscription credentials which uniquely identify client subscription.
 50        /// </summary>
 1051        public ServiceClientCredentials Credentials { get; private set; }
 52
 53        /// <summary>
 54        /// Gets the IRuntime.
 55        /// </summary>
 456        public virtual IRuntime Runtime { get; private set; }
 57
 58        /// <summary>
 59        /// Initializes a new instance of the QnAMakerRuntimeClient class.
 60        /// </summary>
 61        /// <param name='httpClient'>
 62        /// HttpClient to be used
 63        /// </param>
 64        /// <param name='disposeHttpClient'>
 65        /// True: will dispose the provided httpClient on calling QnAMakerRuntimeClient.Dispose(). False: will not dispo
 066        protected QnAMakerRuntimeClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpCli
 67        {
 068            Initialize();
 069        }
 70
 71        /// <summary>
 72        /// Initializes a new instance of the QnAMakerRuntimeClient class.
 73        /// </summary>
 74        /// <param name='handlers'>
 75        /// Optional. The delegating handlers to add to the http client pipeline.
 76        /// </param>
 277        protected QnAMakerRuntimeClient(params DelegatingHandler[] handlers) : base(handlers)
 78        {
 279            Initialize();
 280        }
 81
 82        /// <summary>
 83        /// Initializes a new instance of the QnAMakerRuntimeClient class.
 84        /// </summary>
 85        /// <param name='rootHandler'>
 86        /// Optional. The http client handler used to handle http transport.
 87        /// </param>
 88        /// <param name='handlers'>
 89        /// Optional. The delegating handlers to add to the http client pipeline.
 90        /// </param>
 091        protected QnAMakerRuntimeClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootH
 92        {
 093            Initialize();
 094        }
 95
 96        /// <summary>
 97        /// Initializes a new instance of the QnAMakerRuntimeClient class.
 98        /// </summary>
 99        /// <param name='credentials'>
 100        /// Required. Subscription credentials which uniquely identify client subscription.
 101        /// </param>
 102        /// <param name='handlers'>
 103        /// Optional. The delegating handlers to add to the http client pipeline.
 104        /// </param>
 105        /// <exception cref="System.ArgumentNullException">
 106        /// Thrown when a required parameter is null
 107        /// </exception>
 2108        public QnAMakerRuntimeClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(h
 109        {
 2110            if (credentials == null)
 111            {
 0112                throw new System.ArgumentNullException("credentials");
 113            }
 2114            Credentials = credentials;
 2115            if (Credentials != null)
 116            {
 2117                Credentials.InitializeServiceClient(this);
 118            }
 2119        }
 120
 121        /// <summary>
 122        /// Initializes a new instance of the QnAMakerRuntimeClient class.
 123        /// </summary>
 124        /// <param name='credentials'>
 125        /// Required. Subscription credentials which uniquely identify client subscription.
 126        /// </param>
 127        /// <param name='httpClient'>
 128        /// HttpClient to be used
 129        /// </param>
 130        /// <param name='disposeHttpClient'>
 131        /// True: will dispose the provided httpClient on calling QnAMakerRuntimeClient.Dispose(). False: will not dispo
 132        /// <exception cref="System.ArgumentNullException">
 133        /// Thrown when a required parameter is null
 134        /// </exception>
 0135        public QnAMakerRuntimeClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient
 136        {
 0137            if (credentials == null)
 138            {
 0139                throw new System.ArgumentNullException("credentials");
 140            }
 0141            Credentials = credentials;
 0142            if (Credentials != null)
 143            {
 0144                Credentials.InitializeServiceClient(this);
 145            }
 0146        }
 147
 148        /// <summary>
 149        /// Initializes a new instance of the QnAMakerRuntimeClient class.
 150        /// </summary>
 151        /// <param name='credentials'>
 152        /// Required. Subscription credentials which uniquely identify client subscription.
 153        /// </param>
 154        /// <param name='rootHandler'>
 155        /// Optional. The http client handler used to handle http transport.
 156        /// </param>
 157        /// <param name='handlers'>
 158        /// Optional. The delegating handlers to add to the http client pipeline.
 159        /// </param>
 160        /// <exception cref="System.ArgumentNullException">
 161        /// Thrown when a required parameter is null
 162        /// </exception>
 0163        public QnAMakerRuntimeClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params Delegat
 164        {
 0165            if (credentials == null)
 166            {
 0167                throw new System.ArgumentNullException("credentials");
 168            }
 0169            Credentials = credentials;
 0170            if (Credentials != null)
 171            {
 0172                Credentials.InitializeServiceClient(this);
 173            }
 0174        }
 175
 176        /// <summary>
 177        /// An optional partial-method to perform custom initialization.
 178        ///</summary>
 179        partial void CustomInitialize();
 180        /// <summary>
 181        /// Initializes client properties.
 182        /// </summary>
 183        private void Initialize()
 184        {
 2185            Runtime = new Runtime(this);
 2186            BaseUri = "{RuntimeEndpoint}/qnamaker";
 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            };
 212            CustomInitialize();
 2213        }
 214    }
 215}