From 9488813294cd41e5d482fab4f56e8610431d10c6 Mon Sep 17 00:00:00 2001 From: Joe Pill Date: Mon, 22 Jul 2024 14:53:33 -0500 Subject: [PATCH 1/2] feat: modify request --- ShipEngineSDK/ShipEngine.cs | 11 +++++++++++ ShipEngineSDK/ShipEngineClient.cs | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/ShipEngineSDK/ShipEngine.cs b/ShipEngineSDK/ShipEngine.cs index f08206e7..13dc1e37 100644 --- a/ShipEngineSDK/ShipEngine.cs +++ b/ShipEngineSDK/ShipEngine.cs @@ -225,6 +225,17 @@ public ShipEngine(HttpClient httpClient) : base() _client = httpClient; } + /// + /// Modifies the request before it is sent to the ShipEngine API + /// + /// + /// + public ShipEngine ModifyRequest(Action modifyRequest) + { + base.ModifyRequest = modifyRequest; + return this; + } + /// /// Dispose of the ShipEngine client /// diff --git a/ShipEngineSDK/ShipEngineClient.cs b/ShipEngineSDK/ShipEngineClient.cs index 2e6b1201..5e7aa861 100644 --- a/ShipEngineSDK/ShipEngineClient.cs +++ b/ShipEngineSDK/ShipEngineClient.cs @@ -45,6 +45,11 @@ public class ShipEngineClient /// public CancellationToken CancellationToken { get; set; } + /// + /// Modifies the client request before it is sent + /// + public Action? ModifyRequest { get; set; } + /// /// Sets the HttpClient User agent, the json media type, and the API key to be used /// for all ShipEngine API calls unless overrwritten at the method level. @@ -199,6 +204,7 @@ public virtual async Task SendHttpRequestAsync(HttpMethod method, string p try { var request = BuildRequest(method, path, jsonContent); + ModifyRequest?.Invoke(request); response = await client.SendAsync(request, cancellationToken); var deserializedResult = await DeserializedResultOrThrow(response); From 1add9e5447bbd518dd23de7dedf9d49f85436e34 Mon Sep 17 00:00:00 2001 From: Joe Pill Date: Thu, 1 Aug 2024 10:23:07 -0500 Subject: [PATCH 2/2] bump version # --- CHANGELOG.md | 8 +++++++- ShipEngineSDK/ShipEngineSDK.csproj | 2 +- package.json | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 364d3c8e..c8ffe9ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -157,4 +157,10 @@ Updated nuget package dependencies ## Changed - Move the enums back to the root ShipEngineSDK namespace -- Remove the autogenerated models and methods \ No newline at end of file +- Remove the autogenerated models and methods + +## 2.2.1 + +### Added + +- Added basic ability to modify the HttpClient in a request \ No newline at end of file diff --git a/ShipEngineSDK/ShipEngineSDK.csproj b/ShipEngineSDK/ShipEngineSDK.csproj index 080b2741..81b539b9 100644 --- a/ShipEngineSDK/ShipEngineSDK.csproj +++ b/ShipEngineSDK/ShipEngineSDK.csproj @@ -4,7 +4,7 @@ ShipEngine sdk;rest;api;shipping;rates;label;tracking;cost;address;validation;normalization;fedex;ups;usps; - 2.2.0 + 2.2.1 ShipEngine ShipEngine The official ShipEngine C# SDK for .NET diff --git a/package.json b/package.json index 2975d10c..2239a9bb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "shipengine-dotnet", - "version": "2.2.0", + "version": "2.2.1", "description": "Package primarily used to generate the API and models from OpenApi spec\"", "main": "index.js", "directories": {