public SimaLandService(
     IOptions <SimaLandClientConfiguration> options,
     SimaLandApiClient apiClient,
     IMemoryCache memoryCache,
     HttpClient httpClient)
 {
     _configuration = options.Value;
     _apiClient     = apiClient;
     _memoryCache   = memoryCache;
     _httpClient    = httpClient;
 }
Beispiel #2
0
        public async Task SetupAsync()
        {
            var httpClient = new HttpClient();

            _client = new SimaLandApiClient(httpClient);

            _email = Environment.GetEnvironmentVariable(EmailEnvironmentVariableName)
                     ?? throw EnvironmentVariableException(EmailEnvironmentVariableName);

            _password = Environment.GetEnvironmentVariable(PasswordEnvironmentVariableName)
                        ?? throw EnvironmentVariableException(PasswordEnvironmentVariableName);

            string token = await _client.GetAccessTokenAsync(_email, _password);

            _client.SetAccessToken(token);