public BtcMarketApi(ApiSettings settings) { _settings = settings; var authHandler = new AuthenticationHandler(_settings); _client = new HttpClient(authHandler) { BaseAddress = new Uri(_settings.BaseUrl) }; }
public async Task <bool> CheckApiCredentials(string apiKey, string secret) { var settings = new ApiSettings(); settings.BaseUrl = _settings.BaseUrl; settings.ApiKey = apiKey; settings.Secret = secret; var authHandler = new AuthenticationHandler(settings); var client = new HttpClient(authHandler) { BaseAddress = new Uri(settings.BaseUrl) }; var api = RestService.For <IBtcMarketsApi>(client); var response = await GetAccountBalance(api); var isValid = response.Success.HasValue ? response.Success.Value : false; return(isValid); }