コード例 #1
0
 public StoreGlobalXApiTokenCommandHandler(
     IGlobalXApiTokenRepository globalXApiTokenRepository,
     Validator validator)
 {
     _globalXApiTokenRepository = globalXApiTokenRepository;
     _validator = validator ?? throw new ArgumentNullException(nameof(validator));
 }
コード例 #2
0
 public GlobalXApiTokenLockInfo(string userId, Instant expiresAt, IGlobalXApiTokenRepository globalXApiTokenRepository, Guid lockId)
 {
     UserId    = userId;
     ExpiresAt = expiresAt;
     LockId    = lockId;
     _globalXApiTokenRepository = globalXApiTokenRepository;
 }
コード例 #3
0
 public GlobalXApiTokenQueryHandler(
     IGlobalXApiTokenRepository globalXApiTokenRepository,
     Validator validator)
 {
     _globalXApiTokenRepository = globalXApiTokenRepository ?? throw new System.ArgumentNullException(nameof(globalXApiTokenRepository));
     _validator = validator ?? throw new System.ArgumentNullException(nameof(validator));
 }
コード例 #4
0
 public RefreshGlobalXApiTokenTimerJob(
     IGlobalXService globalXService,
     IGlobalXApiTokenRepository globalXApiTokenRepository,
     IClock clock,
     ILogger <RefreshGlobalXApiTokenTimerJob> logger)
 {
     _globalXService            = globalXService ?? throw new ArgumentNullException(nameof(globalXService));
     _globalXApiTokenRepository = globalXApiTokenRepository ?? throw new ArgumentNullException(nameof(globalXApiTokenRepository));
     _clock  = clock ?? throw new ArgumentNullException(nameof(clock));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
コード例 #5
0
        public GlobalXApiTokenLockInfo(string userId, Instant expiresAt, IGlobalXApiTokenRepository globalXApiTokenRepository)
        {
            if (string.IsNullOrEmpty(userId))
            {
                throw new ArgumentException("Must be supplied", nameof(userId));
            }

            _globalXApiTokenRepository = globalXApiTokenRepository ?? throw new ArgumentNullException(nameof(globalXApiTokenRepository));
            UserId    = userId;
            ExpiresAt = expiresAt;
            LockId    = Guid.NewGuid();
        }
コード例 #6
0
ファイル: GlobalXService.cs プロジェクト: vhurryharry/Konekta
        public GlobalXService(
            ILogger <GlobalXService> logger,
            IClock clock,
            HttpClient httpClient,
            IGlobalXApiTokenRepository globalXApiTokenRepository,
            IGlobalXCredentialsRepository globalXCredentialsRepository,
            IOptionsSnapshot <GlobalXOptions> globalXOptionsSnapshot)
        {
            if (globalXOptionsSnapshot is null)
            {
                throw new ArgumentNullException(nameof(globalXOptionsSnapshot));
            }

            _logger      = logger;
            _httpClient  = httpClient;
            _flurlClient = new FlurlClient(_httpClient);
            _clock       = clock;
            _globalXApiTokenRepository    = globalXApiTokenRepository;
            _globalXCredentialsRepository = globalXCredentialsRepository;

            GlobalXEnvironment = globalXOptionsSnapshot.Value.Environment;

            _clientId = globalXOptionsSnapshot.Value.ClientId;
            if (string.IsNullOrEmpty(_clientId))
            {
                throw new ArgumentException($"Option {nameof(globalXOptionsSnapshot.Value.ClientId)} must be set.", nameof(globalXOptionsSnapshot));
            }

            _clientSecret = globalXOptionsSnapshot.Value.ClientSecret;
            if (string.IsNullOrEmpty(_clientSecret))
            {
                throw new ArgumentException($"Option {nameof(globalXOptionsSnapshot.Value.ClientSecret)} must be set.", nameof(globalXOptionsSnapshot));
            }

            _apiKey = globalXOptionsSnapshot.Value.ApiKey;
            if (string.IsNullOrEmpty(_apiKey))
            {
                throw new ArgumentException($"Option {nameof(globalXOptionsSnapshot.Value.ApiKey)} must be set.", nameof(globalXOptionsSnapshot));
            }
        }