diff --git a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/Messaging/Embedded.cs b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/Messaging/Embedded.cs new file mode 100644 index 00000000..3213b76b --- /dev/null +++ b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/Messaging/Embedded.cs @@ -0,0 +1,104 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using System.Text; + +namespace FikaAmazonAPI.AmazonSpApiSDK.Models.Messaging +{ + [DataContract] + public partial class Embedded : IEquatable, IValidatableObject + { + /// + /// Gets or Sets Embedded + /// + [DataMember(Name = "actions", EmitDefaultValue = false)] + public IList ActionList { get; set; } + + public Embedded() + { + this.ActionList = default(IList); + } + + public Embedded(IList actionList = default(IList)) + { + this.ActionList = actionList; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Embedded {\n"); + sb.Append(" actions: ").Append(ActionList).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Embedded); + } + + /// + /// Returns true if GetMessagingActionsForOrderResponse instances are equal + /// + /// Instance of GetMessagingActionsForOrderResponse to be compared + /// Boolean + public bool Equals(Embedded input) + { + if (input == null) + return false; + + return + ( + this.ActionList == input.ActionList || + (this.ActionList != null && + this.ActionList.Equals(input.ActionList)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActionList != null) + hashCode = hashCode * 59 + this.ActionList.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} diff --git a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/Messaging/GetMessagingActionsForOrderResponse.cs b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/Messaging/GetMessagingActionsForOrderResponse.cs index d5eb8547..d60b2c03 100644 --- a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/Messaging/GetMessagingActionsForOrderResponse.cs +++ b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/Messaging/GetMessagingActionsForOrderResponse.cs @@ -35,7 +35,7 @@ public partial class GetMessagingActionsForOrderResponse : IEquatablelinks. /// embedded. /// errors. - public GetMessagingActionsForOrderResponse(GetMessagingActionsForOrderResponseLinks links = default(GetMessagingActionsForOrderResponseLinks), IList embedded = default(IList)) + public GetMessagingActionsForOrderResponse(GetMessagingActionsForOrderResponseLinks links = default(GetMessagingActionsForOrderResponseLinks), Embedded embedded = default(Embedded)) { this.Links = links; this.Embedded = embedded; @@ -43,7 +43,7 @@ public partial class GetMessagingActionsForOrderResponse : IEquatable); + this.Embedded = default(Embedded); } /// @@ -56,7 +56,7 @@ public GetMessagingActionsForOrderResponse() /// Gets or Sets Embedded /// [DataMember(Name="_embedded", EmitDefaultValue=false)] - public IList Embedded { get; set; } + public Embedded Embedded { get; set; } /// /// Gets or Sets Errors diff --git a/Source/FikaAmazonAPI/Services/ApiUrls.cs b/Source/FikaAmazonAPI/Services/ApiUrls.cs index 69e9668f..e9929274 100644 --- a/Source/FikaAmazonAPI/Services/ApiUrls.cs +++ b/Source/FikaAmazonAPI/Services/ApiUrls.cs @@ -139,7 +139,7 @@ protected class MessaginApiUrls { private readonly static string _resourceBaseUrl = "/messaging/v1"; - public static string GetMessagingActionsForOrder(string amazonOrderId, string marketplaceIds) => $"{_resourceBaseUrl}/orders/{amazonOrderId}?marketplaceIds={marketplaceIds}"; + public static string GetMessagingActionsForOrder(string amazonOrderId) => $"{_resourceBaseUrl}/orders/{amazonOrderId}"; public static string ConfirmCustomizationDetails(string amazonOrderId) => $"{_resourceBaseUrl}/orders/{amazonOrderId}/messages/confirmCustomizationDetails"; public static string CreateConfirmDeliveryDetails(string amazonOrderId) => $"{_resourceBaseUrl}/orders/{amazonOrderId}/messages/confirmDeliveryDetails"; public static string CreateLegalDisclosure(string amazonOrderId) => $"{_resourceBaseUrl}/orders/{amazonOrderId}/messages/legalDisclosure"; @@ -328,7 +328,7 @@ public static string ListFinancialEventGroups public static string ListFinancialEventsByOrderId(string orderId) => $"{_resourceBaseUrl}/orders/{orderId}/financialEvents"; public static string ListFinancialEvents { - get => $"{_resourceBaseUrl}/listFinancialEvents"; + get => $"{_resourceBaseUrl}/financialEvents"; } } diff --git a/Source/FikaAmazonAPI/Services/FinancialService.cs b/Source/FikaAmazonAPI/Services/FinancialService.cs index 8a922f5c..98963e56 100644 --- a/Source/FikaAmazonAPI/Services/FinancialService.cs +++ b/Source/FikaAmazonAPI/Services/FinancialService.cs @@ -75,7 +75,7 @@ public IList ListFinancialEvents(ParameterListFinancialEvents p var parameter = parameterListFinancials.getParameters(); - CreateAuthorizedRequest(FinanceApiUrls.ListFinancialEventGroups, RestSharp.Method.GET, parameter); + CreateAuthorizedRequest(FinanceApiUrls.ListFinancialEvents, RestSharp.Method.GET, parameter); var response = ExecuteRequest(); list.Add(response.Payload.FinancialEvents); @@ -97,7 +97,7 @@ private ListFinancialEventsPayload GetFinancialEventsByNextToken(string nextToke queryParameters.Add(new KeyValuePair("NextToken", nextToken)); - CreateAuthorizedRequest(FinanceApiUrls.ListFinancialEventGroups, RestSharp.Method.GET, queryParameters); + CreateAuthorizedRequest(FinanceApiUrls.ListFinancialEvents, RestSharp.Method.GET, queryParameters); var response = ExecuteRequest(); return response.Payload; } diff --git a/Source/FikaAmazonAPI/Services/MessagingService.cs b/Source/FikaAmazonAPI/Services/MessagingService.cs index 9914d0ee..36e882de 100644 --- a/Source/FikaAmazonAPI/Services/MessagingService.cs +++ b/Source/FikaAmazonAPI/Services/MessagingService.cs @@ -15,7 +15,10 @@ public MessagingService(AmazonCredential amazonCredential) : base(amazonCredenti public GetMessagingActionsForOrderResponse GetMessagingActionsForOrder(string amazonOrderId) { - CreateAuthorizedRequest(MessaginApiUrls.GetMessagingActionsForOrder(amazonOrderId, MarketPlace.ID), RestSharp.Method.GET); + List> queryParameters = new List>(); + queryParameters.Add(new KeyValuePair("marketplaceIds", MarketPlace.ID)); + + CreateAuthorizedRequest(MessaginApiUrls.GetMessagingActionsForOrder(amazonOrderId), RestSharp.Method.GET, queryParameters); var response = ExecuteRequest(); @@ -27,7 +30,7 @@ public bool ConfirmCustomizationDetails(string amazonOrderId, CreateConfirmCusto List> queryParameters = new List>(); queryParameters.Add(new KeyValuePair("marketplaceIds", MarketPlace.ID)); - CreateAuthorizedRequest(MessaginApiUrls.ConfirmCustomizationDetails(amazonOrderId), RestSharp.Method.POST, queryParameters,postJsonObj: createConfirmCustomizationDetailsRequest); + CreateAuthorizedRequest(MessaginApiUrls.ConfirmCustomizationDetails(amazonOrderId), RestSharp.Method.POST, queryParameters, postJsonObj: createConfirmCustomizationDetailsRequest); var response = ExecuteRequest(); if (response != null) @@ -40,7 +43,7 @@ public bool CreateConfirmDeliveryDetails(string amazonOrderId, CreateConfirmCust List> queryParameters = new List>(); queryParameters.Add(new KeyValuePair("marketplaceIds", MarketPlace.ID)); - CreateAuthorizedRequest(MessaginApiUrls.CreateConfirmDeliveryDetails(amazonOrderId), RestSharp.Method.POST, queryParameters,postJsonObj: createConfirmCustomizationDetailsRequest); + CreateAuthorizedRequest(MessaginApiUrls.CreateConfirmDeliveryDetails(amazonOrderId), RestSharp.Method.POST, queryParameters, postJsonObj: createConfirmCustomizationDetailsRequest); var response = ExecuteRequest(); if (response != null) @@ -48,13 +51,13 @@ public bool CreateConfirmDeliveryDetails(string amazonOrderId, CreateConfirmCust return false; } - + public bool CreateLegalDisclosure(string amazonOrderId, CreateLegalDisclosureRequest createLegalDisclosureRequest) { List> queryParameters = new List>(); queryParameters.Add(new KeyValuePair("marketplaceIds", MarketPlace.ID)); - CreateAuthorizedRequest(MessaginApiUrls.CreateLegalDisclosure(amazonOrderId), RestSharp.Method.POST, queryParameters,postJsonObj: createLegalDisclosureRequest); + CreateAuthorizedRequest(MessaginApiUrls.CreateLegalDisclosure(amazonOrderId), RestSharp.Method.POST, queryParameters, postJsonObj: createLegalDisclosureRequest); var response = ExecuteRequest(); if (response != null) @@ -80,7 +83,7 @@ public bool CreateConfirmOrderDetails(string amazonOrderId, CreateConfirmOrderDe List> queryParameters = new List>(); queryParameters.Add(new KeyValuePair("marketplaceIds", MarketPlace.ID)); - CreateAuthorizedRequest(MessaginApiUrls.CreateConfirmOrderDetails(amazonOrderId), RestSharp.Method.POST, queryParameters,postJsonObj: createConfirmOrderDetailsRequest); + CreateAuthorizedRequest(MessaginApiUrls.CreateConfirmOrderDetails(amazonOrderId), RestSharp.Method.POST, queryParameters, postJsonObj: createConfirmOrderDetailsRequest); var response = ExecuteRequest(); if (response != null) @@ -93,7 +96,7 @@ public bool CreateConfirmServiceDetails(string amazonOrderId, CreateConfirmServi List> queryParameters = new List>(); queryParameters.Add(new KeyValuePair("marketplaceIds", MarketPlace.ID)); - CreateAuthorizedRequest(MessaginApiUrls.CreateConfirmServiceDetails(amazonOrderId), RestSharp.Method.POST, queryParameters,postJsonObj: createConfirmServiceDetailsRequest); + CreateAuthorizedRequest(MessaginApiUrls.CreateConfirmServiceDetails(amazonOrderId), RestSharp.Method.POST, queryParameters, postJsonObj: createConfirmServiceDetailsRequest); var response = ExecuteRequest(); if (response != null) @@ -105,7 +108,7 @@ public bool CreateAmazonMotors(string amazonOrderId, CreateAmazonMotorsRequest c { List> queryParameters = new List>(); queryParameters.Add(new KeyValuePair("marketplaceIds", MarketPlace.ID)); - CreateAuthorizedRequest(MessaginApiUrls.CreateAmazonMotors(amazonOrderId), RestSharp.Method.POST, queryParameters,postJsonObj: createAmazonMotorsRequest); + CreateAuthorizedRequest(MessaginApiUrls.CreateAmazonMotors(amazonOrderId), RestSharp.Method.POST, queryParameters, postJsonObj: createAmazonMotorsRequest); var response = ExecuteRequest(); if (response != null) @@ -116,7 +119,7 @@ public bool CreateWarranty(string amazonOrderId, CreateWarrantyRequest createWar { List> queryParameters = new List>(); queryParameters.Add(new KeyValuePair("marketplaceIds", MarketPlace.ID)); - CreateAuthorizedRequest(MessaginApiUrls.CreateWarranty(amazonOrderId), RestSharp.Method.POST, queryParameters,postJsonObj: createWarrantyRequest); + CreateAuthorizedRequest(MessaginApiUrls.CreateWarranty(amazonOrderId), RestSharp.Method.POST, queryParameters, postJsonObj: createWarrantyRequest); var response = ExecuteRequest(); if (response != null) @@ -139,7 +142,7 @@ public bool CreateDigitalAccessKey(string amazonOrderId, CreateDigitalAccessKeyR { List> queryParameters = new List>(); queryParameters.Add(new KeyValuePair("marketplaceIds", MarketPlace.ID)); - CreateAuthorizedRequest(MessaginApiUrls.CreateDigitalAccessKey(amazonOrderId), RestSharp.Method.POST, queryParameters,postJsonObj: createDigitalAccessKeyRequest); + CreateAuthorizedRequest(MessaginApiUrls.CreateDigitalAccessKey(amazonOrderId), RestSharp.Method.POST, queryParameters, postJsonObj: createDigitalAccessKeyRequest); var response = ExecuteRequest(); if (response != null) @@ -150,7 +153,7 @@ public bool CreateUnexpectedProblem(string amazonOrderId, CreateUnexpectedProble { List> queryParameters = new List>(); queryParameters.Add(new KeyValuePair("marketplaceIds", MarketPlace.ID)); - CreateAuthorizedRequest(MessaginApiUrls.CreateUnexpectedProblem(amazonOrderId), RestSharp.Method.POST, queryParameters,postJsonObj: createUnexpectedProblemRequest); + CreateAuthorizedRequest(MessaginApiUrls.CreateUnexpectedProblem(amazonOrderId), RestSharp.Method.POST, queryParameters, postJsonObj: createUnexpectedProblemRequest); var response = ExecuteRequest(); if (response != null) @@ -159,6 +162,6 @@ public bool CreateUnexpectedProblem(string amazonOrderId, CreateUnexpectedProble } - + } }