Example #1
0
 public AuthorizationApiClient(
     IRevolutApiClient client,
     IRevolutApiSettings revolutApiSettings)
 {
     apiClient = client;
     this.revolutApiSettings = revolutApiSettings;
 }
Example #2
0
 /// <summary>
 ///     Create an instance of RevolutApiClient
 /// </summary>
 /// <param name="settings">Settings of the revolut account</param>
 /// <param name="httpClient">
 ///     Provides a base class for sending HTTP requests and receiving HTTP responses from a resource
 ///     identified by a URI.
 /// </param>
 /// <param name="memoryCache">
 ///     Represents the type that implements an in-memory cache. Mainly used to access to the token
 ///     database
 /// </param>
 /// <param name="logger">logger</param>
 public RevolutApiClient(
     IRevolutApiSettings settings,
     HttpClient httpClient    = null,
     IMemoryCache memoryCache = null,
     ILogger logger           = null)
     : this(settings, null, httpClient, memoryCache, logger)
 {
 }
Example #3
0
 /// <summary>
 ///     Create an instance of RevolutApiClient
 /// </summary>
 /// <param name="settings">Settings of the revolut account</param>
 /// <param name="accessToken">token of the current connection</param>
 /// <param name="httpClient">
 ///     Provides a base class for sending HTTP requests and receiving HTTP responses from a resource
 ///     identified by a URI.
 /// </param>
 /// <param name="memoryCache">
 ///     Represents the type that implements an in-memory cache. Mainly used to access to the token
 ///     database
 /// </param>
 /// <param name="logger">logger</param>
 public RevolutApiClient(IRevolutApiSettings settings,
                         string accessToken,
                         HttpClient httpClient    = null,
                         IMemoryCache memoryCache = null,
                         ILogger logger           = null)
 {
     this.memoryCache       = memoryCache ?? new MemoryCache(new MemoryCacheOptions());
     tokenFactory           = new TokenFactory(new AuthorizationApiClient(this, settings), this.memoryCache);
     this.httpClient        = httpClient ?? new HttpClient();
     this.logger            = logger ?? LogManager.GetCurrentClassLogger();
     this.accessToken       = accessToken;
     this.settings          = settings;
     jsonSerializerSettings = new JsonSerializerSettings
     {
         ContractResolver = new DefaultContractResolver {
             NamingStrategy = new SnakeCaseNamingStrategy()
         },
         DateFormatString = "yyyy-MM-dd"
     };
     isHttpClientDisposable  = httpClient == null;
     isMemoryCacheDisposable = memoryCache == null;
 }