From 963e87e504c801ca6904445f6f849a7a8ae78d98 Mon Sep 17 00:00:00 2001 From: nwithan8 Date: Fri, 25 Aug 2023 14:30:18 -0600 Subject: [PATCH 1/3] - Add "Matches" function at base level of all parameter sets to test if a given set matches a provided EasyPostObject-based object - Add unit tests to confirm function can be implemented and works as expected --- .../ParametersTests/ParametersTest.cs | 58 ++++++++++++++++++- EasyPost/Models/API/Batch.cs | 2 +- EasyPost/Models/API/Beta/CarrierMetadata.cs | 3 +- EasyPost/Models/API/CarrierMetadata.cs | 3 +- EasyPost/Models/Shared/PaginatedCollection.cs | 7 ++- EasyPost/Parameters/Address/All.cs | 2 +- EasyPost/Parameters/Address/Create.cs | 2 +- EasyPost/Parameters/BaseAllParameters.cs | 9 ++- EasyPost/Parameters/BaseParameters.cs | 21 +++++-- EasyPost/Parameters/Batch/AddShipments.cs | 2 +- EasyPost/Parameters/Batch/All.cs | 2 +- EasyPost/Parameters/Batch/Create.cs | 2 +- EasyPost/Parameters/Batch/GenerateLabel.cs | 2 +- EasyPost/Parameters/Batch/GenerateScanForm.cs | 2 +- EasyPost/Parameters/Batch/RemoveShipments.cs | 2 +- .../Beta/CarrierMetadata/Retrieve.cs | 4 +- EasyPost/Parameters/Beta/Rate/Retrieve.cs | 2 +- EasyPost/Parameters/CarrierAccount/Create.cs | 2 +- EasyPost/Parameters/CarrierAccount/Update.cs | 2 +- .../Parameters/CarrierMetadata/Retrieve.cs | 4 +- EasyPost/Parameters/CustomsInfo/Create.cs | 2 +- EasyPost/Parameters/CustomsItem/Create.cs | 2 +- EasyPost/Parameters/EndShipper/All.cs | 2 +- EasyPost/Parameters/EndShipper/Create.cs | 2 +- EasyPost/Parameters/EndShipper/Update.cs | 2 +- EasyPost/Parameters/Event/All.cs | 2 +- EasyPost/Parameters/IBaseParameters.cs | 21 +++++++ EasyPost/Parameters/Insurance/All.cs | 2 +- EasyPost/Parameters/Insurance/Create.cs | 2 +- EasyPost/Parameters/Order/Buy.cs | 2 +- EasyPost/Parameters/Order/Create.cs | 2 +- EasyPost/Parameters/Parcel/Create.cs | 2 +- EasyPost/Parameters/Pickup/All.cs | 2 +- EasyPost/Parameters/Pickup/Buy.cs | 2 +- EasyPost/Parameters/Pickup/Create.cs | 2 +- .../ReferralCustomer/AddPaymentMethod.cs | 2 +- EasyPost/Parameters/ReferralCustomer/All.cs | 2 +- .../CreateReferralCustomer.cs | 2 +- .../ReferralCustomer/RefundByAmount.cs | 2 +- .../ReferralCustomer/RefundByPaymentLog.cs | 2 +- EasyPost/Parameters/Refund/All.cs | 2 +- EasyPost/Parameters/Refund/Create.cs | 2 +- EasyPost/Parameters/Report/All.cs | 2 +- EasyPost/Parameters/Report/Create.cs | 2 +- EasyPost/Parameters/ScanForm/All.cs | 2 +- EasyPost/Parameters/ScanForm/Create.cs | 2 +- EasyPost/Parameters/Shipment/All.cs | 2 +- EasyPost/Parameters/Shipment/Buy.cs | 2 +- EasyPost/Parameters/Shipment/Create.cs | 2 +- EasyPost/Parameters/Shipment/GenerateForm.cs | 4 +- EasyPost/Parameters/Shipment/GenerateLabel.cs | 2 +- EasyPost/Parameters/Shipment/Insure.cs | 2 +- .../Parameters/Shipment/RegenerateRates.cs | 2 +- .../Shipment/RetrieveEstimatedDeliveryDate.cs | 2 +- EasyPost/Parameters/TaxIdentifier/Create.cs | 2 +- EasyPost/Parameters/Tracker/All.cs | 2 +- EasyPost/Parameters/Tracker/Create.cs | 2 +- EasyPost/Parameters/Tracker/CreateList.cs | 4 +- EasyPost/Parameters/User/CreateChild.cs | 2 +- EasyPost/Parameters/User/Update.cs | 2 +- EasyPost/Parameters/User/UpdateBrand.cs | 2 +- EasyPost/Parameters/Webhook/All.cs | 2 +- EasyPost/Parameters/Webhook/Create.cs | 2 +- EasyPost/Parameters/Webhook/Update.cs | 2 +- 64 files changed, 168 insertions(+), 76 deletions(-) create mode 100644 EasyPost/Parameters/IBaseParameters.cs diff --git a/EasyPost.Tests/ParametersTests/ParametersTest.cs b/EasyPost.Tests/ParametersTests/ParametersTest.cs index 993ff035b..eef454d3a 100644 --- a/EasyPost.Tests/ParametersTests/ParametersTest.cs +++ b/EasyPost.Tests/ParametersTests/ParametersTest.cs @@ -1,6 +1,8 @@ using System.Collections.Generic; using System.Threading.Tasks; +using EasyPost._base; using EasyPost.Models.API; +using EasyPost.Parameters; using EasyPost.Tests._Utilities; using EasyPost.Tests._Utilities.Attributes; using EasyPost.Utilities.Internal.Attributes; @@ -255,9 +257,9 @@ public async Task TestDisallowUsingParameterObjectDictionariesInDictionaryFuncti [Testing.Logic] public void TestParameterToDictionaryAccountsForNonPublicProperties() { - ExampleParameters exampleParameters = new ExampleParameters(); + ExampleDecoratorParameters exampleDecoratorParameters = new ExampleDecoratorParameters(); - Dictionary dictionary = exampleParameters.ToDictionary(); + Dictionary dictionary = exampleDecoratorParameters.ToDictionary(); // All decorated properties should be present in the dictionary, regardless of their access modifier Assert.True(dictionary.ContainsKey("decorated_public_property")); @@ -270,11 +272,50 @@ public void TestParameterToDictionaryAccountsForNonPublicProperties() Assert.True(dictionary.Count == 4); } + /// + /// This test proves that the .Matches() method will evaluate if a provided EasyPostObject matches the current parameter set, based on the defined match function. + /// + [Fact] + [Testing.Logic] + public void TestParameterMatchOverrideFunction() + { + ExampleMatchParametersEasyPostObject obj = new ExampleMatchParametersEasyPostObject + { + Prop1 = "prop1", + // uses default match function at base level (returns false) + // this can also be implemented on a per-parameter set basis + // users can also override the match function to implement custom logic (see examples below) + }; + + // The default match function should return false + ExampleMatchParameters parameters = new ExampleMatchParameters + { + Prop1 = "prop1", + }; + Assert.False(parameters.Matches(obj)); + + // The overridden match function should return true (because the Prop1 property matches) + parameters = new ExampleMatchParameters + { + Prop1 = "prop1", + MatchFunction = o => o.Prop1 == "prop1", + }; + Assert.True(parameters.Matches(obj)); + + // The overridden match function should return false (because the Prop1 property does not match) + parameters = new ExampleMatchParameters + { + Prop1 = "prop2", + MatchFunction = o => o.Prop1 == "prop2", + }; + Assert.False(parameters.Matches(obj)); + } + #endregion } #pragma warning disable CA1852 // Can be sealed - internal class ExampleParameters : Parameters.BaseParameters + internal class ExampleDecoratorParameters : Parameters.BaseParameters { // Default values set to guarantee any property won't be skipped for serialization due to a null value @@ -295,5 +336,16 @@ internal class ExampleParameters : Parameters.BaseParameters private string? UndecoratedPrivateProperty { get; set; } = "undecorated_private"; } + + internal class ExampleMatchParametersEasyPostObject : EasyPostObject + { + public string? Prop1 { get; set; } + } + + internal class ExampleMatchParameters : Parameters.BaseParameters + { + public string? Prop1 { get; set; } + } + #pragma warning restore CA1852 // Can be sealed } diff --git a/EasyPost/Models/API/Batch.cs b/EasyPost/Models/API/Batch.cs index 99a1991b6..adf63798e 100644 --- a/EasyPost/Models/API/Batch.cs +++ b/EasyPost/Models/API/Batch.cs @@ -112,7 +112,7 @@ public class BatchCollection : PaginatedCollection /// A TParameters-type parameters set. protected internal override TParameters BuildNextPageParameters(IEnumerable entries, int? pageSize = null) { - Parameters.Shipment.All parameters = Filters != null ? (Parameters.Shipment.All)Filters : new Parameters.Shipment.All(); + Parameters.Batch.All parameters = Filters != null ? (Parameters.Batch.All)Filters : new Parameters.Batch.All(); // TODO: Batches get returned in reverse order from everything else (oldest first instead of newest first), so this needs to be "after_id" instead of "before_id" parameters.AfterId = entries.Last().Id; diff --git a/EasyPost/Models/API/Beta/CarrierMetadata.cs b/EasyPost/Models/API/Beta/CarrierMetadata.cs index 6f7f9d420..aa19da0bb 100644 --- a/EasyPost/Models/API/Beta/CarrierMetadata.cs +++ b/EasyPost/Models/API/Beta/CarrierMetadata.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using EasyPost._base; using EasyPost.Utilities.Internal; using Newtonsoft.Json; @@ -10,7 +11,7 @@ namespace EasyPost.Models.API.Beta /// Class representing an EasyPost carrier metadata summary. /// [Obsolete("This class is deprecated. Please use EasyPost.Models.API.CarrierMetadata instead. This class will be removed in a future version.", false)] - public class CarrierMetadata + public class CarrierMetadata : EasyPostObject { #region JSON Properties diff --git a/EasyPost/Models/API/CarrierMetadata.cs b/EasyPost/Models/API/CarrierMetadata.cs index 98be076bb..5389cf04b 100644 --- a/EasyPost/Models/API/CarrierMetadata.cs +++ b/EasyPost/Models/API/CarrierMetadata.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using EasyPost._base; using EasyPost.Utilities.Internal; using Newtonsoft.Json; @@ -8,7 +9,7 @@ namespace EasyPost.Models.API /// /// Class representing an EasyPost carrier metadata summary. /// - public class CarrierMetadata + public class CarrierMetadata : EphemeralEasyPostObject { #region JSON Properties diff --git a/EasyPost/Models/Shared/PaginatedCollection.cs b/EasyPost/Models/Shared/PaginatedCollection.cs index dad786b4f..d5b4dd76d 100644 --- a/EasyPost/Models/Shared/PaginatedCollection.cs +++ b/EasyPost/Models/Shared/PaginatedCollection.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using EasyPost._base; using EasyPost.Exceptions.General; using Newtonsoft.Json; @@ -21,7 +22,7 @@ public abstract class PaginatedCollection : _base.EasyPostObject where /// /// The filter parameters used to retrieve this collection. /// - internal Parameters.BaseParameters? Filters { get; set; } + internal Parameters.BaseParameters? Filters { get; set; } /// /// Get the next page of a paginated collection. @@ -33,7 +34,7 @@ public abstract class PaginatedCollection : _base.EasyPostObject where /// The type of to construct for the API call. /// The next page of a paginated collection. /// Thrown if there is no next page to retrieve. - internal async Task GetNextPage(Func> apiCallFunction, List? currentEntries, int? pageSize = null) where TCollection : PaginatedCollection where TParameters : Parameters.BaseParameters + internal async Task GetNextPage(Func> apiCallFunction, List? currentEntries, int? pageSize = null) where TCollection : PaginatedCollection where TParameters : Parameters.BaseParameters { if (currentEntries == null || currentEntries.Count == 0) { @@ -59,6 +60,6 @@ internal async Task GetNextPage(FuncA TParameters-type set of parameters to use for the subsequent API call. /// Thrown if there are no more items to retrieve for the paginated collection. // This method is abstract and must be implemented for each collection. - protected internal abstract TParameters BuildNextPageParameters(IEnumerable entries, int? pageSize = null) where TParameters : Parameters.BaseParameters; + protected internal abstract TParameters BuildNextPageParameters(IEnumerable entries, int? pageSize = null) where TParameters : Parameters.BaseParameters; } } diff --git a/EasyPost/Parameters/Address/All.cs b/EasyPost/Parameters/Address/All.cs index 3217c30b6..bea0866df 100644 --- a/EasyPost/Parameters/Address/All.cs +++ b/EasyPost/Parameters/Address/All.cs @@ -9,7 +9,7 @@ namespace EasyPost.Parameters.Address /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class All : BaseAllParameters + public class All : BaseAllParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Address/Create.cs b/EasyPost/Parameters/Address/Create.cs index d475e0df2..63bf7adf3 100644 --- a/EasyPost/Parameters/Address/Create.cs +++ b/EasyPost/Parameters/Address/Create.cs @@ -7,7 +7,7 @@ namespace EasyPost.Parameters.Address /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Create : BaseParameters, IAddressParameter + public class Create : BaseParameters, IAddressParameter { #region Request Parameters diff --git a/EasyPost/Parameters/BaseAllParameters.cs b/EasyPost/Parameters/BaseAllParameters.cs index e8451b609..1ad04111a 100644 --- a/EasyPost/Parameters/BaseAllParameters.cs +++ b/EasyPost/Parameters/BaseAllParameters.cs @@ -1,19 +1,22 @@ using System; using System.Collections.Generic; +using EasyPost._base; namespace EasyPost.Parameters; /// /// Base class for parameter sets used in `All` methods. /// -public abstract class BaseAllParameters : BaseParameters +public abstract class BaseAllParameters : BaseParameters where TMatchInputType : EphemeralEasyPostObject { /// - /// Construct a new -based instance from a . + /// Construct a new -based instance from a . /// /// The dictionary to parse. /// A BaseAllParameters-subtype object. - public static BaseAllParameters FromDictionary(Dictionary? dictionary) +#pragma warning disable CA1000 + public static BaseAllParameters FromDictionary(Dictionary? dictionary) +#pragma warning restore CA1000 { throw new NotImplementedException(); } diff --git a/EasyPost/Parameters/BaseParameters.cs b/EasyPost/Parameters/BaseParameters.cs index 09a0e182b..0790898ba 100644 --- a/EasyPost/Parameters/BaseParameters.cs +++ b/EasyPost/Parameters/BaseParameters.cs @@ -15,7 +15,7 @@ namespace EasyPost.Parameters /// /// Base class for all parameters used in functions. /// - public abstract class BaseParameters + public abstract class BaseParameters : IBaseParameters where TMatchInputType : EphemeralEasyPostObject { /* * NOTES: @@ -31,10 +31,23 @@ public abstract class BaseParameters private Dictionary _parameterDictionary; /// - /// Initializes a new instance of the class for a new set of request parameters. + /// A function to determine if a given object matches this parameter set. + /// Defaults to always returning false, but can be overridden by child classes and end-users. + /// + public Func MatchFunction { get; set; } = _ => false; + + /// + /// Initializes a new instance of the class for a new set of request parameters. /// protected BaseParameters() => _parameterDictionary = new Dictionary(); + /// + /// Execute the match function on a given object. + /// + /// The to compare this parameter set against. + /// The result of the + public bool Matches(TMatchInputType obj) => MatchFunction(obj); + /// /// Convert this parameter object to a dictionary for an HTTP request. /// @@ -91,7 +104,7 @@ public virtual Dictionary ToDictionary() /// embedded. /// /// of parameters. - protected virtual Dictionary ToSubDictionary(Type parentParameterObjectType) + public virtual Dictionary ToSubDictionary(Type parentParameterObjectType) { // Construct the dictionary of all parameters PropertyInfo[] properties = GetType().GetProperties(BindingFlags.Instance | @@ -161,7 +174,7 @@ private void Add(RequestParameterAttribute requestParameterAttribute, object? va // If the given value is another base-Parameters object, serialize it as a sub-dictionary for the parent dictionary // This is because the JSON schema for a sub-object is different than the JSON schema for a top-level object // e.g. the schema for an address in the address create API call is different than the schema for an address in the shipment create API call - case BaseParameters parameters: + case IBaseParameters parameters: // todo: if issues arise with this function, look at the type constraint on BaseParameters here return parameters.ToSubDictionary(GetType()); // If the given value is a list, serialize each element of the list case IList list: diff --git a/EasyPost/Parameters/Batch/AddShipments.cs b/EasyPost/Parameters/Batch/AddShipments.cs index 7b3448a9e..a9b9ff9ab 100644 --- a/EasyPost/Parameters/Batch/AddShipments.cs +++ b/EasyPost/Parameters/Batch/AddShipments.cs @@ -8,7 +8,7 @@ namespace EasyPost.Parameters.Batch /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class AddShipments : BaseParameters + public class AddShipments : BaseParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Batch/All.cs b/EasyPost/Parameters/Batch/All.cs index 197d7dd73..f3f7ac81d 100644 --- a/EasyPost/Parameters/Batch/All.cs +++ b/EasyPost/Parameters/Batch/All.cs @@ -9,7 +9,7 @@ namespace EasyPost.Parameters.Batch /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class All : BaseAllParameters + public class All : BaseAllParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Batch/Create.cs b/EasyPost/Parameters/Batch/Create.cs index 471fc565d..ace1c11eb 100644 --- a/EasyPost/Parameters/Batch/Create.cs +++ b/EasyPost/Parameters/Batch/Create.cs @@ -8,7 +8,7 @@ namespace EasyPost.Parameters.Batch /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Create : BaseParameters, IBatchParameter + public class Create : BaseParameters, IBatchParameter { #region Request Parameters diff --git a/EasyPost/Parameters/Batch/GenerateLabel.cs b/EasyPost/Parameters/Batch/GenerateLabel.cs index 448ce2d44..ad93d0b06 100644 --- a/EasyPost/Parameters/Batch/GenerateLabel.cs +++ b/EasyPost/Parameters/Batch/GenerateLabel.cs @@ -7,7 +7,7 @@ namespace EasyPost.Parameters.Batch /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class GenerateLabel : BaseParameters + public class GenerateLabel : BaseParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Batch/GenerateScanForm.cs b/EasyPost/Parameters/Batch/GenerateScanForm.cs index 1bacdf0d6..22a7954db 100644 --- a/EasyPost/Parameters/Batch/GenerateScanForm.cs +++ b/EasyPost/Parameters/Batch/GenerateScanForm.cs @@ -7,7 +7,7 @@ namespace EasyPost.Parameters.Batch /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class GenerateScanForm : BaseParameters + public class GenerateScanForm : BaseParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Batch/RemoveShipments.cs b/EasyPost/Parameters/Batch/RemoveShipments.cs index 571fbe643..4d1742c7e 100644 --- a/EasyPost/Parameters/Batch/RemoveShipments.cs +++ b/EasyPost/Parameters/Batch/RemoveShipments.cs @@ -8,7 +8,7 @@ namespace EasyPost.Parameters.Batch /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class RemoveShipments : BaseParameters + public class RemoveShipments : BaseParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Beta/CarrierMetadata/Retrieve.cs b/EasyPost/Parameters/Beta/CarrierMetadata/Retrieve.cs index 39f545f94..4c0fb8e65 100644 --- a/EasyPost/Parameters/Beta/CarrierMetadata/Retrieve.cs +++ b/EasyPost/Parameters/Beta/CarrierMetadata/Retrieve.cs @@ -11,7 +11,7 @@ namespace EasyPost.Parameters.Beta.CarrierMetadata /// [ExcludeFromCodeCoverage] [Obsolete("This class is deprecated. Please use EasyPost.Parameters.CarrierMetadata.Retrieve instead. This class will be removed in a future version.", false)] - public class Retrieve : BaseParameters + public class Retrieve : BaseParameters { #region Request Parameters @@ -28,7 +28,7 @@ public class Retrieve : BaseParameters #endregion /// - /// Override the default method to handle the unique serialization requirements for this parameter set. + /// Override the default method to handle the unique serialization requirements for this parameter set. /// /// A . public override Dictionary ToDictionary() diff --git a/EasyPost/Parameters/Beta/Rate/Retrieve.cs b/EasyPost/Parameters/Beta/Rate/Retrieve.cs index d741847f0..b19bb8fee 100644 --- a/EasyPost/Parameters/Beta/Rate/Retrieve.cs +++ b/EasyPost/Parameters/Beta/Rate/Retrieve.cs @@ -8,7 +8,7 @@ namespace EasyPost.Parameters.Beta.Rate /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Retrieve : BaseParameters + public class Retrieve : BaseParameters { #region Request Parameters diff --git a/EasyPost/Parameters/CarrierAccount/Create.cs b/EasyPost/Parameters/CarrierAccount/Create.cs index ee45d40c4..d93bc57f0 100644 --- a/EasyPost/Parameters/CarrierAccount/Create.cs +++ b/EasyPost/Parameters/CarrierAccount/Create.cs @@ -8,7 +8,7 @@ namespace EasyPost.Parameters.CarrierAccount /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Create : BaseParameters, ICarrierAccountParameter + public class Create : BaseParameters, ICarrierAccountParameter { #region Request Parameters diff --git a/EasyPost/Parameters/CarrierAccount/Update.cs b/EasyPost/Parameters/CarrierAccount/Update.cs index a4cd95e54..1fdd84a21 100644 --- a/EasyPost/Parameters/CarrierAccount/Update.cs +++ b/EasyPost/Parameters/CarrierAccount/Update.cs @@ -8,7 +8,7 @@ namespace EasyPost.Parameters.CarrierAccount /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Update : BaseParameters + public class Update : BaseParameters { #region Request Parameters diff --git a/EasyPost/Parameters/CarrierMetadata/Retrieve.cs b/EasyPost/Parameters/CarrierMetadata/Retrieve.cs index 6a84a3e1b..c3027da4c 100644 --- a/EasyPost/Parameters/CarrierMetadata/Retrieve.cs +++ b/EasyPost/Parameters/CarrierMetadata/Retrieve.cs @@ -9,7 +9,7 @@ namespace EasyPost.Parameters.CarrierMetadata /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Retrieve : BaseParameters + public class Retrieve : BaseParameters { #region Request Parameters @@ -26,7 +26,7 @@ public class Retrieve : BaseParameters #endregion /// - /// Override the default method to handle the unique serialization requirements for this parameter set. + /// Override the default method to handle the unique serialization requirements for this parameter set. /// /// A . public override Dictionary ToDictionary() diff --git a/EasyPost/Parameters/CustomsInfo/Create.cs b/EasyPost/Parameters/CustomsInfo/Create.cs index d73900211..06e42f3ef 100644 --- a/EasyPost/Parameters/CustomsInfo/Create.cs +++ b/EasyPost/Parameters/CustomsInfo/Create.cs @@ -8,7 +8,7 @@ namespace EasyPost.Parameters.CustomsInfo /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Create : BaseParameters, ICustomsInfoParameter + public class Create : BaseParameters, ICustomsInfoParameter { #region Request Parameters diff --git a/EasyPost/Parameters/CustomsItem/Create.cs b/EasyPost/Parameters/CustomsItem/Create.cs index 3247cd581..e3f30e919 100644 --- a/EasyPost/Parameters/CustomsItem/Create.cs +++ b/EasyPost/Parameters/CustomsItem/Create.cs @@ -7,7 +7,7 @@ namespace EasyPost.Parameters.CustomsItem /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Create : BaseParameters, ICustomsItemParameter + public class Create : BaseParameters, ICustomsItemParameter { #region Request Parameters diff --git a/EasyPost/Parameters/EndShipper/All.cs b/EasyPost/Parameters/EndShipper/All.cs index 8741c95c4..9d969617f 100644 --- a/EasyPost/Parameters/EndShipper/All.cs +++ b/EasyPost/Parameters/EndShipper/All.cs @@ -9,7 +9,7 @@ namespace EasyPost.Parameters.EndShipper /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class All : BaseAllParameters + public class All : BaseAllParameters { #region Request Parameters diff --git a/EasyPost/Parameters/EndShipper/Create.cs b/EasyPost/Parameters/EndShipper/Create.cs index d505a0d27..cb1557093 100644 --- a/EasyPost/Parameters/EndShipper/Create.cs +++ b/EasyPost/Parameters/EndShipper/Create.cs @@ -7,7 +7,7 @@ namespace EasyPost.Parameters.EndShipper /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Create : BaseParameters, IEndShipperParameter + public class Create : BaseParameters, IEndShipperParameter { #region Request Parameters diff --git a/EasyPost/Parameters/EndShipper/Update.cs b/EasyPost/Parameters/EndShipper/Update.cs index ab8e48661..fc9b37826 100644 --- a/EasyPost/Parameters/EndShipper/Update.cs +++ b/EasyPost/Parameters/EndShipper/Update.cs @@ -7,7 +7,7 @@ namespace EasyPost.Parameters.EndShipper /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Update : BaseParameters + public class Update : BaseParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Event/All.cs b/EasyPost/Parameters/Event/All.cs index 6e43ba160..4d46c4e16 100644 --- a/EasyPost/Parameters/Event/All.cs +++ b/EasyPost/Parameters/Event/All.cs @@ -9,7 +9,7 @@ namespace EasyPost.Parameters.Event /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class All : BaseAllParameters + public class All : BaseAllParameters { #region Request Parameters diff --git a/EasyPost/Parameters/IBaseParameters.cs b/EasyPost/Parameters/IBaseParameters.cs new file mode 100644 index 000000000..53776873e --- /dev/null +++ b/EasyPost/Parameters/IBaseParameters.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Reflection; +using EasyPost._base; +using EasyPost.Exceptions.General; +using EasyPost.Utilities.Internal; +using EasyPost.Utilities.Internal.Attributes; +using EasyPost.Utilities.Internal.Extensions; + +namespace EasyPost.Parameters +{ + public interface IBaseParameters + { + public Dictionary ToDictionary(); + + public Dictionary ToSubDictionary(Type parentParameterObjectType); + } +} diff --git a/EasyPost/Parameters/Insurance/All.cs b/EasyPost/Parameters/Insurance/All.cs index 116df22fd..8c94e5c35 100644 --- a/EasyPost/Parameters/Insurance/All.cs +++ b/EasyPost/Parameters/Insurance/All.cs @@ -9,7 +9,7 @@ namespace EasyPost.Parameters.Insurance /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class All : BaseAllParameters + public class All : BaseAllParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Insurance/Create.cs b/EasyPost/Parameters/Insurance/Create.cs index f28a762cc..4f8f5220c 100644 --- a/EasyPost/Parameters/Insurance/Create.cs +++ b/EasyPost/Parameters/Insurance/Create.cs @@ -7,7 +7,7 @@ namespace EasyPost.Parameters.Insurance /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Create : BaseParameters, IInsuranceParameter + public class Create : BaseParameters, IInsuranceParameter { #region Request Parameters diff --git a/EasyPost/Parameters/Order/Buy.cs b/EasyPost/Parameters/Order/Buy.cs index e8c18e7d3..79f073f35 100644 --- a/EasyPost/Parameters/Order/Buy.cs +++ b/EasyPost/Parameters/Order/Buy.cs @@ -8,7 +8,7 @@ namespace EasyPost.Parameters.Order /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Buy : BaseParameters + public class Buy : BaseParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Order/Create.cs b/EasyPost/Parameters/Order/Create.cs index c419e896c..f14caa1af 100644 --- a/EasyPost/Parameters/Order/Create.cs +++ b/EasyPost/Parameters/Order/Create.cs @@ -8,7 +8,7 @@ namespace EasyPost.Parameters.Order /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Create : BaseParameters, IOrderParameter + public class Create : BaseParameters, IOrderParameter { #region Request Parameters diff --git a/EasyPost/Parameters/Parcel/Create.cs b/EasyPost/Parameters/Parcel/Create.cs index 64703b8b5..49e323781 100644 --- a/EasyPost/Parameters/Parcel/Create.cs +++ b/EasyPost/Parameters/Parcel/Create.cs @@ -7,7 +7,7 @@ namespace EasyPost.Parameters.Parcel /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Create : BaseParameters, IParcelParameter + public class Create : BaseParameters, IParcelParameter { #region Request Parameters diff --git a/EasyPost/Parameters/Pickup/All.cs b/EasyPost/Parameters/Pickup/All.cs index 6f558db4e..c999d0991 100644 --- a/EasyPost/Parameters/Pickup/All.cs +++ b/EasyPost/Parameters/Pickup/All.cs @@ -9,7 +9,7 @@ namespace EasyPost.Parameters.Pickup /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class All : BaseAllParameters + public class All : BaseAllParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Pickup/Buy.cs b/EasyPost/Parameters/Pickup/Buy.cs index 4cab9ca75..224fef108 100644 --- a/EasyPost/Parameters/Pickup/Buy.cs +++ b/EasyPost/Parameters/Pickup/Buy.cs @@ -8,7 +8,7 @@ namespace EasyPost.Parameters.Pickup /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Buy : BaseParameters + public class Buy : BaseParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Pickup/Create.cs b/EasyPost/Parameters/Pickup/Create.cs index cd21a9b37..b961f9166 100644 --- a/EasyPost/Parameters/Pickup/Create.cs +++ b/EasyPost/Parameters/Pickup/Create.cs @@ -8,7 +8,7 @@ namespace EasyPost.Parameters.Pickup /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Create : BaseParameters, IPickupParameter + public class Create : BaseParameters, IPickupParameter { #region Request Parameters diff --git a/EasyPost/Parameters/ReferralCustomer/AddPaymentMethod.cs b/EasyPost/Parameters/ReferralCustomer/AddPaymentMethod.cs index 739824a4e..79af1b0f5 100644 --- a/EasyPost/Parameters/ReferralCustomer/AddPaymentMethod.cs +++ b/EasyPost/Parameters/ReferralCustomer/AddPaymentMethod.cs @@ -8,7 +8,7 @@ namespace EasyPost.Parameters.ReferralCustomer /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class AddPaymentMethod : BaseParameters + public class AddPaymentMethod : BaseParameters { #region Request Parameters diff --git a/EasyPost/Parameters/ReferralCustomer/All.cs b/EasyPost/Parameters/ReferralCustomer/All.cs index 8027224d2..d4259f615 100644 --- a/EasyPost/Parameters/ReferralCustomer/All.cs +++ b/EasyPost/Parameters/ReferralCustomer/All.cs @@ -9,7 +9,7 @@ namespace EasyPost.Parameters.ReferralCustomer /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class All : BaseAllParameters + public class All : BaseAllParameters { #region Request Parameters diff --git a/EasyPost/Parameters/ReferralCustomer/CreateReferralCustomer.cs b/EasyPost/Parameters/ReferralCustomer/CreateReferralCustomer.cs index e36847f48..30125811b 100644 --- a/EasyPost/Parameters/ReferralCustomer/CreateReferralCustomer.cs +++ b/EasyPost/Parameters/ReferralCustomer/CreateReferralCustomer.cs @@ -7,7 +7,7 @@ namespace EasyPost.Parameters.ReferralCustomer /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class CreateReferralCustomer : BaseParameters, IReferralCustomerParameter + public class CreateReferralCustomer : BaseParameters, IReferralCustomerParameter { #region Request Parameters diff --git a/EasyPost/Parameters/ReferralCustomer/RefundByAmount.cs b/EasyPost/Parameters/ReferralCustomer/RefundByAmount.cs index 83ebabf05..6e8472d97 100644 --- a/EasyPost/Parameters/ReferralCustomer/RefundByAmount.cs +++ b/EasyPost/Parameters/ReferralCustomer/RefundByAmount.cs @@ -7,7 +7,7 @@ namespace EasyPost.Parameters.ReferralCustomer /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class RefundByAmount : BaseParameters + public class RefundByAmount : BaseParameters { #region Request Parameters diff --git a/EasyPost/Parameters/ReferralCustomer/RefundByPaymentLog.cs b/EasyPost/Parameters/ReferralCustomer/RefundByPaymentLog.cs index 4cc3fe2df..1a729c630 100644 --- a/EasyPost/Parameters/ReferralCustomer/RefundByPaymentLog.cs +++ b/EasyPost/Parameters/ReferralCustomer/RefundByPaymentLog.cs @@ -7,7 +7,7 @@ namespace EasyPost.Parameters.ReferralCustomer /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class RefundByPaymentLog : BaseParameters + public class RefundByPaymentLog : BaseParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Refund/All.cs b/EasyPost/Parameters/Refund/All.cs index bd5c04b35..7ffcb6b32 100644 --- a/EasyPost/Parameters/Refund/All.cs +++ b/EasyPost/Parameters/Refund/All.cs @@ -9,7 +9,7 @@ namespace EasyPost.Parameters.Refund /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class All : BaseAllParameters + public class All : BaseAllParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Refund/Create.cs b/EasyPost/Parameters/Refund/Create.cs index 4c229a350..08b4cca91 100644 --- a/EasyPost/Parameters/Refund/Create.cs +++ b/EasyPost/Parameters/Refund/Create.cs @@ -8,7 +8,7 @@ namespace EasyPost.Parameters.Refund /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Create : BaseParameters, IRefundParameter + public class Create : BaseParameters, IRefundParameter { #region Request Parameters diff --git a/EasyPost/Parameters/Report/All.cs b/EasyPost/Parameters/Report/All.cs index ca716d544..ed8fe1bb4 100644 --- a/EasyPost/Parameters/Report/All.cs +++ b/EasyPost/Parameters/Report/All.cs @@ -9,7 +9,7 @@ namespace EasyPost.Parameters.Report /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class All : BaseAllParameters + public class All : BaseAllParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Report/Create.cs b/EasyPost/Parameters/Report/Create.cs index 1e6f4b6ca..8adeb7afb 100644 --- a/EasyPost/Parameters/Report/Create.cs +++ b/EasyPost/Parameters/Report/Create.cs @@ -8,7 +8,7 @@ namespace EasyPost.Parameters.Report /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Create : BaseParameters, IReportParameter + public class Create : BaseParameters, IReportParameter { #region Request Parameters diff --git a/EasyPost/Parameters/ScanForm/All.cs b/EasyPost/Parameters/ScanForm/All.cs index a7f5f37f9..63a7c578f 100644 --- a/EasyPost/Parameters/ScanForm/All.cs +++ b/EasyPost/Parameters/ScanForm/All.cs @@ -9,7 +9,7 @@ namespace EasyPost.Parameters.ScanForm /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class All : BaseAllParameters + public class All : BaseAllParameters { #region Request Parameters diff --git a/EasyPost/Parameters/ScanForm/Create.cs b/EasyPost/Parameters/ScanForm/Create.cs index 599afa5b3..0f44914be 100644 --- a/EasyPost/Parameters/ScanForm/Create.cs +++ b/EasyPost/Parameters/ScanForm/Create.cs @@ -8,7 +8,7 @@ namespace EasyPost.Parameters.ScanForm /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Create : BaseParameters, IScanFormParameter + public class Create : BaseParameters, IScanFormParameter { #region Request Parameters diff --git a/EasyPost/Parameters/Shipment/All.cs b/EasyPost/Parameters/Shipment/All.cs index f6eb88aec..93fd734d8 100644 --- a/EasyPost/Parameters/Shipment/All.cs +++ b/EasyPost/Parameters/Shipment/All.cs @@ -9,7 +9,7 @@ namespace EasyPost.Parameters.Shipment /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class All : BaseAllParameters + public class All : BaseAllParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Shipment/Buy.cs b/EasyPost/Parameters/Shipment/Buy.cs index a8d9ffa89..f8a15d664 100644 --- a/EasyPost/Parameters/Shipment/Buy.cs +++ b/EasyPost/Parameters/Shipment/Buy.cs @@ -8,7 +8,7 @@ namespace EasyPost.Parameters.Shipment /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Buy : BaseParameters + public class Buy : BaseParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Shipment/Create.cs b/EasyPost/Parameters/Shipment/Create.cs index bb2fddc69..e0b7873cf 100644 --- a/EasyPost/Parameters/Shipment/Create.cs +++ b/EasyPost/Parameters/Shipment/Create.cs @@ -8,7 +8,7 @@ namespace EasyPost.Parameters.Shipment /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Create : BaseParameters, IShipmentParameter + public class Create : BaseParameters, IShipmentParameter { #region Request Parameters diff --git a/EasyPost/Parameters/Shipment/GenerateForm.cs b/EasyPost/Parameters/Shipment/GenerateForm.cs index 08f036983..48da2feed 100644 --- a/EasyPost/Parameters/Shipment/GenerateForm.cs +++ b/EasyPost/Parameters/Shipment/GenerateForm.cs @@ -9,7 +9,7 @@ namespace EasyPost.Parameters.Shipment /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class GenerateForm : BaseParameters + public class GenerateForm : BaseParameters { #region Request Parameters @@ -25,7 +25,7 @@ public class GenerateForm : BaseParameters public Dictionary? Data { get; set; } /// - /// Override the default method to handle the unique serialization requirements for this parameter set. + /// Override the default method to handle the unique serialization requirements for this parameter set. /// /// A . /// Thrown when the form type was not provided. diff --git a/EasyPost/Parameters/Shipment/GenerateLabel.cs b/EasyPost/Parameters/Shipment/GenerateLabel.cs index 157d19503..0c1bb91e4 100644 --- a/EasyPost/Parameters/Shipment/GenerateLabel.cs +++ b/EasyPost/Parameters/Shipment/GenerateLabel.cs @@ -7,7 +7,7 @@ namespace EasyPost.Parameters.Shipment /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class GenerateLabel : BaseParameters + public class GenerateLabel : BaseParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Shipment/Insure.cs b/EasyPost/Parameters/Shipment/Insure.cs index 06136203e..d62eaf992 100644 --- a/EasyPost/Parameters/Shipment/Insure.cs +++ b/EasyPost/Parameters/Shipment/Insure.cs @@ -7,7 +7,7 @@ namespace EasyPost.Parameters.Shipment /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Insure : BaseParameters + public class Insure : BaseParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Shipment/RegenerateRates.cs b/EasyPost/Parameters/Shipment/RegenerateRates.cs index 4868993a8..f53dac01d 100644 --- a/EasyPost/Parameters/Shipment/RegenerateRates.cs +++ b/EasyPost/Parameters/Shipment/RegenerateRates.cs @@ -7,7 +7,7 @@ namespace EasyPost.Parameters.Shipment /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class RegenerateRates : BaseParameters + public class RegenerateRates : BaseParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Shipment/RetrieveEstimatedDeliveryDate.cs b/EasyPost/Parameters/Shipment/RetrieveEstimatedDeliveryDate.cs index bb667d9c8..3eba40e40 100644 --- a/EasyPost/Parameters/Shipment/RetrieveEstimatedDeliveryDate.cs +++ b/EasyPost/Parameters/Shipment/RetrieveEstimatedDeliveryDate.cs @@ -7,7 +7,7 @@ namespace EasyPost.Parameters.Shipment /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class RetrieveEstimatedDeliveryDate : BaseParameters + public class RetrieveEstimatedDeliveryDate : BaseParameters { #region Request Parameters diff --git a/EasyPost/Parameters/TaxIdentifier/Create.cs b/EasyPost/Parameters/TaxIdentifier/Create.cs index 48731f92b..cb61dccb1 100644 --- a/EasyPost/Parameters/TaxIdentifier/Create.cs +++ b/EasyPost/Parameters/TaxIdentifier/Create.cs @@ -7,7 +7,7 @@ namespace EasyPost.Parameters.TaxIdentifier /// Parameters for property. /// [ExcludeFromCodeCoverage] - public class Create : BaseParameters, ITaxIdentifierParameter + public class Create : BaseParameters, ITaxIdentifierParameter { #region Request Parameters diff --git a/EasyPost/Parameters/Tracker/All.cs b/EasyPost/Parameters/Tracker/All.cs index cbc17f9a2..f14b0c2d5 100644 --- a/EasyPost/Parameters/Tracker/All.cs +++ b/EasyPost/Parameters/Tracker/All.cs @@ -9,7 +9,7 @@ namespace EasyPost.Parameters.Tracker /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class All : BaseAllParameters + public class All : BaseAllParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Tracker/Create.cs b/EasyPost/Parameters/Tracker/Create.cs index 47efaa1b3..f45e31391 100644 --- a/EasyPost/Parameters/Tracker/Create.cs +++ b/EasyPost/Parameters/Tracker/Create.cs @@ -7,7 +7,7 @@ namespace EasyPost.Parameters.Tracker /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Create : BaseParameters, ITrackerParameter + public class Create : BaseParameters, ITrackerParameter { #region Request Parameters diff --git a/EasyPost/Parameters/Tracker/CreateList.cs b/EasyPost/Parameters/Tracker/CreateList.cs index a2a4f11b2..7592ab207 100644 --- a/EasyPost/Parameters/Tracker/CreateList.cs +++ b/EasyPost/Parameters/Tracker/CreateList.cs @@ -9,7 +9,7 @@ namespace EasyPost.Parameters.Tracker /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class CreateList : BaseParameters, ITrackerParameter + public class CreateList : BaseParameters, ITrackerParameter { #region Request Parameters @@ -37,7 +37,7 @@ public void AddTracker(string trackingCode, string? carrier = null) } /// - /// Override the default method to handle the unique serialization requirements for this parameter set. + /// Override the default method to handle the unique serialization requirements for this parameter set. /// /// A . public override Dictionary ToDictionary() diff --git a/EasyPost/Parameters/User/CreateChild.cs b/EasyPost/Parameters/User/CreateChild.cs index 0f7d8f83e..ecf930c8f 100644 --- a/EasyPost/Parameters/User/CreateChild.cs +++ b/EasyPost/Parameters/User/CreateChild.cs @@ -7,7 +7,7 @@ namespace EasyPost.Parameters.User /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class CreateChild : BaseParameters, IUserParameter + public class CreateChild : BaseParameters, IUserParameter { #region Request Parameters diff --git a/EasyPost/Parameters/User/Update.cs b/EasyPost/Parameters/User/Update.cs index 4357dd1c3..03ee085bb 100644 --- a/EasyPost/Parameters/User/Update.cs +++ b/EasyPost/Parameters/User/Update.cs @@ -7,7 +7,7 @@ namespace EasyPost.Parameters.User /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Update : BaseParameters + public class Update : BaseParameters { #region Request Parameters diff --git a/EasyPost/Parameters/User/UpdateBrand.cs b/EasyPost/Parameters/User/UpdateBrand.cs index 714fac899..158241139 100644 --- a/EasyPost/Parameters/User/UpdateBrand.cs +++ b/EasyPost/Parameters/User/UpdateBrand.cs @@ -7,7 +7,7 @@ namespace EasyPost.Parameters.User /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class UpdateBrand : BaseParameters + public class UpdateBrand : BaseParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Webhook/All.cs b/EasyPost/Parameters/Webhook/All.cs index d9ee7f080..d95b73820 100644 --- a/EasyPost/Parameters/Webhook/All.cs +++ b/EasyPost/Parameters/Webhook/All.cs @@ -9,7 +9,7 @@ namespace EasyPost.Parameters.Webhook /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class All : BaseAllParameters + public class All : BaseAllParameters { #region Request Parameters diff --git a/EasyPost/Parameters/Webhook/Create.cs b/EasyPost/Parameters/Webhook/Create.cs index 2e7dd4a6b..d3814ebdc 100644 --- a/EasyPost/Parameters/Webhook/Create.cs +++ b/EasyPost/Parameters/Webhook/Create.cs @@ -8,7 +8,7 @@ namespace EasyPost.Parameters.Webhook /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Create : BaseParameters, IWebhookParameter + public class Create : BaseParameters, IWebhookParameter { #region Request Parameters diff --git a/EasyPost/Parameters/Webhook/Update.cs b/EasyPost/Parameters/Webhook/Update.cs index ab6f3bac5..9ca907e35 100644 --- a/EasyPost/Parameters/Webhook/Update.cs +++ b/EasyPost/Parameters/Webhook/Update.cs @@ -8,7 +8,7 @@ namespace EasyPost.Parameters.Webhook /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Update : BaseParameters + public class Update : BaseParameters { #region Request Parameters From ad92d222839bacf0321741e020472b03866febb9 Mon Sep 17 00:00:00 2001 From: nwithan8 Date: Wed, 30 Aug 2023 14:38:14 -0600 Subject: [PATCH 2/3] - Linting --- EasyPost.Tests/ParametersTests/ParametersTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EasyPost.Tests/ParametersTests/ParametersTest.cs b/EasyPost.Tests/ParametersTests/ParametersTest.cs index eef454d3a..0f47c9282 100644 --- a/EasyPost.Tests/ParametersTests/ParametersTest.cs +++ b/EasyPost.Tests/ParametersTests/ParametersTest.cs @@ -137,7 +137,7 @@ public void TestRequiredAndOptionalParameterValidation() Assert.Throws(() => parametersWithOnlyOptionalParameterSet.ToDictionary()); } - private sealed class ParameterSetWithRequiredAndOptionalParameters : Parameters.BaseParameters + private sealed class ParameterSetWithRequiredAndOptionalParameters : Parameters.BaseParameters { [TopLevelRequestParameter(Necessity.Required, "test", "required")] public string? RequiredParameter { get; set; } From db19e6f448fa491268bfdf1c10a9f6bbb6a7a5ea Mon Sep 17 00:00:00 2001 From: Nate Harris Date: Wed, 30 Aug 2023 16:34:32 -0600 Subject: [PATCH 3/3] Update EasyPost/Parameters/BaseParameters.cs Co-authored-by: Justin Hammond <39606064+Justintime50@users.noreply.github.com> --- EasyPost/Parameters/BaseParameters.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EasyPost/Parameters/BaseParameters.cs b/EasyPost/Parameters/BaseParameters.cs index 0790898ba..073370e57 100644 --- a/EasyPost/Parameters/BaseParameters.cs +++ b/EasyPost/Parameters/BaseParameters.cs @@ -174,7 +174,7 @@ private void Add(RequestParameterAttribute requestParameterAttribute, object? va // If the given value is another base-Parameters object, serialize it as a sub-dictionary for the parent dictionary // This is because the JSON schema for a sub-object is different than the JSON schema for a top-level object // e.g. the schema for an address in the address create API call is different than the schema for an address in the shipment create API call - case IBaseParameters parameters: // todo: if issues arise with this function, look at the type constraint on BaseParameters here + case IBaseParameters parameters: // TODO: if issues arise with this function, look at the type constraint on BaseParameters here return parameters.ToSubDictionary(GetType()); // If the given value is a list, serialize each element of the list case IList list: