From 5309ba46c3f93f7f8c9db21f73a55341cae7dbe9 Mon Sep 17 00:00:00 2001 From: Mitchell Currey Date: Wed, 18 Jan 2023 09:47:57 +0000 Subject: [PATCH 1/3] Add support for .NET Framework 4.8 --- .../API/v1/Clients/ForburyApiClient.cs | 4 +++- .../Extensions/ModelExtractContentTypeExtensions.cs | 13 ++++++++----- .../Forbury.Integrations.csproj | 4 ++-- .../Extensions/HeaderDictionaryExtensions.cs | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Forbury.Integrations/API/v1/Clients/ForburyApiClient.cs b/src/Forbury.Integrations/API/v1/Clients/ForburyApiClient.cs index 8e1b150..a0a9b07 100644 --- a/src/Forbury.Integrations/API/v1/Clients/ForburyApiClient.cs +++ b/src/Forbury.Integrations/API/v1/Clients/ForburyApiClient.cs @@ -17,6 +17,8 @@ namespace Forbury.Integrations.API.v1.Clients { public abstract class ForburyApiClient : IForburyApiClient { + const string ApplicationJson = "application/json"; + protected readonly HttpClient _httpClient; public ForburyApiClient(HttpClient httpClient) @@ -64,7 +66,7 @@ protected async Task PostAsync(string requestUri, TR var serializedBody = JsonConvert.SerializeObject(requestBody, new JsonSerializerSettings() { ContractResolver = new CamelCasePropertyNamesContractResolver() }); HttpResponseMessage response = await _httpClient.PostAsync(requestUri, - new StringContent(serializedBody, Encoding.UTF8, MediaTypeNames.Application.Json), + new StringContent(serializedBody, Encoding.UTF8, ApplicationJson), cancellationToken); await CatchResponseFailure(response); diff --git a/src/Forbury.Integrations/API/v1/Extensions/ModelExtractContentTypeExtensions.cs b/src/Forbury.Integrations/API/v1/Extensions/ModelExtractContentTypeExtensions.cs index 2b66b49..dcd86aa 100644 --- a/src/Forbury.Integrations/API/v1/Extensions/ModelExtractContentTypeExtensions.cs +++ b/src/Forbury.Integrations/API/v1/Extensions/ModelExtractContentTypeExtensions.cs @@ -8,12 +8,15 @@ public static class ModelExtractContentTypeExtensions { public static string ToMediaType(this ModelExtractFileType contentType) { - return contentType switch + switch (contentType) { - ModelExtractFileType.Pdf => MediaTypeNames.Application.Pdf, - ModelExtractFileType.Jpeg => MediaTypeNames.Image.Jpeg, - _ => throw new NotSupportedException("Content type not supported.") - }; + case ModelExtractFileType.Pdf: + return MediaTypeNames.Application.Pdf; + case ModelExtractFileType.Jpeg: + return MediaTypeNames.Image.Jpeg; + default: + throw new NotSupportedException("Content type not supported."); + } } } } diff --git a/src/Forbury.Integrations/Forbury.Integrations.csproj b/src/Forbury.Integrations/Forbury.Integrations.csproj index f6089ac..3f0c6ea 100644 --- a/src/Forbury.Integrations/Forbury.Integrations.csproj +++ b/src/Forbury.Integrations/Forbury.Integrations.csproj @@ -1,7 +1,7 @@  - 1.5.0 + 1.6.0-beta Forbury Development Team Forbury This .NET client library provides a quick and easy option for integrating with Forbury APIs. @@ -14,7 +14,7 @@ Forbury.Integrations Forbury.Integrations - netcoreapp3.1;net5.0;net6.0 + net48;netcoreapp3.1;net5.0;net6.0 true diff --git a/src/Forbury.Integrations/Helpers/Extensions/HeaderDictionaryExtensions.cs b/src/Forbury.Integrations/Helpers/Extensions/HeaderDictionaryExtensions.cs index 579cfe6..7cde6a8 100644 --- a/src/Forbury.Integrations/Helpers/Extensions/HeaderDictionaryExtensions.cs +++ b/src/Forbury.Integrations/Helpers/Extensions/HeaderDictionaryExtensions.cs @@ -26,7 +26,7 @@ public static bool IsSignatureCompatible(this IHeaderDictionary headers, string var receivedSignature = headers[Constants.SignatureHeaderName].ToString() - .Split("="); + .Split('='); string computedSignature; switch (receivedSignature[0]) From cb4c210648edcd55c305b2ae4a735c58ac0e772b Mon Sep 17 00:00:00 2001 From: Mitchell Currey Date: Mon, 30 Jan 2023 15:45:23 +0000 Subject: [PATCH 2/3] Add Description to ModelExtractionDto --- src/Forbury.Integrations/API/v1/Dto/File/ModelExtractionDto.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Forbury.Integrations/API/v1/Dto/File/ModelExtractionDto.cs b/src/Forbury.Integrations/API/v1/Dto/File/ModelExtractionDto.cs index 2e59df9..0c6f6cf 100644 --- a/src/Forbury.Integrations/API/v1/Dto/File/ModelExtractionDto.cs +++ b/src/Forbury.Integrations/API/v1/Dto/File/ModelExtractionDto.cs @@ -7,5 +7,6 @@ public class ModelExtractionDto : FileDto public ModelExtractionType ExtractionType { get; set; } public string SheetName { get; set; } public string Name { get; set; } + public string Description { get; set; } } } From 657656e9a806b14e6fb7c46ec45cc84a32bd9b1d Mon Sep 17 00:00:00 2001 From: Mitchell Currey Date: Mon, 30 Jan 2023 15:51:59 +0000 Subject: [PATCH 3/3] Version bump --- src/Forbury.Integrations/Forbury.Integrations.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Forbury.Integrations/Forbury.Integrations.csproj b/src/Forbury.Integrations/Forbury.Integrations.csproj index f6089ac..9354477 100644 --- a/src/Forbury.Integrations/Forbury.Integrations.csproj +++ b/src/Forbury.Integrations/Forbury.Integrations.csproj @@ -1,7 +1,7 @@  - 1.5.0 + 1.6.0 Forbury Development Team Forbury This .NET client library provides a quick and easy option for integrating with Forbury APIs.