From 877a026300fcb9caa83c0f1c86cd18f25eb1a0cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Furkan=20Ayd=C4=B1n?= Date: Tue, 23 Aug 2022 15:56:39 +0300 Subject: [PATCH 1/2] RestSharp updated from 106.11.7 to 108.0.1 --- CosmosSharp/CosmosSharp.csproj | 2 +- CosmosSharp/HttpHandler.cs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CosmosSharp/CosmosSharp.csproj b/CosmosSharp/CosmosSharp.csproj index c0d28ff..228642a 100644 --- a/CosmosSharp/CosmosSharp.csproj +++ b/CosmosSharp/CosmosSharp.csproj @@ -19,7 +19,7 @@ - + diff --git a/CosmosSharp/HttpHandler.cs b/CosmosSharp/HttpHandler.cs index 9d3f6c8..9deaa25 100644 --- a/CosmosSharp/HttpHandler.cs +++ b/CosmosSharp/HttpHandler.cs @@ -15,7 +15,7 @@ async Task IHttpHandler.GetJsonAsync(string url, D { // TODO: RestClient --> HttpClient var client = new RestClient(url); - var request = new RestRequest(Method.GET); + var request = new RestRequest(); if (headerKeyValues != null && headerKeyValues.Count > 0) { foreach (var (key, value) in headerKeyValues) @@ -38,11 +38,11 @@ async Task IHttpHandler.GetJsonAsync(string url, D return result; } - Task IHttpHandler.PostJsonAsync(string url, Dictionary headerKeyValues, TRequestData requestBody) + async Task IHttpHandler.PostJsonAsync(string url, Dictionary headerKeyValues, TRequestData requestBody) { // TODO: RestClient --> HttpClient var client = new RestClient(url); - var request = new RestRequest(Method.POST); + var request = new RestRequest(); var body= JsonConvert.SerializeObject(requestBody); if (headerKeyValues != null && headerKeyValues.Count > 0) { @@ -52,7 +52,7 @@ Task IHttpHandler.PostJsonAsync(stri } } request.AddJsonBody(body); - var response = client.Execute(request); + var response = await client.ExecutePostAsync(request); if (response.StatusCode != HttpStatusCode.OK) { @@ -62,10 +62,10 @@ Task IHttpHandler.PostJsonAsync(stri if(response.Content == null) throw new Exception($"Response is null. Status code: {response.StatusCode}"); var result = JsonConvert.DeserializeObject(response.Content); - return Task.FromResult(result); + return result; } - private Exception GetApiError(Uri BaseUrl, IRestRequest request, IRestResponse response) + private Exception GetApiError(Uri BaseUrl, RestRequest request, RestResponse response) { //Get the values of the parameters passed to the API string parameters = string.Join(", ", request.Parameters.Select(x => x.Name.ToString() + "=" + ((x.Value == null) ? "NULL" : x.Value)).ToArray()); From a113f50cf06836692862b1e720672f71de1d7278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Furkan=20Ayd=C4=B1n?= Date: Tue, 23 Aug 2022 15:57:16 +0300 Subject: [PATCH 2/2] minor version update --- CosmosSharp/CosmosSharp.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CosmosSharp/CosmosSharp.csproj b/CosmosSharp/CosmosSharp.csproj index 228642a..b0af6eb 100644 --- a/CosmosSharp/CosmosSharp.csproj +++ b/CosmosSharp/CosmosSharp.csproj @@ -11,7 +11,7 @@ Copyright (c) 2021 BTCTrader BTCTrader.CosmosSharp BTCTrader.CosmosSharp - 1.1.2 + 1.1.3