|   |  | 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 |  |  | 
|   |  | 7 |  | namespace 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> | 
|   | 4 | 28 |  |         internal string BaseUri {get; set;} | 
|   |  | 29 |  |  | 
|   |  | 30 |  |         /// <summary> | 
|   |  | 31 |  |         /// Gets or sets json serialization settings. | 
|   |  | 32 |  |         /// </summary> | 
|   | 4 | 33 |  |         public JsonSerializerSettings SerializationSettings { get; private set; } | 
|   |  | 34 |  |  | 
|   |  | 35 |  |         /// <summary> | 
|   |  | 36 |  |         /// Gets or sets json deserialization settings. | 
|   |  | 37 |  |         /// </summary> | 
|   | 6 | 38 |  |         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> | 
|   | 6 | 45 |  |         public string Endpoint { get; set; } | 
|   |  | 46 |  |  | 
|   |  | 47 |  |         /// <summary> | 
|   |  | 48 |  |         /// Subscription credentials which uniquely identify client subscription. | 
|   |  | 49 |  |         /// </summary> | 
|   | 10 | 50 |  |         public ServiceClientCredentials Credentials { get; private set; } | 
|   |  | 51 |  |  | 
|   |  | 52 |  |         /// <summary> | 
|   |  | 53 |  |         /// Gets the ICustomInstance. | 
|   |  | 54 |  |         /// </summary> | 
|   | 4 | 55 |  |         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 | 
|   | 0 | 65 |  |         protected CustomImageSearchClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpC | 
|   |  | 66 |  |         { | 
|   | 0 | 67 |  |             Initialize(); | 
|   | 0 | 68 |  |         } | 
|   |  | 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> | 
|   | 2 | 76 |  |         protected CustomImageSearchClient(params DelegatingHandler[] handlers) : base(handlers) | 
|   |  | 77 |  |         { | 
|   | 2 | 78 |  |             Initialize(); | 
|   | 2 | 79 |  |         } | 
|   |  | 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> | 
|   | 0 | 90 |  |         protected CustomImageSearchClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(roo | 
|   |  | 91 |  |         { | 
|   | 0 | 92 |  |             Initialize(); | 
|   | 0 | 93 |  |         } | 
|   |  | 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> | 
|   | 2 | 107 |  |         public CustomImageSearchClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this | 
|   |  | 108 |  |         { | 
|   | 2 | 109 |  |             if (credentials == null) | 
|   |  | 110 |  |             { | 
|   | 0 | 111 |  |                 throw new System.ArgumentNullException("credentials"); | 
|   |  | 112 |  |             } | 
|   | 2 | 113 |  |             Credentials = credentials; | 
|   | 2 | 114 |  |             if (Credentials != null) | 
|   |  | 115 |  |             { | 
|   | 2 | 116 |  |                 Credentials.InitializeServiceClient(this); | 
|   |  | 117 |  |             } | 
|   | 2 | 118 |  |         } | 
|   |  | 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> | 
|   | 0 | 134 |  |         public CustomImageSearchClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClie | 
|   |  | 135 |  |         { | 
|   | 0 | 136 |  |             if (credentials == null) | 
|   |  | 137 |  |             { | 
|   | 0 | 138 |  |                 throw new System.ArgumentNullException("credentials"); | 
|   |  | 139 |  |             } | 
|   | 0 | 140 |  |             Credentials = credentials; | 
|   | 0 | 141 |  |             if (Credentials != null) | 
|   |  | 142 |  |             { | 
|   | 0 | 143 |  |                 Credentials.InitializeServiceClient(this); | 
|   |  | 144 |  |             } | 
|   | 0 | 145 |  |         } | 
|   |  | 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> | 
|   | 0 | 162 |  |         public CustomImageSearchClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params Deleg | 
|   |  | 163 |  |         { | 
|   | 0 | 164 |  |             if (credentials == null) | 
|   |  | 165 |  |             { | 
|   | 0 | 166 |  |                 throw new System.ArgumentNullException("credentials"); | 
|   |  | 167 |  |             } | 
|   | 0 | 168 |  |             Credentials = credentials; | 
|   | 0 | 169 |  |             if (Credentials != null) | 
|   |  | 170 |  |             { | 
|   | 0 | 171 |  |                 Credentials.InitializeServiceClient(this); | 
|   |  | 172 |  |             } | 
|   | 0 | 173 |  |         } | 
|   |  | 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 |  |         { | 
|   | 2 | 184 |  |             CustomInstance = new CustomInstance(this); | 
|   | 2 | 185 |  |             BaseUri = "{Endpoint}/bingcustomsearch/v7.0"; | 
|   | 2 | 186 |  |             Endpoint = "https://api.cognitive.microsoft.com"; | 
|   | 2 | 187 |  |             SerializationSettings = new JsonSerializerSettings | 
|   | 2 | 188 |  |             { | 
|   | 2 | 189 |  |                 Formatting = Newtonsoft.Json.Formatting.Indented, | 
|   | 2 | 190 |  |                 DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, | 
|   | 2 | 191 |  |                 DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, | 
|   | 2 | 192 |  |                 NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, | 
|   | 2 | 193 |  |                 ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, | 
|   | 2 | 194 |  |                 ContractResolver = new ReadOnlyJsonContractResolver(), | 
|   | 2 | 195 |  |                 Converters = new  List<JsonConverter> | 
|   | 2 | 196 |  |                     { | 
|   | 2 | 197 |  |                         new Iso8601TimeSpanConverter() | 
|   | 2 | 198 |  |                     } | 
|   | 2 | 199 |  |             }; | 
|   | 2 | 200 |  |             DeserializationSettings = new JsonSerializerSettings | 
|   | 2 | 201 |  |             { | 
|   | 2 | 202 |  |                 DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, | 
|   | 2 | 203 |  |                 DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, | 
|   | 2 | 204 |  |                 NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, | 
|   | 2 | 205 |  |                 ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, | 
|   | 2 | 206 |  |                 ContractResolver = new ReadOnlyJsonContractResolver(), | 
|   | 2 | 207 |  |                 Converters = new List<JsonConverter> | 
|   | 2 | 208 |  |                     { | 
|   | 2 | 209 |  |                         new Iso8601TimeSpanConverter() | 
|   | 2 | 210 |  |                     } | 
|   | 2 | 211 |  |             }; | 
|   | 2 | 212 |  |             SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<ResponseBase>("_type")); | 
|   | 2 | 213 |  |             DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter<ResponseBase>("_type")); | 
|   |  | 214 |  |             CustomInitialize(); | 
|   | 2 | 215 |  |         } | 
|   |  | 216 |  |     } | 
|   |  | 217 |  | } |