diff --git a/EasyPost/Models/API/LineItem.cs b/EasyPost/Models/API/LineItem.cs new file mode 100644 index 00000000..e49ebe83 --- /dev/null +++ b/EasyPost/Models/API/LineItem.cs @@ -0,0 +1,27 @@ +using EasyPost._base; +using Newtonsoft.Json; + +namespace EasyPost.Models.API +{ + /// + /// Class representing line items of a Shipment. + /// + public class LineItem : EasyPostObject, Parameters.ILineItemParameter + { + #region JSON Properties + + /// + /// The total value of the line item. + /// + [JsonProperty("total_line_value")] + public string? TotalLineValue { get; set; } + + /// + /// The description of the item. + /// + [JsonProperty("item_description")] + public string? ItemDescription { get; set; } + + #endregion + } +} diff --git a/EasyPost/Models/API/Shipment.cs b/EasyPost/Models/API/Shipment.cs index 800ea17c..7711819a 100644 --- a/EasyPost/Models/API/Shipment.cs +++ b/EasyPost/Models/API/Shipment.cs @@ -77,6 +77,12 @@ public class Shipment : EasyPostObject, Parameters.IShipmentParameter [JsonProperty("is_return")] public bool? IsReturn { get; set; } + /// + /// A list of s associated with the shipment. + /// + [JsonProperty("line_items")] + public List? LineItems { get; set; } + /// /// A list of any carrier errors that occurred during rating or purchasing. /// diff --git a/EasyPost/Parameters/IParameter.cs b/EasyPost/Parameters/IParameter.cs index 451f8490..ccca58f0 100644 --- a/EasyPost/Parameters/IParameter.cs +++ b/EasyPost/Parameters/IParameter.cs @@ -63,6 +63,13 @@ public interface IInsuranceParameter : IParameter { } + /// + /// An interface marking that an instance of the implementing class can be used as a line item parameter in a Parameters object. + /// + public interface ILineItemParameter : IParameter + { + } + /// /// An interface marking that an instance of the implementing class can be used as an order parameter in a Parameters object. /// diff --git a/EasyPost/Parameters/Shipment/Create.cs b/EasyPost/Parameters/Shipment/Create.cs index 8ca6b635..0f3a1e4b 100644 --- a/EasyPost/Parameters/Shipment/Create.cs +++ b/EasyPost/Parameters/Shipment/Create.cs @@ -155,27 +155,11 @@ public class Create : BaseParameters, IShipmentParameter public List? CarrierAccountIds { get; set; } /// - /// A list of line items for the new . + /// A list of s for the new . /// [TopLevelRequestParameter(Necessity.Optional, "shipment", "line_items")] [NestedRequestParameter(typeof(Order.Create), Necessity.Optional, "line_items")] - public List? LineItems { get; set; } - - /// - /// Represents a line item for a shipment. - /// - public class LineItem - { - /// - /// The total value of the line item. - /// - public string? TotalLineValue { get; set; } - - /// - /// The description of the item. - /// - public string? ItemDescription { get; set; } - } + public List? LineItems { get; set; } #endregion }