public HttpRpcClient(string hostname, HttpRpcClientOptions?httpRpcClientOptions = null, Action <HttpClient, HttpClientHandler>?implementationAction = null) { if (string.IsNullOrWhiteSpace(hostname)) { throw new ArgumentException("Invalid host to connect.", nameof(hostname)); } if (!hostname.StartsWith("http://", StringComparison.OrdinalIgnoreCase) && !hostname.StartsWith("https://", StringComparison.OrdinalIgnoreCase)) { hostname = $"http://{hostname}"; } if (!hostname.EndsWith("/")) { hostname = $"{hostname}/"; } _httpRpcClientOptions = httpRpcClientOptions ?? new HttpRpcClientOptions(); var httpClientHandler = new HttpClientHandler(); _httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(hostname) }; implementationAction?.Invoke(_httpClient, httpClientHandler); }
public HttpRpcClient(string host, ushort port, string username = null, string password = null, HttpRpcClientOptions httpRpcClientOptions = null, Action <HttpClient> implementationAction = null) : this($"{host}:{port}", username, password, httpRpcClientOptions, implementationAction) { }
public HttpRpcClient(string hostname, string username = null, string password = null, HttpRpcClientOptions httpRpcClientOptions = null, Action <HttpClient> implementationAction = null) : base(hostname, httpRpcClientOptions) { if (!string.IsNullOrWhiteSpace(username)) { HttpRpcClientOptions.HttpClientHandler.Credentials = new NetworkCredential(username, password ?? ""); } implementationAction?.Invoke(HttpClient); }
public WalletRpcClient(string hostname, string username = null, string password = null, HttpRpcClientOptions httpRpcClientOptions = null, Action <HttpClient> implementationAction = null) { HttpRpcClient = new HttpRpcClient(hostname, username, password, httpRpcClientOptions, implementationAction); }
public DaemonRpcClient(string host, ushort port = 31022, string username = null, string password = null, HttpRpcClientOptions httpRpcClientOptions = null, Action <HttpClient> implementationAction = null) { HttpRpcClient = new HttpRpcClient(host, port, username, password, httpRpcClientOptions, implementationAction); }