Skip to content

Commit 089d81a

Browse files
committed
fix deprecated method
1 parent eb0f3ca commit 089d81a

File tree

2 files changed

+58
-16
lines changed

2 files changed

+58
-16
lines changed
Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
using FikaAmazonAPI.Utils;
2-
using System;
3-
using System.Collections.Generic;
4-
using System.Linq;
5-
using System.Text;
6-
using System.Threading.Tasks;
2+
using static FikaAmazonAPI.Utils.Constants;
73

84
namespace FikaAmazonAPI.SampleCode
95
{
@@ -15,19 +11,20 @@ public CatalogItemsSample(AmazonConnection amazonConnection)
1511
this.amazonConnection = amazonConnection;
1612
}
1713

18-
19-
public void GetCatalogItem()
14+
[Obsolete("This method deprecated in June 2022. Please use GetCatalogItem(ParameterGetCatalogItem parameterListCatalogItem) instead.", true)]
15+
public void GetCatalogItemAsync()
2016
{
2117
var item = amazonConnection.CatalogItem.GetCatalogItem("B00CZC5F0G");
2218

2319
}
24-
20+
2521
public void ListCatalogCategories()
2622
{
2723
var item = amazonConnection.CatalogItem.ListCatalogCategories("B00CZC5F0G");
2824

2925
}
3026

27+
[Obsolete("This method deprecated in June 2022. Please use SearchCatalogItems202204 instead.", true)]
3128
public void ListCatalogItems()
3229
{
3330
var items = amazonConnection.CatalogItem.ListCatalogItems(new Parameter.CatalogItems.ParameterListCatalogItems()
@@ -36,5 +33,39 @@ public void ListCatalogItems()
3633
Query = "740985280133"
3734
});
3835
}
36+
37+
public async Task GetCatalogItem()
38+
{
39+
var data = await amazonConnection.CatalogItem.GetCatalogItem202204Async(
40+
new Parameter.CatalogItems.ParameterGetCatalogItem
41+
{
42+
ASIN = "B00JK2YANC",
43+
includedData = new[] { IncludedData.attributes,
44+
IncludedData.salesRanks,
45+
IncludedData.summaries,
46+
IncludedData.productTypes,
47+
IncludedData.relationships,
48+
IncludedData.dimensions,
49+
IncludedData.identifiers,
50+
IncludedData.images }
51+
});
52+
}
53+
54+
public async Task SearchCatalogItems()
55+
{
56+
var data = await amazonConnection.CatalogItem.SearchCatalogItems202204Async(
57+
new Parameter.CatalogItems.ParameterSearchCatalogItems202204
58+
{
59+
keywords = new[] { "vitamin c" },
60+
includedData = new[] { IncludedData.attributes,
61+
IncludedData.salesRanks,
62+
IncludedData.summaries,
63+
IncludedData.productTypes,
64+
IncludedData.relationships,
65+
IncludedData.dimensions,
66+
IncludedData.identifiers,
67+
IncludedData.images }
68+
});
69+
}
3970
}
4071
}

Source/FikaAmazonAPI.SampleCode/Program.cs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,24 @@ static async Task Main(string[] args)
3838
MarketPlace = MarketPlace.GetMarketPlaceByID(config.GetSection("FikaAmazonAPI:MarketPlaceID").Value),
3939
});
4040

41+
42+
var data22 = await amazonConnection.CatalogItem.SearchCatalogItems202204Async(
43+
new Parameter.CatalogItems.ParameterSearchCatalogItems202204
44+
{
45+
keywords = new[] { "vitamin c" },
46+
47+
includedData = new[] { IncludedData.attributes,
48+
IncludedData.salesRanks,
49+
IncludedData.summaries,
50+
IncludedData.productTypes,
51+
IncludedData.relationships,
52+
IncludedData.dimensions,
53+
IncludedData.identifiers,
54+
IncludedData.images }
55+
});
56+
57+
58+
4159
ReportManager reportManageree = new ReportManager(amazonConnection);
4260
var productsttt = reportManageree.GetProducts(); //GET_MERCHANT_LISTINGS_ALL_DATA
4361

@@ -119,14 +137,7 @@ static async Task Main(string[] args)
119137

120138

121139

122-
for (int i = 0; i < 100; i++)
123-
{
124-
var plci = new FikaAmazonAPI.Parameter.CatalogItems.ParameterListCatalogItems();
125-
plci.UPC = "079325772114";
126-
plci.MarketplaceId = FikaAmazonAPI.Utils.MarketPlace.UnitedArabEmirates.ID;
127140

128-
var response22 = amazonConnection.CatalogItem.ListCatalogItems(plci);
129-
}
130141

131142

132143

@@ -280,7 +291,7 @@ static async Task Main(string[] args)
280291
});
281292

282293

283-
var item = amazonConnection.CatalogItem.GetCatalogItem("B00CZC5F0G");
294+
284295

285296

286297

0 commit comments

Comments
 (0)