Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions EasyPost/Models/API/LineItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using EasyPost._base;
using Newtonsoft.Json;

namespace EasyPost.Models.API
{
/// <summary>
/// Class representing line items of a <a href="https://docs.easypost.com/docs/shipments">Shipment</a>.
/// </summary>
public class LineItem : EasyPostObject, Parameters.ILineItemParameter
{
#region JSON Properties

/// <summary>
/// The total value of the line item.
/// </summary>
[JsonProperty("total_line_value")]
public string? TotalLineValue { get; set; }

/// <summary>
/// The description of the item.
/// </summary>
[JsonProperty("item_description")]
public string? ItemDescription { get; set; }

#endregion
}
}
6 changes: 6 additions & 0 deletions EasyPost/Models/API/Shipment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ public class Shipment : EasyPostObject, Parameters.IShipmentParameter
[JsonProperty("is_return")]
public bool? IsReturn { get; set; }

/// <summary>
/// A list of <see cref="LineItem"/>s associated with the shipment.
/// </summary>
[JsonProperty("line_items")]
public List<LineItem>? LineItems { get; set; }

/// <summary>
/// A list of any carrier errors that occurred during rating or purchasing.
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions EasyPost/Parameters/IParameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ public interface IInsuranceParameter : IParameter
{
}

/// <summary>
/// An interface marking that an instance of the implementing class can be used as a line item parameter in a Parameters object.
/// </summary>
public interface ILineItemParameter : IParameter
{
}

/// <summary>
/// An interface marking that an instance of the implementing class can be used as an order parameter in a Parameters object.
/// </summary>
Expand Down
20 changes: 2 additions & 18 deletions EasyPost/Parameters/Shipment/Create.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,27 +155,11 @@ public class Create : BaseParameters<Models.API.Shipment>, IShipmentParameter
public List<string>? CarrierAccountIds { get; set; }

/// <summary>
/// A list of line items for the new <see cref="Models.API.Shipment"/>.
/// A list of <see cref="Models.API.LineItem"/>s for the new <see cref="Models.API.Shipment"/>.
/// </summary>
[TopLevelRequestParameter(Necessity.Optional, "shipment", "line_items")]
[NestedRequestParameter(typeof(Order.Create), Necessity.Optional, "line_items")]
public List<LineItem>? LineItems { get; set; }

/// <summary>
/// Represents a line item for a shipment.
/// </summary>
public class LineItem
{
/// <summary>
/// The total value of the line item.
/// </summary>
public string? TotalLineValue { get; set; }

/// <summary>
/// The description of the item.
/// </summary>
public string? ItemDescription { get; set; }
}
public List<ILineItemParameter>? LineItems { get; set; }

#endregion
}
Expand Down
Loading