Exemple #1
0
        private T Create <T>(ISessionManager sessionManager, IApiExecutor apiExecutor = null)
        {
            if (apiExecutor == null)
            {
                var retryStrategy = new RefreshTokensRetryStrategy(sessionManager);
                apiExecutor = new RetryStrategyApiExecutor(retryStrategy);
            }

            var httpClient = HttpClientUtils.CreateClient(sessionManager.Certificate);

            return(ApiFactoryUtils.CallConstructor <T>(new object[] { sessionManager, _baseUrl, httpClient, apiExecutor }));
        }
        /// <summary>
        /// Constructs an AuthenticatorApi instance using the provided client certificate
        /// for authentication.
        /// </summary>
        /// <typeparam name="T">The type of AuthenticatorApi instance to construct.</typeparam>
        /// <param name="certificate">Client certificate used for authentication.</param>
        /// <returns>The AuthenticatorApi instance.</returns>
        private T Create <T>(X509Certificate2 certificate)
        {
            var httpClient = HttpClientUtils.CreateClient(certificate);

            return(ApiFactoryUtils.CallConstructor <T>(new object[] { _baseUrl, httpClient }));
        }