From 86a06d66816a2b28dd42bd489029a036711435b1 Mon Sep 17 00:00:00 2001 From: Brandon Moffett Date: Wed, 8 May 2024 17:48:04 -0700 Subject: [PATCH] Updated versioning and enhanced JSON serialization Updated `GitVersion.yml` and `settings.props` for version increment from `4.0.0` to `4.0.1`. Added `System.Text.Json.Serialization` namespace in several files and introduced `JsonPropertyName` attributes to various properties. Added a new file `Attributes.cs` with a new class and properties. Removed `CustomerMessage.cs` file and changed `CustomerMessage` property type in `ResolvedAddress.cs` from `List` to `List`. --- GitVersion.yml | 2 +- build/settings.props | 2 +- .../Client/V1/Models/Response/Alert.cs | 7 +- .../Client/V1/Models/Response/Attributes.cs | 81 +++++++++++++++++++ .../V1/Models/Response/CustomerMessage.cs | 8 -- .../Client/V1/Models/Response/Output.cs | 8 +- .../V1/Models/Response/ParsedPostalCode.cs | 7 +- .../V1/Models/Response/ResolutionToken.cs | 8 +- .../V1/Models/Response/ResolvedAddress.cs | 30 +++++-- 9 files changed, 131 insertions(+), 22 deletions(-) create mode 100644 src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/Attributes.cs delete mode 100644 src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/CustomerMessage.cs diff --git a/GitVersion.yml b/GitVersion.yml index 7792a55..d6a073f 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,5 +1,5 @@ mode: Mainline -next-version: 4.0.0 +next-version: 4.0.1 branches: feature: tag: preview diff --git a/build/settings.props b/build/settings.props index a47ba1b..97c7639 100644 --- a/build/settings.props +++ b/build/settings.props @@ -1,7 +1,7 @@ - 4.0.0-preview1 + 4.0.1-preview1 false true $(NoWarn);CS1591;NU1605;DS126858;DS137138;SA1010;SA1011 diff --git a/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/Alert.cs b/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/Alert.cs index e8a7632..e9bf6a2 100644 --- a/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/Alert.cs +++ b/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/Alert.cs @@ -1,10 +1,15 @@ -namespace EasyKeys.Shipping.FedEx.AddressValidation.Client.V1.Models.Response; +using System.Text.Json.Serialization; + +namespace EasyKeys.Shipping.FedEx.AddressValidation.Client.V1.Models.Response; public class Alert { + [JsonPropertyName("code")] public string Code { get; set; } = string.Empty; + [JsonPropertyName("message")] public string Message { get; set; } = string.Empty; + [JsonPropertyName("alertType")] public string AlertType { get; set; } = string.Empty; } diff --git a/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/Attributes.cs b/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/Attributes.cs new file mode 100644 index 0000000..1a3b388 --- /dev/null +++ b/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/Attributes.cs @@ -0,0 +1,81 @@ +using System.Text.Json.Serialization; + +namespace EasyKeys.Shipping.FedEx.AddressValidation.Client.V1.Models.Response; + +public class Attributes +{ + [JsonPropertyName("POBox")] + public bool? POBox { get; set; } + + [JsonPropertyName("POBoxOnlyZIP")] + public bool? POBoxOnlyZIP { get; set; } + + [JsonPropertyName("SplitZip")] + public bool? SplitZip { get; set; } + + [JsonPropertyName("SuiteRequiredButMissing")] + public bool? SuiteRequiredButMissing { get; set; } + + [JsonPropertyName("InvalidSuiteNumber")] + public bool? InvalidSuiteNumber { get; set; } + + [JsonPropertyName("ResolutionInput")] + public string? ResolutionInput { get; set; } + + [JsonPropertyName("DPV")] + public bool? DPV { get; set; } + + [JsonPropertyName("ResolutionMethod")] + public string? ResolutionMethod { get; set; } + + [JsonPropertyName("DataVintage")] + public string? DataVintage { get; set; } + + [JsonPropertyName("MatchSource")] + public string? MatchSource { get; set; } + + [JsonPropertyName("CountrySupported")] + public bool? CountrySupported { get; set; } + + [JsonPropertyName("ValidlyFormed")] + public bool? ValidlyFormed { get; set; } + + [JsonPropertyName("Matched")] + public bool? Matched { get; set; } + + [JsonPropertyName("Resolved")] + public bool? Resolved { get; set; } + + [JsonPropertyName("Inserted")] + public bool? Inserted { get; set; } + + [JsonPropertyName("MultiUnitBase")] + public bool? MultiUnitBase { get; set; } + + [JsonPropertyName("ZIP11Match")] + public bool? ZIP11Match { get; set; } + + [JsonPropertyName("ZIP4Match")] + public bool? ZIP4Match { get; set; } + + [JsonPropertyName("UniqueZIP")] + public bool? UniqueZIP { get; set; } + + [JsonPropertyName("StreetAddress")] + public bool? StreetAddress { get; set; } + + [JsonPropertyName("RRConversion")] + public bool? RRConversion { get; set; } + + [JsonPropertyName("ValidMultiUnit")] + public bool? ValidMultiUnit { get; set; } + + [JsonPropertyName("AddressType")] + public string? AddressType { get; set; } + + [JsonPropertyName("AddressPrecision")] + public string? AddressPrecision { get; set; } + + [JsonPropertyName("MultipleMatches")] + public bool? MultipleMatches { get; set; } +} diff --git a/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/CustomerMessage.cs b/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/CustomerMessage.cs deleted file mode 100644 index 8d4b1cf..0000000 --- a/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/CustomerMessage.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace EasyKeys.Shipping.FedEx.AddressValidation.Client.V1.Models.Response; - -public class CustomerMessage -{ - public bool Changed { get; set; } - - public string Value { get; set; } = string.Empty; -} diff --git a/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/Output.cs b/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/Output.cs index 78c992f..a67e5e6 100644 --- a/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/Output.cs +++ b/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/Output.cs @@ -1,8 +1,12 @@ -namespace EasyKeys.Shipping.FedEx.AddressValidation.Client.V1.Models.Response; +using System.Text.Json.Serialization; + +namespace EasyKeys.Shipping.FedEx.AddressValidation.Client.V1.Models.Response; public class Output { + [JsonPropertyName("resolvedAddresses")] public List? ResolvedAddresses { get; set; } - public List? Alerts { get; set; } + [JsonPropertyName("alerts")] + public List Alerts { get; set; } = new (); } diff --git a/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/ParsedPostalCode.cs b/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/ParsedPostalCode.cs index 048139f..33310c0 100644 --- a/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/ParsedPostalCode.cs +++ b/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/ParsedPostalCode.cs @@ -1,10 +1,15 @@ -namespace EasyKeys.Shipping.FedEx.AddressValidation.Client.V1.Models.Response; +using System.Text.Json.Serialization; + +namespace EasyKeys.Shipping.FedEx.AddressValidation.Client.V1.Models.Response; public class ParsedPostalCode { + [JsonPropertyName("base")] public string? Base { get; set; } + [JsonPropertyName("addOn")] public string? AddOn { get; set; } + [JsonPropertyName("deliveryPoint")] public string? DeliveryPoint { get; set; } } diff --git a/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/ResolutionToken.cs b/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/ResolutionToken.cs index 41f4956..0b114d9 100644 --- a/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/ResolutionToken.cs +++ b/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/ResolutionToken.cs @@ -1,8 +1,12 @@ -namespace EasyKeys.Shipping.FedEx.AddressValidation.Client.V1.Models.Response; +using System.Text.Json.Serialization; + +namespace EasyKeys.Shipping.FedEx.AddressValidation.Client.V1.Models.Response; public class ResolutionToken { - public bool Changed { get; set; } + [JsonPropertyName("changed")] + public bool? Changed { get; set; } + [JsonPropertyName("value")] public string? Value { get; set; } } diff --git a/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/ResolvedAddress.cs b/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/ResolvedAddress.cs index 49ee1fc..3c345f0 100644 --- a/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/ResolvedAddress.cs +++ b/src/EasyKeys.Shipping.FedEx.AddressValidation/Client/V1/Models/Response/ResolvedAddress.cs @@ -1,36 +1,54 @@ -namespace EasyKeys.Shipping.FedEx.AddressValidation.Client.V1.Models.Response; +using System.Text.Json.Serialization; + +namespace EasyKeys.Shipping.FedEx.AddressValidation.Client.V1.Models.Response; public class ResolvedAddress { + [JsonPropertyName("streetLinesToken")] public string[]? StreetLinesToken { get; set; } + [JsonPropertyName("city")] public string? City { get; set; } + [JsonPropertyName("stateOrProvinceCode")] public string? StateOrProvinceCode { get; set; } + [JsonPropertyName("countryCode")] public string? CountryCode { get; set; } - public List? CustomerMessage { get; set; } + [JsonPropertyName("customerMessage")] + public List? CustomerMessage { get; set; } + [JsonPropertyName("cityToken")] public List? CityToken { get; set; } + [JsonPropertyName("postalCodeToken")] public ResolutionToken? PostalCodeToken { get; set; } + [JsonPropertyName("parsedPostalCode")] public ParsedPostalCode? ParsedPostalCode { get; set; } + [JsonPropertyName("classification")] public string? Classification { get; set; } - public bool PostOfficeBox { get; set; } + [JsonPropertyName("postOfficeBox")] + public bool? PostOfficeBox { get; set; } - public bool NormalizedStatusNameDPV { get; set; } + [JsonPropertyName("normalizedStatusNameDPV")] + public bool? NormalizedStatusNameDPV { get; set; } + [JsonPropertyName("standardizedStatusNameMatchSource")] public string? StandardizedStatusNameMatchSource { get; set; } + [JsonPropertyName("resolutionMethodName")] public string? ResolutionMethodName { get; set; } - public bool RuralRouteHighwayContract { get; set; } + [JsonPropertyName("ruralRouteHighwayContract")] + public bool? RuralRouteHighwayContract { get; set; } - public bool GeneralDelivery { get; set; } + [JsonPropertyName("generalDelivery")] + public bool? GeneralDelivery { get; set; } + [JsonPropertyName("attributes")] public Dictionary Attributes { get; set; } = new (); }