Skip to content

Commit fbdfd81

Browse files
committed
sample
1 parent 29f5658 commit fbdfd81

File tree

1 file changed

+97
-7
lines changed

1 file changed

+97
-7
lines changed

Source/FikaAmazonAPI.SampleCode/Program.cs

Lines changed: 97 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using FikaAmazonAPI.Parameter.Order;
1+
using FikaAmazonAPI.Parameter.ListingItem;
22
using Microsoft.Extensions.Configuration;
33
using static FikaAmazonAPI.Utils.Constants;
44

@@ -24,19 +24,109 @@ static async Task Main(string[] args)
2424
ClientSecret = config.GetSection("FikaAmazonAPI:ClientSecret").Value,
2525
RefreshToken = config.GetSection("FikaAmazonAPI:RefreshToken").Value,
2626
MarketPlaceID = config.GetSection("FikaAmazonAPI:MarketPlaceID").Value,
27+
SellerID = config.GetSection("FikaAmazonAPI:SellerId").Value,
2728
IsDebugMode = true
2829
});
2930

31+
var search = amazonConnection.ProductType.SearchDefinitionsProductTypes(new Parameter.ProductTypes.SearchDefinitionsProductTypesParameter
32+
{
33+
keywords = new[] { "pet" }
34+
});
35+
36+
var def = amazonConnection.ProductType.GetDefinitionsProductType(
37+
new Parameter.ProductTypes.GetDefinitionsProductTypeParameter()
38+
{
39+
productType = search.ProductTypes?.FirstOrDefault()?.Name ?? "",
40+
locale = AmazonSpApiSDK.Models.ProductTypes.LocaleEnum.en_US,
41+
42+
});
43+
44+
45+
var x = amazonConnection.CatalogItem.GetCatalogItem202204(new FikaAmazonAPI.Parameter.CatalogItems.ParameterGetCatalogItem()
46+
{
47+
ASIN = "B01I3JW7PK",
48+
includedData = new List<IncludedData> {
49+
IncludedData.summaries,
50+
IncludedData.identifiers,
51+
IncludedData.summaries,
52+
IncludedData.productTypes,
53+
IncludedData.dimensions,
54+
IncludedData.images,
55+
IncludedData.relationships,
56+
IncludedData.attributes//,
57+
58+
}
59+
});
60+
x.Attributes.Remove("street_date");
61+
x.Attributes.Add("storage_instructions", new[] { new {
62+
value="not applicable"//, unit="Hertz"
63+
64+
}});
65+
x.Attributes.Add("number_of_boxes", new[] { new {
66+
value=1//, unit="Hertz"
67+
68+
}});
3069

31-
ParameterOrderList serachOrderList = new ParameterOrderList();
32-
serachOrderList.CreatedAfter = DateTime.UtcNow.AddMinutes(-6000);
70+
x.Attributes.Add("country_of_origin", new[] { new {
71+
value= "UK"//, unit="Hertz"
3372

34-
serachOrderList.OrderStatuses = new List<OrderStatuses>();
35-
serachOrderList.OrderStatuses.Add(OrderStatuses.Shipped);
73+
}});
3674

37-
serachOrderList.AmazonOrderIds = new List<string>();
75+
x.Attributes.Add("use_by_recommendation", new[] { new {
76+
value= "not applicable"//, unit="Hertz"
3877

39-
var orders = amazonConnection.Orders.GetOrders(serachOrderList);
78+
}});
79+
80+
x.Attributes.Add("product_description", new[] { new {
81+
value= ""//, unit="Hertz"
82+
83+
}});
84+
x.Attributes.Add("purchasable_offer", new object[] {
85+
new{
86+
currency= amazonConnection.GetCurrentMarketplace.CurrencyCode,
87+
our_price=new []
88+
{ new{
89+
schedule =new[]
90+
{ new {
91+
value_with_tax= 59.99M
92+
}
93+
}}
94+
}
95+
}
96+
});
97+
98+
x.Attributes.Add("fulfillment_availability",
99+
new object[] { new { fulfillment_channel_code = "DEFAULT",
100+
quantity = 10 } });
101+
//x.Attributes["vat_level"] = new[] { new {
102+
// value ="registration_not_required"//, unit="Hertz"
103+
104+
// }};
105+
x.Attributes.Add("condition_type", new[] { new {
106+
value= "new_new"//, unit="Hertz"
107+
108+
}});
109+
x.Attributes.Remove("variation_theme");
110+
x.Attributes.Remove("generic_keyword"); x.Attributes.Remove("vat_level");
111+
112+
113+
114+
// var r = new object[] { new{ value = DateTime.Now } };
115+
// x.Attributes.Add("street_date", System.Text.Json.JsonSerializer.Serialize( new[] { new { value = DateTime.Now } }));//= System.Text.Json.JsonSerializer.Serialize(r);
116+
var putrequest = new ListingsItemPutRequest()
117+
{
118+
attributes = x.Attributes,
119+
productType = def.ProductType,
120+
requirements = Requirements.LISTING
121+
};
122+
123+
var y = amazonConnection.ListingsItem.PutListingsItem(
124+
new ParameterPutListingItem()
125+
{
126+
listingsItemPutRequest = putrequest,
127+
sku = "71683-001",
128+
sellerId = amazonConnection.GetCurrentSellerID
129+
});
40130

41131

42132

0 commit comments

Comments
 (0)