public async ValueTask <OmniEqResponse <T> > ExecuteAsync <T>( string urlPattern, QueryStringBuilder qsb ) where T : class { ValidateAndProcessParams(ref urlPattern, ref qsb); if (!string.IsNullOrEmpty(_apiToken)) { qsb.Add("token", _apiToken); } var content = string.Empty; using var responseContent = await _exponentialBackOffPolicy.ExecuteAsync( () => _client.GetAsync($"{urlPattern}{qsb.Build()}") ).ConfigureAwait(false); try { content = await responseContent.Content.ReadAsStringAsync().ConfigureAwait(false); if (responseContent.StatusCode == HttpStatusCode.OK) { if (content.Contains("\"status\":\"error\"")) { return(content.ToErrorResponse <T>(_jsonSerializerSettings)); } else { return(content.ToSuccessfulResponse <T>(_jsonSerializerSettings)); } } else { return(content.ToErrorResponse <T>(_jsonSerializerSettings)); } } catch (JsonException ex) { throw new JsonException(content, ex); } }
public async ValueTask <OmniEqResponse <T> > SymbolExecuteAsync <T>(string urlPattern, string symbol, QueryStringBuilder qsb = null) where T : class { qsb = qsb ?? new QueryStringBuilder(); qsb.Add("symbol", symbol); return(await ExecuteAsync <T>(urlPattern, qsb).ConfigureAwait(false)); }