Skip to content

Commit

Permalink
Removed RestSharp dependency, as it's not used anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
oskardudycz committed Sep 2, 2024
1 parent 81b5341 commit ebb033f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
1 change: 0 additions & 1 deletion Core/Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Open.ChannelExtensions" Version="8.3.0" />
<PackageReference Include="Polly" Version="8.4.0" />
<PackageReference Include="RestSharp" Version="111.0.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.9.0" />
Expand Down
19 changes: 4 additions & 15 deletions Core/Requests/ExternalCommandBus.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Text.Json;
using RestSharp;

namespace Core.Requests;

Expand All @@ -15,31 +14,21 @@ public class ExternalCommandBus: IExternalCommandBus
public Task Post<T>(string url, string path, T command, CancellationToken cancellationToken = default) where T: notnull
{
var client = new HttpClient { BaseAddress = new Uri(url) };
// //var client = new RestClient(url);
//
// var request = new RestRequest(path, Method.Post);
// request.AddBody(command, ContentType.Json);

return client.PostAsync(path, new StringContent(JsonSerializer.Serialize(command)), cancellationToken);
}

public Task Put<T>(string url, string path, T command, CancellationToken cancellationToken = default) where T: notnull
{
var client = new RestClient(url);

var request = new RestRequest(path, Method.Put);
request.AddBody(command, ContentType.Json);
var client = new HttpClient { BaseAddress = new Uri(url) };

return client.PutAsync<dynamic>(request, cancellationToken);
return client.PutAsync(path, new StringContent(JsonSerializer.Serialize(command)), cancellationToken);
}

public Task Delete<T>(string url, string path, T command, CancellationToken cancellationToken = default) where T: notnull
{
var client = new RestClient(url);

var request = new RestRequest(path, Method.Delete);
request.AddBody(command, ContentType.Json);
var client = new HttpClient { BaseAddress = new Uri(url) };

return client.DeleteAsync<dynamic>(request, cancellationToken);
return client.DeleteAsync(path, cancellationToken);
}
}
1 change: 0 additions & 1 deletion Sample/ECommerce/Orders/Orders/Orders.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<ItemGroup>
<PackageReference Include="Npgsql.DependencyInjection" Version="8.0.3"/>
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="RestSharp" Version="111.3.0" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit ebb033f

Please sign in to comment.