Used to create an OAuth aware HTTP client.
Inheritance: Flurl.Http.Configuration.DefaultHttpClientFactory
Esempio n. 1
0
 /// <summary>
 ///     Constructor.
 /// </summary>
 /// <param name="authUrl">The base auth URL (scheme and host) for the service.</param>
 /// <param name="apiUrl">The base API URL (scheme and host) for the service.</param>
 /// <param name="existingState">Any existing state from a previous session.</param>
 /// <param name="handlerFactory">A delegate to create the http handler factory.</param>
 public AltitudeAngelClient(
     string authUrl,
     string apiUrl,
     IAuthorizationState existingState,
     Func <string, IAuthorizationState, AltitudeAngelHttpHandlerFactory> handlerFactory)
 {
     _authUrl        = authUrl;
     _apiUrl         = apiUrl;
     _handlerFactory = handlerFactory(authUrl, existingState);
     _client         = new FlurlClient
     {
         Settings =
         {
             HttpClientFactory = _handlerFactory
         }
     };
 }
        /// <summary>
        ///     Constructor.
        /// </summary>
        /// <param name="authUrl">The base auth URL (scheme and host) for the service.</param>
        /// <param name="apiUrl">The base API URL (scheme and host) for the service.</param>
        /// <param name="existingState">Any existing state from a previous session.</param>
        /// <param name="handlerFactory">A delegate to create the http handler factory.</param>
        public AltitudeAngelClient(
            string authUrl,
            string apiUrl,
            AuthorizationState existingState,
            AltitudeAngelHttpHandlerFactory.Create handlerFactory
            )
        {
            _authUrl = authUrl;
            _apiUrl = apiUrl;
            _handlerFactory = handlerFactory(authUrl, existingState);
            _client = new FlurlClient
            {
                Settings =
                {
                    HttpClientFactory = _handlerFactory
                },
                AutoDispose = false
            };

            _disposer.Add(_client);
        }