예제 #1
0
        /// <summary>
        /// Constructor, requires an ITHHttpClient object and an ITHClientConfiguration object.
        /// </summary>
        /// <param name="thHttpClient">An ITHHttpClient object</param>
        /// <param name="thClientConfiguration">An ITHClientConfiguration object</param>
        public THApiClient(ITHHttpClient thHttpClient, ITHClientConfiguration thClientConfiguration)
        {
            this.thHttpClient = thHttpClient;
            client            = new HttpClient();

            // Force the HTTP client to use TLS 1.2
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            // Set base URL
            client.BaseAddress = new Uri(thClientConfiguration.BaseUri);
            // Set subscription key header
            client.DefaultRequestHeaders.Add(thClientConfiguration.SubscriptionHeader,
                                             thClientConfiguration.SubscriptionKey);
        }
예제 #2
0
 /// <summary>
 /// Constructor, requires an ITHClientConfiguration object.
 /// </summary>
 /// <param name="thClientConfiguration">An ITHClientConfiguration object</param>
 public XprTrueHoleClient(ITHClientConfiguration thClientConfiguration)
     : this(new THApiClient(thClientConfiguration))
 {
 }
예제 #3
0
 /// <summary>
 /// Constructor, requires an ITHClientConfiguration object.
 /// </summary>
 /// <param name="thClientConfiguration">An ITHClientConfiguration object</param>
 public THApiClient(ITHClientConfiguration thClientConfiguration)
     : this(new THHttpClient(), thClientConfiguration)
 {
 }