private async Task <string> GetRequest(string path, Dictionary <string, string> paramaters = null) { var baseUrl = "https://api.mybitx.com/api/1"; if (paramaters != null) { var queryString = QueryStringBuilder.BuildQueryString(paramaters); baseUrl = $"{baseUrl}/{path}?{queryString}"; } else { baseUrl = $"{baseUrl}/{path}"; } using (var client = new WebClient()) { var result = await client.DownloadStringTaskAsync(baseUrl); return(result); } }
private async Task <string> GetSecureRequest(string path, Dictionary <string, string> paramaters = null) { var baseUrl = "https://api.mybitx.com/api/1"; if (paramaters != null) { var queryString = QueryStringBuilder.BuildQueryString(paramaters); baseUrl = $"{baseUrl}/{path}?{queryString}"; } else { baseUrl = $"{baseUrl}/{path}"; } using (var client = new WebClient()) { client.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes($"{_publicKey}:{_privateKey}"))); var result = await client.DownloadStringTaskAsync(baseUrl); return(result); } }