diff --git a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/Event.cs b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/Event.cs
index 94fd52d7..730e28e9 100644
--- a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/Event.cs
+++ b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/Event.cs
@@ -4,25 +4,28 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
+using System.ComponentModel.DataAnnotations;
-namespace FikaAmazonAPI.AmazonSpApiSDK.Models.ShippingV2 {
+namespace FikaAmazonAPI.AmazonSpApiSDK.Models.ShippingV2
+{
///
/// A tracking event.
///
[DataContract]
- public class Event {
+ public partial class Event : IEquatable, IValidatableObject
+ {
///
/// Gets or Sets EventCode
///
- [DataMember(Name="eventCode", EmitDefaultValue=false)]
+ [DataMember(Name = "eventCode", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "eventCode")]
- public EventCode EventCode { get; set; }
+ public EventCode? EventCode { get; set; }
///
/// Gets or Sets Location
///
- [DataMember(Name="location", EmitDefaultValue=false)]
+ [DataMember(Name = "location", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "location")]
public Location Location { get; set; }
@@ -30,32 +33,116 @@ public class Event {
/// The ISO 8601 formatted timestamp of the event.
///
/// The ISO 8601 formatted timestamp of the event.
- [DataMember(Name="eventTime", EmitDefaultValue=false)]
+ [DataMember(Name = "eventTime", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "eventTime")]
public DateTime? EventTime { get; set; }
+ ///
+ /// Gets or Sets ShipmentType
+ ///
+ [DataMember(Name = "shipmentType", EmitDefaultValue = false)]
+ [JsonProperty(PropertyName = "shipmentType", NullValueHandling = NullValueHandling.Ignore)]
+ public ShipmentType? ShipmentType { get; set; }
+
///
- /// Get the string presentation of the object
+ /// Returns the string presentation of the object
///
/// String presentation of the object
- public override string ToString() {
+ public override string ToString()
+ {
var sb = new StringBuilder();
sb.Append("class Event {\n");
sb.Append(" EventCode: ").Append(EventCode).Append("\n");
sb.Append(" Location: ").Append(Location).Append("\n");
sb.Append(" EventTime: ").Append(EventTime).Append("\n");
+ sb.Append(" ShipmentType: ").Append(ShipmentType).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
+ ///
+ /// Returns true if objects are equal
+ ///
+ /// Object to be compared
+ /// Boolean
+ public override bool Equals(object input)
+ {
+ return this.Equals(input as Event);
+ }
+
+ ///
+ /// Returns true if ModelEvent instances are equal
+ ///
+ /// Instance of ModelEvent to be compared
+ /// Boolean
+ public bool Equals(Event input)
+ {
+ if (input == null)
+ return false;
+
+ return
+ (
+ this.EventCode == input.EventCode ||
+ (this.EventCode != null &&
+ this.EventCode.Equals(input.EventCode))
+ ) &&
+ (
+ this.Location == input.Location ||
+ (this.Location != null &&
+ this.Location.Equals(input.Location))
+ ) &&
+ (
+ this.EventTime == input.EventTime ||
+ (this.EventTime != null &&
+ this.EventTime.Equals(input.EventTime))
+ ) &&
+ (
+ this.ShipmentType == input.ShipmentType ||
+ (this.ShipmentType != null &&
+ this.ShipmentType.Equals(input.ShipmentType))
+ );
+ }
+
+ ///
+ /// Gets the hash code
+ ///
+ /// Hash code
+ public override int GetHashCode()
+ {
+ unchecked // Overflow is fine, just wrap
+ {
+ int hashCode = 41;
+ if (this.EventCode != null)
+ hashCode = hashCode * 59 + this.EventCode.GetHashCode();
+ if (this.Location != null)
+ hashCode = hashCode * 59 + this.Location.GetHashCode();
+ if (this.EventTime != null)
+ hashCode = hashCode * 59 + this.EventTime.GetHashCode();
+ if (this.ShipmentType != null)
+ hashCode = hashCode * 59 + this.ShipmentType.GetHashCode();
+ return hashCode;
+ }
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+
///
/// Get the JSON string presentation of the object
///
/// JSON string presentation of the object
- public string ToJson() {
+ public string ToJson()
+ {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
-}
+ }
}
diff --git a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/EventCode.cs b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/EventCode.cs
index 0a5e47c9..ba35e60c 100644
--- a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/EventCode.cs
+++ b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/EventCode.cs
@@ -4,33 +4,98 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
-namespace FikaAmazonAPI.AmazonSpApiSDK.Models.ShippingV2 {
+namespace FikaAmazonAPI.AmazonSpApiSDK.Models.ShippingV2
+{
///
/// The tracking event type.
///
[DataContract]
- public class EventCode {
+ ///
+ /// The tracking event type.
+ ///
+ /// The tracking event type.
+ [JsonConverter(typeof(StringEnumConverter))]
+ public enum EventCode
+ {
///
- /// Get the string presentation of the object
+ /// Enum ReadyForReceive for value: ReadyForReceive
///
- /// String presentation of the object
- public override string ToString() {
- var sb = new StringBuilder();
- sb.Append("class EventCode {\n");
- sb.Append("}\n");
- return sb.ToString();
- }
-
+ [EnumMember(Value = "ReadyForReceive")]
+ ReadyForReceive = 1,
+ ///
+ /// Enum PickupDone for value: PickupDone
+ ///
+ [EnumMember(Value = "PickupDone")]
+ PickupDone = 2,
+ ///
+ /// Enum Delivered for value: Delivered
+ ///
+ [EnumMember(Value = "Delivered")]
+ Delivered = 3,
+ ///
+ /// Enum Departed for value: Departed
+ ///
+ [EnumMember(Value = "Departed")]
+ Departed = 4,
+ ///
+ /// Enum DeliveryAttempted for value: DeliveryAttempted
+ ///
+ [EnumMember(Value = "DeliveryAttempted")]
+ DeliveryAttempted = 5,
+ ///
+ /// Enum Lost for value: Lost
+ ///
+ [EnumMember(Value = "Lost")]
+ Lost = 6,
+ ///
+ /// Enum OutForDelivery for value: OutForDelivery
+ ///
+ [EnumMember(Value = "OutForDelivery")]
+ OutForDelivery = 7,
+ ///
+ /// Enum ArrivedAtCarrierFacility for value: ArrivedAtCarrierFacility
+ ///
+ [EnumMember(Value = "ArrivedAtCarrierFacility")]
+ ArrivedAtCarrierFacility = 8,
+ ///
+ /// Enum Rejected for value: Rejected
+ ///
+ [EnumMember(Value = "Rejected")]
+ Rejected = 9,
+ ///
+ /// Enum Undeliverable for value: Undeliverable
+ ///
+ [EnumMember(Value = "Undeliverable")]
+ Undeliverable = 10,
+ ///
+ /// Enum PickupCancelled for value: PickupCancelled
+ ///
+ [EnumMember(Value = "PickupCancelled")]
+ PickupCancelled = 11,
+ ///
+ /// Enum ReturnInitiated for value: ReturnInitiated
+ ///
+ [EnumMember(Value = "ReturnInitiated")]
+ ReturnInitiated = 12,
+ ///
+ /// Enum AvailableForPickup for value: AvailableForPickup
+ ///
+ [EnumMember(Value = "AvailableForPickup")]
+ AvailableForPickup = 13,
+ ///
+ /// Enum RecipientRequestedAlternateDeliveryTiming for value: RecipientRequestedAlternateDeliveryTiming
+ ///
+ [EnumMember(Value = "RecipientRequestedAlternateDeliveryTiming")]
+ RecipientRequestedAlternateDeliveryTiming = 14,
///
- /// Get the JSON string presentation of the object
+ /// Enum PackageReceivedByCarrier for value: PackageReceivedByCarrier
///
- /// JSON string presentation of the object
- public string ToJson() {
- return JsonConvert.SerializeObject(this, Formatting.Indented);
- }
+ [EnumMember(Value = "PackageReceivedByCarrier")]
+ PackageReceivedByCarrier = 15
+ }
-}
-}
+}
\ No newline at end of file
diff --git a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/ShipmentType.cs b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/ShipmentType.cs
new file mode 100644
index 00000000..00eb4bcd
--- /dev/null
+++ b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/ShipmentType.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Text;
+using System.Collections;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+
+namespace FikaAmazonAPI.AmazonSpApiSDK.Models.ShippingV2 {
+
+ ///
+ /// Shipment type.
+ ///
+ /// Shipment type.
+ [JsonConverter(typeof(StringEnumConverter))]
+ public enum ShipmentType
+ {
+
+ [EnumMember(Value = "FORWARD")]
+ FORWARD = 1,
+
+ [EnumMember(Value = "RETURNS")]
+ RETURNS = 2
+ }
+
+}
+
diff --git a/Source/FikaAmazonAPI/Services/ShippingServiceV2.cs b/Source/FikaAmazonAPI/Services/ShippingServiceV2.cs
index 84ea20bc..eacd3cea 100644
--- a/Source/FikaAmazonAPI/Services/ShippingServiceV2.cs
+++ b/Source/FikaAmazonAPI/Services/ShippingServiceV2.cs
@@ -68,5 +68,16 @@ public async Task GetTrackingAsync(string carrierId, string t
return response.Payload;
return null;
}
+
+ public GetShipmentDocumentsResult GetShipmentDocuments(string shipmentId, string packageClientReferenceId, string format) =>
+ Task.Run(() => GetShipmentDocumentsAsync(shipmentId, packageClientReferenceId, format)).ConfigureAwait(false).GetAwaiter().GetResult();
+ public async Task GetShipmentDocumentsAsync(string shipmentId, string packageClientReferenceId, string format, CancellationToken cancellationToken = default)
+ {
+ await CreateAuthorizedRequestAsync(ShippingApiV2Urls.GetShipmentDocuments(shipmentId, packageClientReferenceId, format), RestSharp.Method.Get, cancellationToken: cancellationToken);
+ var response = await ExecuteRequestAsync(RateLimitType.ShippingV2_GetShipmentDocument, cancellationToken);
+ if (response != null && response.Payload != null)
+ return response.Payload;
+ return null;
+ }
}
}