Skip to content

Commit 6f12a17

Browse files
committed
fix bug
1 parent 63ecd66 commit 6f12a17

File tree

7 files changed

+79
-16
lines changed

7 files changed

+79
-16
lines changed

Source/FikaAmazonAPI.SampleCode/Program.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
using FikaAmazonAPI.Parameter.Finance;
2727
using FikaAmazonAPI.ReportGeneration;
2828
using Microsoft.Extensions.Configuration;
29+
using FikaAmazonAPI.Parameter.CatalogItems;
2930

3031
namespace FikaAmazonAPI.SampleCode
3132
{
@@ -51,12 +52,21 @@ static async Task Main(string[] args)
5152
IsActiveLimitRate = true
5253
});
5354

54-
55-
var list3=amazonConnection.Financial.ListFinancialEvents(new ParameterListFinancialEvents()
55+
var list3 = amazonConnection.Financial.ListFinancialEvents(new ParameterListFinancialEvents()
5656
{
57-
PostedAfter=DateTime.UtcNow.AddDays(-15)
57+
PostedAfter = DateTime.UtcNow.AddDays(-15)
5858
});
5959

60+
61+
var item = amazonConnection.CatalogItem.GetCatalogItem("B00CZC5F0G");
62+
63+
64+
65+
66+
ReportManager reportManager1 = new ReportManager(amazonConnection);
67+
reportManager1.GetSellerFeedBackDataFromDays(60);
68+
69+
6070
string text = System.IO.File.ReadAllText(@"C:\Users\tareq\Downloads\Beispiel_Upload.txt");
6171

6272
var feedresultTXT = amazonConnection.Feed.SubmitFeed(text

Source/FikaAmazonAPI/FikaAmazonAPI.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
<Product>CSharp Amazon Sp API</Product>
88
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
99
<LangVersion>8.0</LangVersion>
10-
<Version>1.0.42</Version>
11-
<AssemblyVersion>1.0.42</AssemblyVersion>
12-
<FileVersion>1.0.42</FileVersion>
10+
<Version>1.0.43</Version>
11+
<AssemblyVersion>1.0.43</AssemblyVersion>
12+
<FileVersion>1.0.43</FileVersion>
1313
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
1414
<PackageProjectUrl>https://github.com/abuzuhri/Amazon-SP-API-CSharp</PackageProjectUrl>
1515
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using FikaAmazonAPI.Search;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Text;
5+
using static FikaAmazonAPI.Utils.Constants;
6+
7+
namespace FikaAmazonAPI.Parameter.CatalogItems
8+
{
9+
public class ParameterGetCatalogItem : ParameterBased
10+
{
11+
public string ASIN { get; set; }
12+
public IList<string> MarketplaceIds { get; set; }= new List<string>();
13+
public IList<IncludedData> includedData { get; set; }
14+
public string locale { get; set; }
15+
}
16+
}

Source/FikaAmazonAPI/Services/ApiUrls.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ protected class CategoryApiUrls
448448
{
449449
private readonly static string _resourceBaseUrl = "/catalog/v0";
450450

451-
private readonly static string _202012resourceBaseUrl = "/catalog/2020-12-01/items";
451+
private readonly static string _202012resourceBaseUrl = "/catalog/2020-12-01";
452452
public static string ListCatalogItems
453453
{
454454
get => $"{_resourceBaseUrl}/items";
@@ -457,9 +457,10 @@ public static string ListCatalogCategories
457457
{
458458
get => $"{_resourceBaseUrl}/categories";
459459
}
460-
public static string GetCatalogItem(string asin) => $"{_202012resourceBaseUrl}/{asin}";
460+
public static string GetCatalogItem(string asin) => $"{_resourceBaseUrl}/items/{asin}";
461+
public static string GetCatalogItem202012(string asin) => $"{_202012resourceBaseUrl}/items/{asin}";
461462

462-
public static string SearchCatalogItems => $"{_202012resourceBaseUrl}";
463+
public static string SearchCatalogItems => $"{_202012resourceBaseUrl}/items";
463464
}
464465

465466
protected class ListingsItemsApiUrls

Source/FikaAmazonAPI/Services/CatalogItemService.cs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public CatalogItemService(AmazonCredential amazonCredential) : base(amazonCreden
1818
public IList<Item> ListCatalogItems(ParameterListCatalogItems parameterListCatalogItems)
1919
{
2020
if (string.IsNullOrEmpty(parameterListCatalogItems.MarketplaceId))
21-
throw new InvalidDataException("MarketplaceId is a required property and cannot be null or empty");
21+
parameterListCatalogItems.MarketplaceId = MarketPlace.ID;
2222

2323
if (
2424
string.IsNullOrEmpty(parameterListCatalogItems.Query) &&
@@ -43,12 +43,12 @@ public IList<Item> ListCatalogItems(ParameterListCatalogItems parameterListCatal
4343
return list;
4444
}
4545

46+
//[Obsolete("This method is will be deprecated in June 2022. Please use GetCatalogItem(ParameterGetCatalogItem parameterListCatalogItem) instead.")]
4647
public Item GetCatalogItem(string asin)
4748
{
48-
49-
if(string.IsNullOrEmpty(asin))
50-
throw new InvalidDataException("asin is a required property and cannot be null");
5149

50+
if (string.IsNullOrEmpty(asin))
51+
throw new InvalidDataException("asin is a required property and cannot be null");
5252

5353
var param = new List<KeyValuePair<string, string>>();
5454
param.Add(new KeyValuePair<string, string>("MarketplaceId", MarketPlace.ID));
@@ -62,15 +62,33 @@ public Item GetCatalogItem(string asin)
6262
return null;
6363
}
6464

65+
//public Item GetCatalogItem(ParameterGetCatalogItem parameterListCatalogItem)
66+
//{
67+
68+
// if (string.IsNullOrEmpty(parameterListCatalogItem.ASIN))
69+
// throw new InvalidDataException("asin is a required property and cannot be null");
70+
71+
// if (parameterListCatalogItem == null || parameterListCatalogItem.MarketplaceIds == null || parameterListCatalogItem.MarketplaceIds.Count == 0)
72+
// {
73+
// parameterListCatalogItem.MarketplaceIds.Add(MarketPlace.ID);
74+
// }
6575

66-
public IList<Categories> ListCatalogCategories(string ASIN,string SellerSKU=null)
76+
// var param = parameterListCatalogItem.getParameters();
77+
78+
// CreateAuthorizedRequest(CategoryApiUrls.GetCatalogItem202012(parameterListCatalogItem.ASIN), RestSharp.Method.GET, param);
79+
// var response = ExecuteRequest<Item>();
80+
81+
// return response;
82+
//}
83+
84+
public IList<Categories> ListCatalogCategories(string ASIN,string SellerSKU=null,string MarketPlaceID = null)
6785
{
6886
if (string.IsNullOrEmpty(ASIN))
6987
throw new InvalidDataException("ASIN is a required property and cannot be null or empty");
7088

7189

7290
var param = new List<KeyValuePair<string, string>>();
73-
param.Add(new KeyValuePair<string, string>("MarketplaceId", MarketPlace.ID));
91+
param.Add(new KeyValuePair<string, string>("MarketplaceId", MarketPlaceID ?? MarketPlace.ID));
7492
param.Add(new KeyValuePair<string, string>("ASIN", ASIN));
7593
if(!string.IsNullOrEmpty(SellerSKU))
7694
param.Add(new KeyValuePair<string, string>("SellerSKU", SellerSKU));

Source/FikaAmazonAPI/Services/OrderService.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class OrderService : RequestService
1616
{
1717
public OrderService(AmazonCredential amazonCredential) : base(amazonCredential)
1818
{
19-
19+
2020
}
2121

2222
#region GetOrders
@@ -25,6 +25,11 @@ public OrderList GetOrders(ParameterOrderList searchOrderList)
2525
{
2626
var orderList = new OrderList();
2727

28+
if (searchOrderList.MarketplaceIds == null || searchOrderList.MarketplaceIds.Count == 0)
29+
{
30+
searchOrderList.MarketplaceIds=new List<string>();
31+
searchOrderList.MarketplaceIds.Add(MarketPlace.ID);
32+
}
2833
var queryParameters = searchOrderList.getParameters(this.AmazonCredential.Environment == Constants.Environments.Sandbox);
2934

3035
CreateAuthorizedRequest(OrdersApiUrls.Orders, RestSharp.Method.GET, queryParameters,parameter: searchOrderList);

Source/FikaAmazonAPI/Utils/Constants.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@ public enum ShipmentStatusList
4848
DELIVERED,
4949
CHECKED_IN,
5050
}
51+
52+
[JsonConverter(typeof(StringEnumConverter))]
53+
public enum IncludedData
54+
{
55+
identifiers,
56+
images,
57+
productTypes,
58+
salesRanks,
59+
summaries,
60+
variations,
61+
vendorDetails
62+
}
63+
5164
[JsonConverter(typeof(StringEnumConverter))]
5265
public enum QueryType
5366
{

0 commit comments

Comments
 (0)