From cd0d19543ad4c12990d62a76bc43cd4d0d1dfae3 Mon Sep 17 00:00:00 2001 From: Macgyver Hoferkamp Date: Mon, 23 Feb 2026 09:26:24 -0600 Subject: [PATCH 1/5] Update the ContentSerializer Settings to allow data to POST back to AutoTask API. --- AutoTask.Psa.Api/AutoTask.Psa.Api.csproj | 2 +- AutoTask.Psa.Api/AutoTaskClient.cs | 21 +++++++++------------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/AutoTask.Psa.Api/AutoTask.Psa.Api.csproj b/AutoTask.Psa.Api/AutoTask.Psa.Api.csproj index c68ffd9..cd2cc86 100644 --- a/AutoTask.Psa.Api/AutoTask.Psa.Api.csproj +++ b/AutoTask.Psa.Api/AutoTask.Psa.Api.csproj @@ -41,7 +41,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/AutoTask.Psa.Api/AutoTaskClient.cs b/AutoTask.Psa.Api/AutoTaskClient.cs index 0609062..bb31221 100644 --- a/AutoTask.Psa.Api/AutoTaskClient.cs +++ b/AutoTask.Psa.Api/AutoTaskClient.cs @@ -1,5 +1,7 @@ using Newtonsoft.Json.Linq; using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AutoTask.Psa.Api; @@ -27,18 +29,13 @@ public AutoTaskClient(HttpClient client) _httpClient = client; _refitSettings = new RefitSettings { - //ContentSerializer = new NewtonsoftJsonContentSerializer( - // new JsonSerializerSettings - // { - // // By default nulls should not be rendered out, this will allow the receiving API to apply any defaults. - // // Use [JsonProperty(NullValueHandling = NullValueHandling.Include)] to send - // // nulls for specific properties, e.g. disassociating port schedule ids from a port - // NullValueHandling = NullValueHandling.Ignore, - // #if DEBUG - // MissingMemberHandling = MissingMemberHandling.Error, - // #endif - // Converters = new List { new StringEnumConverter() } - // }) + ContentSerializer = new SystemTextJsonContentSerializer( + new JsonSerializerOptions + { + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + PropertyNamingPolicy = JsonNamingPolicy.CamelCase, + WriteIndented = true, + }) }; ActionTypes = RefitFor(ActionTypes!); AdditionalInvoiceFieldValues = RefitFor(AdditionalInvoiceFieldValues!); From 8a346ee022e51da16569cd3f5b24c76ee222f2ee Mon Sep 17 00:00:00 2001 From: Macgyver Hoferkamp Date: Thu, 9 Jul 2026 09:14:46 -0500 Subject: [PATCH 2/5] chore: refactor JSON serialization in AutoTaskClient - Replace System.Text.Json with Newtonsoft.Json for serialization - Update RefitSettings to use NewtonsoftJsonContentSerializer - Adjust JSON settings for null value handling and property naming --- AutoTask.Psa.Api/AutoTaskClient.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/AutoTask.Psa.Api/AutoTaskClient.cs b/AutoTask.Psa.Api/AutoTaskClient.cs index 7ee7992..a04a20b 100644 --- a/AutoTask.Psa.Api/AutoTaskClient.cs +++ b/AutoTask.Psa.Api/AutoTaskClient.cs @@ -1,7 +1,7 @@ +using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using Newtonsoft.Json.Serialization; using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; namespace AutoTask.Psa.Api; @@ -33,12 +33,12 @@ public AutoTaskClient(HttpClient client) _httpClient = client; _refitSettings = new RefitSettings { - ContentSerializer = new SystemTextJsonContentSerializer( - new JsonSerializerOptions + ContentSerializer = new NewtonsoftJsonContentSerializer( + new JsonSerializerSettings { - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, - PropertyNamingPolicy = JsonNamingPolicy.CamelCase, - WriteIndented = true, + NullValueHandling = NullValueHandling.Ignore, + ContractResolver = new CamelCasePropertyNamesContractResolver(), + Formatting = Formatting.Indented, }) }; ActionTypes = RefitFor(ActionTypes!); From b9e6226b1a3c974cc1c9a601c8419407a23f0f48 Mon Sep 17 00:00:00 2001 From: Macgyver Hoferkamp Date: Thu, 9 Jul 2026 09:20:12 -0500 Subject: [PATCH 3/5] chore: add Refit.Newtonsoft.Json package reference - Added Refit.Newtonsoft.Json package to AutoTask.Psa.Api.csproj - Added Refit.Newtonsoft.Json package version to Directory.Packages.props --- AutoTask.Psa.Api/AutoTask.Psa.Api.csproj | 1 + AutoTask.Psa.Api/AutoTaskClient.cs | 1 + Directory.Packages.props | 1 + 3 files changed, 3 insertions(+) diff --git a/AutoTask.Psa.Api/AutoTask.Psa.Api.csproj b/AutoTask.Psa.Api/AutoTask.Psa.Api.csproj index 096e89e..4d9e375 100644 --- a/AutoTask.Psa.Api/AutoTask.Psa.Api.csproj +++ b/AutoTask.Psa.Api/AutoTask.Psa.Api.csproj @@ -43,6 +43,7 @@ + diff --git a/AutoTask.Psa.Api/AutoTaskClient.cs b/AutoTask.Psa.Api/AutoTaskClient.cs index a04a20b..4179153 100644 --- a/AutoTask.Psa.Api/AutoTaskClient.cs +++ b/AutoTask.Psa.Api/AutoTaskClient.cs @@ -1,6 +1,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; +using Refit.Newtonsoft.Json; using System.Text; namespace AutoTask.Psa.Api; diff --git a/Directory.Packages.props b/Directory.Packages.props index 4483ce3..2ee9318 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -18,6 +18,7 @@ + From b37cd63d3bc30e181743966891a5629852db46f7 Mon Sep 17 00:00:00 2001 From: Macgyver Hoferkamp Date: Thu, 9 Jul 2026 09:24:07 -0500 Subject: [PATCH 4/5] chore: remove unused Refit.Newtonsoft.Json package reference - Removed the using directive for Refit.Newtonsoft.Json --- AutoTask.Psa.Api/AutoTaskClient.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/AutoTask.Psa.Api/AutoTaskClient.cs b/AutoTask.Psa.Api/AutoTaskClient.cs index 4179153..a04a20b 100644 --- a/AutoTask.Psa.Api/AutoTaskClient.cs +++ b/AutoTask.Psa.Api/AutoTaskClient.cs @@ -1,7 +1,6 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; -using Refit.Newtonsoft.Json; using System.Text; namespace AutoTask.Psa.Api; From 77fb5779657c1024b5d521f8e35cbda68d21a4dd Mon Sep 17 00:00:00 2001 From: Macgyver Hoferkamp Date: Thu, 9 Jul 2026 09:14:46 -0500 Subject: [PATCH 5/5] chore: refactor JSON serialization in AutoTaskClient - Replace System.Text.Json with Newtonsoft.Json for serialization - Update RefitSettings to use NewtonsoftJsonContentSerializer - Adjust JSON settings for null value handling and property naming --- AutoTask.Psa.Api/AutoTask.Psa.Api.csproj | 1 + AutoTask.Psa.Api/AutoTaskClient.cs | 14 +++++++------- Directory.Packages.props | 1 + 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/AutoTask.Psa.Api/AutoTask.Psa.Api.csproj b/AutoTask.Psa.Api/AutoTask.Psa.Api.csproj index 096e89e..4d9e375 100644 --- a/AutoTask.Psa.Api/AutoTask.Psa.Api.csproj +++ b/AutoTask.Psa.Api/AutoTask.Psa.Api.csproj @@ -43,6 +43,7 @@ + diff --git a/AutoTask.Psa.Api/AutoTaskClient.cs b/AutoTask.Psa.Api/AutoTaskClient.cs index 7ee7992..a04a20b 100644 --- a/AutoTask.Psa.Api/AutoTaskClient.cs +++ b/AutoTask.Psa.Api/AutoTaskClient.cs @@ -1,7 +1,7 @@ +using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using Newtonsoft.Json.Serialization; using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; namespace AutoTask.Psa.Api; @@ -33,12 +33,12 @@ public AutoTaskClient(HttpClient client) _httpClient = client; _refitSettings = new RefitSettings { - ContentSerializer = new SystemTextJsonContentSerializer( - new JsonSerializerOptions + ContentSerializer = new NewtonsoftJsonContentSerializer( + new JsonSerializerSettings { - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, - PropertyNamingPolicy = JsonNamingPolicy.CamelCase, - WriteIndented = true, + NullValueHandling = NullValueHandling.Ignore, + ContractResolver = new CamelCasePropertyNamesContractResolver(), + Formatting = Formatting.Indented, }) }; ActionTypes = RefitFor(ActionTypes!); diff --git a/Directory.Packages.props b/Directory.Packages.props index 4483ce3..2ee9318 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -18,6 +18,7 @@ +