Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PlaidClient"/> class.
 /// </summary>
 /// <param name="clientId">The client identifier.</param>
 /// <param name="secret">The secret.</param>
 /// <param name="accessToken">The access token.</param>
 /// <param name="environment">The environment.</param>
 public PlaidClient(string clientId, string secret, string accessToken, Plaid.Environment environment = Plaid.Environment.Production)
 {
     _secret      = secret;
     _clientId    = clientId;
     _accessToken = accessToken;
     _environment = environment;
 }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PlaidClient" /> class.
        /// </summary>
        /// <param name="clientId">The client identifier.</param>
        /// <param name="secret">The secret.</param>
        /// <param name="accessToken">The access token.</param>
        /// <param name="environment">The environment.</param>
        /// <param name="apiVersion">The Plaid API version.</param>
        /// <param name="factory">The factory.</param>
        /// <param name="logger">The logger.</param>
        public PlaidClient(string clientId,
                           string secret,
                           string accessToken,
                           Plaid.Environment environment = Plaid.Environment.Production,
                           string apiVersion             = "2020-09-14",
                           IHttpClientFactory factory    = default,
                           ILogger logger = default)
        {
            _secret      = secret;
            _clientId    = clientId;
            _accessToken = accessToken;
            _environment = environment;
            _apiVersion  = apiVersion;
            _logger      = logger;

            _httpClientFactory = factory ?? new ServiceCollection()
                                 .AddHttpClient()
                                 .BuildServiceProvider()
                                 .GetService <IHttpClientFactory>();

            string subDomain = _environment switch
            {
                Environment.Production => "production",
                Environment.Development => "development",
                Environment.Sandbox => "sandbox",
                _ => throw new System.NotImplementedException()
            };

            _baseUrl = $"https://{subDomain}.plaid.com";
        }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PlaidClient"/> class.
 /// </summary>
 /// <param name="clientId">The client identifier.</param>
 /// <param name="secret">The secret.</param>
 /// <param name="accessToken">The access token.</param>
 /// <param name="environment">The environment.</param>
 /// <param name="apiVersion">The Plaid API version.</param>
 public PlaidClient(string clientId,
                    string secret,
                    string accessToken,
                    Plaid.Environment environment = Plaid.Environment.Production,
                    string apiVersion             = "2019-05-29")
 {
     _secret      = secret;
     _clientId    = clientId;
     _accessToken = accessToken;
     _environment = environment;
     _apiVersion  = apiVersion;
 }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PlaidClient"/> class.
 /// </summary>
 /// <param name="environment">The environment.</param>
 public PlaidClient(Plaid.Environment environment) : this(null, null, null, environment)
 {
 }