Skip to content

Commit 13e5c11

Browse files
committed
2 parents fd7a3aa + 640f298 commit 13e5c11

16 files changed

+414
-10
lines changed

Source/FikaAmazonAPI.SampleCode/ProductPricingSample.cs

Lines changed: 70 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using FikaAmazonAPI.Utils;
1+
using FikaAmazonAPI.Parameter.ProductPricing;
2+
using FikaAmazonAPI.Utils;
23
using System;
34
using System.Collections.Generic;
45
using System.Linq;
@@ -25,7 +26,7 @@ public void GetPricing()
2526
});
2627
}
2728

28-
29+
2930
public void GetCompetitivePricing()
3031
{
3132
var data = amazonConnection.ProductPricing.GetCompetitivePricing(new Parameter.ProductPricing.ParameterGetCompetitivePricing()
@@ -36,7 +37,7 @@ public void GetCompetitivePricing()
3637
});
3738
}
3839

39-
40+
4041
public void GetListingOffers()
4142
{
4243
var data = amazonConnection.ProductPricing.GetListingOffers(new Parameter.ProductPricing.ParameterGetListingOffers()
@@ -48,15 +49,78 @@ public void GetListingOffers()
4849
}
4950

5051

51-
52+
5253
public void GetItemOffers()
5354
{
5455
var data = amazonConnection.ProductPricing.GetItemOffers(new Parameter.ProductPricing.ParameterGetItemOffers()
5556
{
5657
ItemCondition = ItemCondition.New,
57-
MarketplaceId = MarketPlace.UnitedArabEmirates.ID,
58-
Asin = "B07K13XL4Y"
58+
MarketplaceId = MarketPlace.UnitedKingdom.ID,
59+
Asin = "B00CZC5F0G"
60+
});
61+
}
62+
63+
public async Task GetItemOffersBatch()
64+
{
65+
var data = await amazonConnection.ProductPricing.GetItemOffersBatchAsync(new Parameter.ProductPricing.ParameterGetItemOffersBatchRequest
66+
{
67+
ParameterGetItemOffers = new List<Parameter.ProductPricing.ItemOffersRequest>
68+
{
69+
new ItemOffersRequest{
70+
HttpMethod = HttpMethodEnum.GET,
71+
QueryParams = new ParameterGetItemOffers{
72+
Asin = "XXXXXX",
73+
CustomerType = CustomerType.Consumer,
74+
ItemCondition = ItemCondition.New,
75+
MarketplaceId = MarketPlace.UnitedKingdom.ID,
76+
}
77+
},
78+
new ItemOffersRequest{
79+
HttpMethod = HttpMethodEnum.GET,
80+
QueryParams = new ParameterGetItemOffers{
81+
Asin = "XXXXXXX",
82+
CustomerType = CustomerType.Consumer,
83+
ItemCondition = ItemCondition.New,
84+
MarketplaceId = MarketPlace.UnitedKingdom.ID,
85+
}
86+
}
87+
}
5988
});
89+
90+
;
91+
92+
}
93+
94+
95+
public async Task GetListingOffersBatch()
96+
{
97+
var data = await amazonConnection.ProductPricing.GetListingOffersBatchAsync(new Parameter.ProductPricing.ParameterGetListingOffersBatchRequest
98+
{
99+
ParameterGetListingOffers = new List<Parameter.ProductPricing.ListingOffersRequest>
100+
{
101+
new ListingOffersRequest{
102+
HttpMethod = HttpMethodEnum.GET,
103+
QueryParams = new ParameterGetListingOffers{
104+
SellerSKU = "SellerSKU_01",
105+
CustomerType = CustomerType.Consumer,
106+
ItemCondition = ItemCondition.New,
107+
MarketplaceId = MarketPlace.UnitedKingdom.ID,
108+
}
109+
},
110+
new ListingOffersRequest{
111+
HttpMethod = HttpMethodEnum.GET,
112+
QueryParams = new ParameterGetListingOffers{
113+
SellerSKU = "SellerSKU_02",
114+
CustomerType = CustomerType.Consumer,
115+
ItemCondition = ItemCondition.New,
116+
MarketplaceId = MarketPlace.UnitedKingdom.ID,
117+
}
118+
}
119+
}
120+
});
121+
122+
;
123+
60124
}
61125
}
62126
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using Newtonsoft.Json;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.ComponentModel.DataAnnotations;
5+
using System.Runtime.Serialization;
6+
using System.Text;
7+
8+
namespace FikaAmazonAPI.AmazonSpApiSDK.Models.ProductPricing
9+
{
10+
public class GetBatchOffersResponse
11+
{
12+
13+
[DataMember(Name = "responses", EmitDefaultValue = false)]
14+
public ItemOffersResponse[] Responses { get; set; }
15+
16+
}
17+
18+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using Newtonsoft.Json;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Runtime.Serialization;
5+
using System.Text;
6+
7+
namespace FikaAmazonAPI.AmazonSpApiSDK.Models.ProductPricing
8+
{
9+
/// <summary>
10+
/// The HTTP status line associated with the response. For more information, consult RFC 2616.
11+
/// </summary>
12+
[DataContract]
13+
public class GetOffersHttpStatusLine
14+
{
15+
/// <summary>
16+
/// The HTTP response Status Code.
17+
/// Minimum value : 100
18+
/// Maximum value : 599
19+
/// </summary>
20+
[DataMember(Name = "statusCode", EmitDefaultValue = false)]
21+
public int StatusCode { get; set; }
22+
23+
/// <summary>
24+
/// The HTTP response Reason-Phase.
25+
/// </summary>
26+
[DataMember(Name = "reasonPhrase", EmitDefaultValue = false)]
27+
public string ReasonPhrase { get; set; }
28+
}
29+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace FikaAmazonAPI.AmazonSpApiSDK.Models.ProductPricing
6+
{
7+
public class HttpResponseHeaders : Dictionary<string, string>
8+
{
9+
}
10+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using Newtonsoft.Json;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.ComponentModel.DataAnnotations;
5+
using System.Runtime.Serialization;
6+
using System.Text;
7+
8+
namespace FikaAmazonAPI.AmazonSpApiSDK.Models.ProductPricing
9+
{
10+
[DataContract]
11+
public class ItemOffersResponse
12+
{
13+
/// <summary>
14+
/// A mapping of additional HTTP headers to send/receive for the individual batch request.
15+
/// </summary>
16+
[DataMember(Name = "headers", EmitDefaultValue = false)]
17+
public HttpResponseHeaders Headers { get; set; }
18+
19+
/// <summary>
20+
/// The HTTP status line associated with the response.For more information, consult RFC 2616.
21+
/// </summary>
22+
[DataMember(Name = "status", EmitDefaultValue = false)]
23+
public GetOffersHttpStatusLine Status { get; set; }
24+
25+
/// <summary>
26+
/// The response schema for the getListingOffers and getItemOffers operations.
27+
/// </summary>
28+
[DataMember(Name = "body", EmitDefaultValue = false)]
29+
public GetOffersResponse Body { get; set; }
30+
}
31+
}

Source/FikaAmazonAPI/Parameter/ParameterBased.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ namespace FikaAmazonAPI.Search
1212
public class ParameterBased
1313
{
1414
[IgnoreToAddParameter]
15+
[JsonIgnore]
1516
public string TestCase { get; set; }
1617

1718
[IgnoreToAddParameter]
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using Newtonsoft.Json;
2+
using Newtonsoft.Json.Converters;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Runtime.Serialization;
6+
using System.Text;
7+
8+
namespace FikaAmazonAPI.Parameter.ProductPricing
9+
{
10+
[JsonConverter(typeof(StringEnumConverter))]
11+
public enum HttpMethodEnum
12+
{
13+
/// <summary>
14+
/// GET
15+
/// </summary>
16+
[EnumMember(Value = "GET")]
17+
GET,
18+
19+
/// <summary>
20+
/// PUT
21+
/// </summary>
22+
[EnumMember(Value = "PUT")]
23+
PUT,
24+
25+
/// <summary>
26+
/// PATCH
27+
/// </summary>
28+
[EnumMember(Value = "PATCH")]
29+
PATCH,
30+
31+
/// <summary>
32+
/// DELETE
33+
/// </summary>
34+
[EnumMember(Value = "DELETE")]
35+
DELETE,
36+
37+
/// <summary>
38+
/// POST
39+
/// </summary>
40+
[EnumMember(Value = "POST")]
41+
POST,
42+
}
43+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using Newtonsoft.Json;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Runtime.Serialization;
5+
using System.Text;
6+
using static FikaAmazonAPI.AmazonSpApiSDK.Services.ApiUrls;
7+
using static FikaAmazonAPI.Utils.Constants;
8+
9+
namespace FikaAmazonAPI.Parameter.ProductPricing
10+
{
11+
public class ItemOffersRequest
12+
{
13+
/// <summary>
14+
/// The full URI corresponding to the API intended for request, including path parameter substitutions.
15+
/// </summary>
16+
[JsonProperty("uri")]
17+
public string Uri
18+
{
19+
get
20+
{
21+
return ProductPricingApiUrls.GetItemOffers(this.QueryParams.Asin);
22+
}
23+
}
24+
25+
/// <summary>
26+
/// The HTTP method associated with the individual APIs being called as part of the batch request.
27+
/// </summary>
28+
[JsonProperty("method")]
29+
public HttpMethodEnum HttpMethod { get; set; }
30+
31+
//[JsonProperty("headers")]
32+
//public Dictionary<string, string> Headers { get; set; }
33+
34+
[JsonProperty("queryParams")]
35+
public ParameterGetItemOffers QueryParams { get; set; }
36+
37+
///// <summary>
38+
///// A marketplace identifier. Specifies the marketplace for which prices are returned.
39+
///// </summary>
40+
//[DataMember(Name = "MarketplaceId")]
41+
//public string MarketplaceId { get; set; }
42+
43+
//[DataMember(Name = "ItemCondition")]
44+
//public ItemCondition ItemCondition { get; set; }
45+
46+
//[DataMember(Name = "CustomerType")]
47+
//public CustomerType? CustomerType { get; set; }
48+
49+
//[JsonIgnore]
50+
//public string Asin { get; set; }
51+
}
52+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using Newtonsoft.Json;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Runtime.Serialization;
5+
using System.Text;
6+
using static FikaAmazonAPI.AmazonSpApiSDK.Services.ApiUrls;
7+
using static FikaAmazonAPI.Utils.Constants;
8+
9+
namespace FikaAmazonAPI.Parameter.ProductPricing
10+
{
11+
public class ListingOffersRequest
12+
{
13+
/// <summary>
14+
/// The full URI corresponding to the API intended for request, including path parameter substitutions.
15+
/// </summary>
16+
[JsonProperty("uri")]
17+
public string Uri
18+
{
19+
get
20+
{
21+
return ProductPricingApiUrls.GetListingOffers(this.QueryParams.SellerSKU);
22+
}
23+
}
24+
25+
/// <summary>
26+
/// The HTTP method associated with the individual APIs being called as part of the batch request.
27+
/// </summary>
28+
[JsonProperty("method")]
29+
public HttpMethodEnum HttpMethod { get; set; }
30+
31+
//[JsonProperty("headers")]
32+
//public Dictionary<string, string> Headers { get; set; }
33+
34+
[JsonProperty("queryParams")]
35+
public ParameterGetListingOffers QueryParams { get; set; }
36+
}
37+
}

Source/FikaAmazonAPI/Parameter/ProductPricing/ParameterGetItemOffers.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
using FikaAmazonAPI.Search;
2+
using Newtonsoft.Json;
23
using static FikaAmazonAPI.Utils.Constants;
34

45
namespace FikaAmazonAPI.Parameter.ProductPricing
56
{
67
public class ParameterGetItemOffers : ParameterBased
78
{
89
public string MarketplaceId { get; set; }
10+
11+
[JsonIgnore]
912
public string Asin { get; set; }
13+
14+
//[JsonIgnore]
1015
public CustomerType? CustomerType { get; set; }
1116
public ItemCondition ItemCondition { get; set; }
1217
}

0 commit comments

Comments
 (0)