mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-26 18:34:31 +01:00
Remove ctor in LndSwaggerClient
This commit is contained in:
@@ -16,19 +16,7 @@ namespace BTCPayServer.Payments.Lightning.Lnd
|
||||
private System.Lazy<Newtonsoft.Json.JsonSerializerSettings> _settings;
|
||||
private string _baseUrl = "";
|
||||
|
||||
private System.Net.Http.HttpClient _httpClient;
|
||||
|
||||
public LndSwaggerClient(string baseUrl, System.Net.Http.HttpClient httpClient)
|
||||
{
|
||||
BaseUrl = baseUrl;
|
||||
_httpClient = httpClient;
|
||||
_settings = new System.Lazy<Newtonsoft.Json.JsonSerializerSettings>(() =>
|
||||
{
|
||||
var settings = new Newtonsoft.Json.JsonSerializerSettings();
|
||||
UpdateJsonSerializerSettings(settings);
|
||||
return settings;
|
||||
});
|
||||
}
|
||||
private System.Net.Http.HttpClient _httpClient;
|
||||
|
||||
public string BaseUrl
|
||||
{
|
||||
|
||||
@@ -19,12 +19,21 @@ namespace BTCPayServer.Payments.Lightning.Lnd
|
||||
public partial class LndSwaggerClient
|
||||
{
|
||||
public LndSwaggerClient(LndRestSettings settings)
|
||||
: this(settings.Uri.AbsoluteUri.TrimEnd('/'), CreateHttpClient(settings))
|
||||
{
|
||||
_Settings = settings;
|
||||
if (settings == null)
|
||||
throw new ArgumentNullException(nameof(settings));
|
||||
_LndSettings = settings;
|
||||
_Authentication = settings.CreateLndAuthentication();
|
||||
BaseUrl = settings.Uri.AbsoluteUri.TrimEnd('/');
|
||||
_httpClient = CreateHttpClient(settings);
|
||||
_settings = new System.Lazy<Newtonsoft.Json.JsonSerializerSettings>(() =>
|
||||
{
|
||||
var json = new Newtonsoft.Json.JsonSerializerSettings();
|
||||
UpdateJsonSerializerSettings(json);
|
||||
return json;
|
||||
});
|
||||
}
|
||||
LndRestSettings _Settings;
|
||||
LndRestSettings _LndSettings;
|
||||
LndAuthentication _Authentication;
|
||||
|
||||
partial void PrepareRequest(HttpClient client, HttpRequestMessage request, string url)
|
||||
@@ -64,7 +73,7 @@ namespace BTCPayServer.Payments.Lightning.Lnd
|
||||
|
||||
internal HttpClient CreateHttpClient()
|
||||
{
|
||||
return LndSwaggerClient.CreateHttpClient(_Settings);
|
||||
return LndSwaggerClient.CreateHttpClient(_LndSettings);
|
||||
}
|
||||
|
||||
internal T Deserialize<T>(string str)
|
||||
|
||||
Reference in New Issue
Block a user