Skip to content

Commit 4656687

Browse files
committed
add environment
1 parent 48ac0f6 commit 4656687

File tree

6 files changed

+27
-29
lines changed

6 files changed

+27
-29
lines changed

Source/FikaAmazonAPI.Sample/CatalogItemsSample.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ public CatalogItemsSample(AmazonConnection amazonConnection)
1818

1919
public void GetCatalogItem()
2020
{
21-
var item = amazonConnection.CatalogItem.GetCatalogItem(MarketPlace.UnitedArabEmirates.ID, "B00CZC5F0G");
21+
var item = amazonConnection.CatalogItem.GetCatalogItem("B00CZC5F0G");
2222

2323
}
2424

2525
public void ListCatalogCategories()
2626
{
27-
var item = amazonConnection.CatalogItem.ListCatalogCategories(MarketPlace.UnitedArabEmirates.ID, "B00CZC5F0G");
27+
var item = amazonConnection.CatalogItem.ListCatalogCategories("B00CZC5F0G");
2828

2929
}
3030

Source/FikaAmazonAPI.Sample/Program.cs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,25 @@ static async Task Main(string[] args)
3939
ClientSecret = Environment.GetEnvironmentVariable("ClientSecret"),
4040
RefreshToken = Environment.GetEnvironmentVariable("RefreshToken"),
4141
MarketPlace = MarketPlace.UnitedArabEmirates,
42-
IsActiveLimitRate = true,
43-
Environment = Environments.Production
42+
IsActiveLimitRate = true
4443

4544
}) ;
4645

4746

48-
var data4 = amazonConnection.ProductPricing.GetItemOffers(new Parameter.ProductPricing.ParameterGetItemOffers()
49-
{
50-
ItemCondition = ItemCondition.New,
51-
MarketplaceId = MarketPlace.UnitedArabEmirates.ID,
52-
Asin = "B0143R13RY"
53-
});
54-
55-
47+
5648

57-
var data3 = amazonConnection.ProductPricing.GetCompetitivePricing(new Parameter.ProductPricing.ParameterGetCompetitivePricing()
49+
while (true)
5850
{
59-
MarketplaceId = MarketPlace.UnitedArabEmirates.ID,
60-
Asins = new string[] { "B00LZ0VSMI" },
51+
var ddata = amazonConnection.CatalogItem.GetCatalogItem("B0096IS4GE");
52+
if(ddata.AttributeSets!=null && ddata.AttributeSets.Count > 0)
53+
{
54+
var itm = ddata.AttributeSets[0];
55+
Console.WriteLine("Brand > " + itm.Brand);
56+
Console.WriteLine("ProductGroup > " + itm.ProductGroup);
57+
}
58+
59+
}
6160

62-
});
6361

6462
var data2 = amazonConnection.ProductPricing.GetPricing(new Parameter.ProductPricing.ParameterGetPricing()
6563
{

Source/FikaAmazonAPI/FikaAmazonAPI.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
<Product>CSharp Amazon Sp API</Product>
99
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1010
<LangVersion>8.0</LangVersion>
11-
<Version>1.0.12</Version>
12-
<AssemblyVersion>1.0.1.12</AssemblyVersion>
13-
<FileVersion>1.0.1.12</FileVersion>
11+
<Version>1.0.13</Version>
12+
<AssemblyVersion>1.0.1.13</AssemblyVersion>
13+
<FileVersion>1.0.1.13</FileVersion>
1414
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
1515
<PackageProjectUrl>https://github.com/abuzuhri/Amazon-SP-API-CSharp</PackageProjectUrl>
1616
<PackageLicenseExpression>MIT</PackageLicenseExpression>

Source/FikaAmazonAPI/Services/CatalogItemService.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ public IList<Item> ListCatalogItems(ParameterListCatalogItems parameterListCatal
3333
return list;
3434
}
3535

36-
public Item GetCatalogItem(string MarketplaceId,string asin)
36+
public Item GetCatalogItem(string asin)
3737
{
38+
3839
if(string.IsNullOrEmpty(asin))
3940
throw new InvalidDataException("asin is a required property and cannot be null");
40-
if (string.IsNullOrEmpty(MarketplaceId))
41-
throw new InvalidDataException("MarketplaceId is a required property and cannot be null");
41+
4242

4343
var param = new List<KeyValuePair<string, string>>();
44-
param.Add(new KeyValuePair<string, string>("MarketplaceId", MarketplaceId));
44+
param.Add(new KeyValuePair<string, string>("MarketplaceId", MarketPlace.ID));
4545

4646
CreateAuthorizedRequest(CategoryApiUrls.GetCatalogItem(asin), RestSharp.Method.GET, param);
4747
var response = ExecuteRequest<GetCatalogItemResponse>();
@@ -53,15 +53,14 @@ public Item GetCatalogItem(string MarketplaceId,string asin)
5353
}
5454

5555

56-
public IList<Categories> ListCatalogCategories(string MarketplaceId, string ASIN,string SellerSKU=null)
56+
public IList<Categories> ListCatalogCategories(string ASIN,string SellerSKU=null)
5757
{
5858
if (string.IsNullOrEmpty(ASIN))
5959
throw new InvalidDataException("ASIN is a required property and cannot be null or empty");
60-
if (string.IsNullOrEmpty(MarketplaceId))
61-
throw new InvalidDataException("MarketplaceId is a required property and cannot be null or empty");
60+
6261

6362
var param = new List<KeyValuePair<string, string>>();
64-
param.Add(new KeyValuePair<string, string>("MarketplaceId", MarketplaceId));
63+
param.Add(new KeyValuePair<string, string>("MarketplaceId", MarketPlace.ID));
6564
param.Add(new KeyValuePair<string, string>("ASIN", ASIN));
6665
if(!string.IsNullOrEmpty(SellerSKU))
6766
param.Add(new KeyValuePair<string, string>("SellerSKU", SellerSKU));

Source/FikaAmazonAPI/Utils/Country.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private Country(string code, string name,string domain, string sellercentralUrl,
4040
public static Country TR { get { return new Country("TR", "Turkey", "com.tr", "https://sellercentral.amazon.com.tr", "https://vendorcentral.amazon.com.tr"); } }
4141
public static Country AE { get { return new Country("AE", "United Arab Emirates", "ae", "https://sellercentral.amazon.ae", "https://vendorcentral.amazon.me"); } }
4242
public static Country IN { get { return new Country("IN", "India", "in", "https://sellercentral.amazon.in", "https://www.vendorcentral.in"); } }
43-
public static Country SA { get { return new Country("SA", "Saudi Arabia", "sa", "", "https://vendorcentral.amazon.me"); } }
43+
public static Country SA { get { return new Country("SA", "Saudi Arabia", "sa", "https://sellercentral.amazon.sa", "https://vendorcentral.amazon.me"); } }
4444

4545

4646

Source/FikaAmazonAPI/Utils/MarketPlace.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ private MarketPlace(string id, Region region, Country country)
1717
Country = country;
1818
}
1919

20-
20+
21+
//https://docs.developer.amazonservices.com/en_UK/dev_guide/DG_Endpoints.html
2122

2223
//NorthAmerica
2324
public static MarketPlace US { get { return new MarketPlace("ATVPDKIKX0DER", Region.NorthAmerica, Country.US); } }

0 commit comments

Comments
 (0)