public BlockchainWalletsClient(string hostUrl, ILog log, IBlockchainWalletsApiFactory blockchainWalletsApiFactory, int retriesCount = 5) { HostUrl = hostUrl ?? throw new ArgumentNullException(nameof(hostUrl)); _log = log ?? throw new ArgumentNullException(nameof(log)); _api = blockchainWalletsApiFactory.CreateNew(hostUrl, false, null, new HttpErrorLoggingHandler(_log)); _apiRunner = new ApiRunner(retriesCount); }
public BlockchainWalletsClient(string hostUrl, ILogFactory logFactory, IBlockchainWalletsApiFactory blockchainWalletsApiFactory, int retriesCount = 5, params DelegatingHandler[] handlers) { HostUrl = hostUrl ?? throw new ArgumentNullException(nameof(hostUrl)); if (logFactory == null) { throw new ArgumentNullException(nameof(logFactory)); } _log = logFactory.CreateLog(this); List <DelegatingHandler> handlersList = new List <DelegatingHandler>(handlers?.Length ?? 0 + 1); handlersList.Add(new HttpErrorLoggingHandler(logFactory)); if (handlers?.Any() ?? false) { handlersList.AddRange(handlers); } _api = blockchainWalletsApiFactory.CreateNew(hostUrl, false, null, handlersList.ToArray()); _apiRunner = new ApiRunner(retriesCount); }