Skip to content

Commit 49f5029

Browse files
committed
add productr types
1 parent b799a72 commit 49f5029

16 files changed

+727
-14
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Install-Package CSharpAmazonSpAPI
3535
- [x] [Feeds](https://github.com/amzn/selling-partner-api-docs/blob/main/references/feeds-api/feeds_2021-06-30.md) for [feedType](https://github.com/amzn/selling-partner-api-docs/blob/main/references/feeds-api/feedtype-values.md) for step to call feed read [doc](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/use-case-guides/feeds-api-use-case-guide/feeds-api-use-case-guide_2021-06-30.md)
3636
- [x] [ListingsItems](https://github.com/amzn/selling-partner-api-docs/blob/main/references/listings-items-api/listingsItems_2021-08-01.md)
3737
- [x] [Restrictions](https://developer-docs.amazon.com/sp-api/docs/listings-restrictions-api-v2021-08-01-reference)
38-
- [ ] [ProductTypes](https://developer-docs.amazon.com/sp-api/docs/product-type-definitions-api-v2020-09-01-reference)
38+
- [x] [ProductTypes](https://developer-docs.amazon.com/sp-api/docs/product-type-definitions-api-v2020-09-01-reference)
3939
- [x] [Uploads](https://github.com/amzn/selling-partner-api-docs/blob/main/references/uploads-api/uploads_2020-11-01.md)
4040
- [x] [shipmentInvoicingV0](https://github.com/amzn/selling-partner-api-docs/blob/main/references/shipment-invoicing-api/shipmentInvoicingV0.md)
4141
- [x] [Shippings](https://github.com/amzn/selling-partner-api-docs/blob/main/references/shipping-api/shipping.md)
@@ -452,6 +452,27 @@ var shipmentRequest = new CreateShipmentRequest(
452452
var shipmentResponse = amazonConnection.MerchantFulfillment.CreateShipment(shipmentRequest);
453453
```
454454

455+
## ProductTypes SearchDefinitions
456+
457+
```CSharp
458+
var list = amazonConnection.ProductType.SearchDefinitionsProductTypes(
459+
new Parameter.ProductTypes.SearchDefinitionsProductTypesParameter()
460+
{
461+
keywords = new List<string> { String.Empty },
462+
});
463+
```
464+
465+
## ProductTypes GetDefinitions
466+
467+
```CSharp
468+
var def = amazonConnection.ProductType.GetDefinitionsProductType(
469+
new Parameter.ProductTypes.GetDefinitionsProductTypeParameter()
470+
{
471+
productType = "PRODUCT",
472+
requirements = RequirementsEnum.LISTING,
473+
locale = AmazonSpApiSDK.Models.ProductTypes.LocaleEnum.en_US
474+
});
475+
```
455476
---
456477
## Q & A
457478

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using static FikaAmazonAPI.AmazonSpApiSDK.Models.ListingsItems.ListingsItemPutRequest;
2+
3+
namespace FikaAmazonAPI.SampleCode
4+
{
5+
internal class ProductTypeSample
6+
{
7+
8+
AmazonConnection amazonConnection;
9+
public ProductTypeSample(AmazonConnection amazonConnection)
10+
{
11+
this.amazonConnection = amazonConnection;
12+
}
13+
14+
15+
private void SearchDefinitionsProductTypes()
16+
{
17+
var list = amazonConnection.ProductType.SearchDefinitionsProductTypes(
18+
new Parameter.ProductTypes.SearchDefinitionsProductTypesParameter()
19+
{
20+
keywords = new List<string> { String.Empty },
21+
});
22+
23+
}
24+
private void GetDefinitionsProductType()
25+
{
26+
var def = amazonConnection.ProductType.GetDefinitionsProductType(
27+
new Parameter.ProductTypes.GetDefinitionsProductTypeParameter()
28+
{
29+
productType = "PRODUCT",
30+
requirements = RequirementsEnum.LISTING,
31+
locale = AmazonSpApiSDK.Models.ProductTypes.LocaleEnum.en_US
32+
});
33+
}
34+
35+
36+
}
37+
}

Source/FikaAmazonAPI.SampleCode/Program.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using FikaAmazonAPI.ReportGeneration;
88
using FikaAmazonAPI.Utils;
99
using Microsoft.Extensions.Configuration;
10+
using static FikaAmazonAPI.AmazonSpApiSDK.Models.ListingsItems.ListingsItemPutRequest;
1011
using static FikaAmazonAPI.Utils.Constants;
1112

1213
namespace FikaAmazonAPI.SampleCode
@@ -34,6 +35,18 @@ static async Task Main(string[] args)
3435
IsActiveLimitRate = true
3536
});
3637

38+
var aha = amazonConnection.ProductType.SearchDefinitionsProductTypes(new Parameter.ProductTypes.SearchDefinitionsProductTypesParameter()
39+
{
40+
keywords = new List<string> { String.Empty },
41+
});
42+
43+
var def = amazonConnection.ProductType.GetDefinitionsProductType(new Parameter.ProductTypes.GetDefinitionsProductTypeParameter()
44+
{
45+
productType = "PRODUCT",
46+
requirements = RequirementsEnum.LISTING,
47+
locale = AmazonSpApiSDK.Models.ProductTypes.LocaleEnum.en_US
48+
});
49+
3750
var result = amazonConnection.Restrictions.GetListingsRestrictions(new Parameter.Restrictions.ParameterGetListingsRestrictions
3851
{
3952
asin = "B07GY3J99B",
@@ -50,7 +63,7 @@ static async Task Main(string[] args)
5063
sku = SKU,
5164
listingsItemPutRequest = new ListingsItemPutRequest()
5265
{
53-
productType = "LUGGAGE",
66+
productType = "PRODUCT",
5467
requirements = Requirements.LISTING,
5568

5669
//Example from https://developer-docs.amazon.com/sp-api/docs/listings-items-api-v2020-09-01-use-case-guide

Source/FikaAmazonAPI/AmazonConnection.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class AmazonConnection
2727
public MessagingService Messaging => this._Messaging ?? throw _NoCredentials;
2828
public NotificationService Notification => this._Notification ?? throw _NoCredentials;
2929
public ProductFeeService ProductFee => this._ProductFee ?? throw _NoCredentials;
30+
public ProductTypeService ProductType => this._ProductType ?? throw _NoCredentials;
3031
public SalesService Sales => this._Sales ?? throw _NoCredentials;
3132
public SellerService Seller => this._Seller ?? throw _NoCredentials;
3233
public ServicesService Services => this._Services ?? throw _NoCredentials;
@@ -60,6 +61,7 @@ public class AmazonConnection
6061
private MessagingService _Messaging { get; set; }
6162
private NotificationService _Notification { get; set; }
6263
private ProductFeeService _ProductFee { get; set; }
64+
private ProductTypeService _ProductType { get; set; }
6365
private SalesService _Sales { get; set; }
6466
private SellerService _Seller { get; set; }
6567
private ServicesService _Services { get; set; }
@@ -114,6 +116,7 @@ private void Init(AmazonCredential Credentials)
114116
this._Messaging = new MessagingService(this.Credentials);
115117
this._Notification = new NotificationService(this.Credentials);
116118
this._ProductFee = new ProductFeeService(this.Credentials);
119+
this._ProductType = new ProductTypeService(this.Credentials);
117120
this._Sales = new SalesService(this.Credentials);
118121
this._Seller = new SellerService(this.Credentials);
119122
this._Services = new ServicesService(this.Credentials);
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
using System.Runtime.Serialization;
2+
3+
namespace FikaAmazonAPI.AmazonSpApiSDK.Models.ProductTypes
4+
{
5+
public enum LocaleEnum
6+
{
7+
/// <summary>
8+
/// Arabic
9+
/// </summary>
10+
[EnumMember(Value = "ar")]
11+
ar,
12+
/// <summary>
13+
/// Arabic (U.A.E.)
14+
/// </summary>
15+
[EnumMember(Value = "ar_AE")] ar_AE,
16+
/// <summary>
17+
/// German
18+
/// </summary>
19+
[EnumMember(Value = "de")] de,
20+
/// <summary>
21+
/// German (Germany)
22+
/// </summary>
23+
[EnumMember(Value = "de_DE")] de_DE,
24+
/// <summary>
25+
/// English
26+
/// </summary>
27+
[EnumMember(Value = "en")] en,
28+
/// <summary>
29+
/// English (U.A.E.)
30+
/// </summary>
31+
[EnumMember(Value = "en_AE")] en_AE,
32+
/// <summary>
33+
/// English (Australia)
34+
/// </summary>
35+
[EnumMember(Value = "en_AU")] en_AU,
36+
/// <summary>
37+
/// English (Canada)
38+
/// </summary>
39+
[EnumMember(Value = "en_CA")] en_CA,
40+
/// <summary>
41+
/// English (United Kingdom)
42+
/// </summary>
43+
[EnumMember(Value = "en_GB")] en_GB,
44+
/// <summary>
45+
/// English (India)
46+
/// </summary>
47+
[EnumMember(Value = "en_IN")] en_IN,
48+
/// <summary>
49+
/// English (Singapore)
50+
/// </summary>
51+
[EnumMember(Value = "en_SG")] en_SG,
52+
/// <summary>
53+
/// English (United States)
54+
/// </summary>
55+
[EnumMember(Value = "en_US")] en_US,
56+
/// <summary>
57+
/// Spanish
58+
/// </summary>
59+
[EnumMember(Value = "es")] es,
60+
/// <summary>
61+
/// Spanish (Spain)
62+
/// </summary>
63+
[EnumMember(Value = "es_ES")] es_ES,
64+
/// <summary>
65+
/// Spanish (Mexico)
66+
/// </summary>
67+
[EnumMember(Value = "es_MX")] es_MX,
68+
/// <summary>
69+
/// Spanish (United States)
70+
/// </summary>
71+
[EnumMember(Value = "es_US")] es_US,
72+
/// <summary>
73+
/// French
74+
/// </summary>
75+
[EnumMember(Value = "fr")] fr,
76+
/// <summary>
77+
/// French (Canada)
78+
/// </summary>
79+
[EnumMember(Value = "fr_CA")] fr_CA,
80+
/// <summary>
81+
/// French (France)
82+
/// </summary>
83+
[EnumMember(Value = "fr_FR")] fr_FR,
84+
/// <summary>
85+
/// Italian
86+
/// </summary>
87+
[EnumMember(Value = "it")] it,
88+
/// <summary>
89+
/// Italian (Italy)
90+
/// </summary>
91+
[EnumMember(Value = "it_IT")] it_IT,
92+
/// <summary>
93+
/// Japanese
94+
/// </summary>
95+
[EnumMember(Value = "ja")] ja,
96+
/// <summary>
97+
/// Japanese (Japan)
98+
/// </summary>
99+
[EnumMember(Value = "ja_JP")] ja_JP,
100+
/// <summary>
101+
/// Dutch
102+
/// </summary>
103+
[EnumMember(Value = "nl")] nl,
104+
/// <summary>
105+
/// Dutch (Netherlands)
106+
/// </summary>
107+
[EnumMember(Value = "nl_NL")] nl_NL,
108+
/// <summary>
109+
/// Polish
110+
/// </summary>
111+
[EnumMember(Value = "pl")] pl,
112+
/// <summary>
113+
/// Polish (Poland)
114+
/// </summary>
115+
[EnumMember(Value = "pl_PL")] pl_PL,
116+
/// <summary>
117+
/// Portuguese
118+
/// </summary>
119+
[EnumMember(Value = "pt")] pt,
120+
/// <summary>
121+
/// Portuguese (Brazil)
122+
/// </summary>
123+
[EnumMember(Value = "pt_BR")] pt_BR,
124+
/// <summary>
125+
/// Portuguese (Portugal)
126+
/// </summary>
127+
[EnumMember(Value = "pt_PT")] pt_PT,
128+
/// <summary>
129+
/// Swedish
130+
/// </summary>
131+
[EnumMember(Value = "sv")] sv,
132+
/// <summary>
133+
/// Swedish (Sweden)
134+
/// </summary>
135+
[EnumMember(Value = "sv_SE")] sv_SE,
136+
/// <summary>
137+
/// Turkish
138+
/// </summary>
139+
[EnumMember(Value = "tr")] tr,
140+
/// <summary>
141+
/// Turkish (Turkey)
142+
/// </summary>
143+
[EnumMember(Value = "tr_TR")] tr_TR,
144+
/// <summary>
145+
/// Chinese
146+
/// </summary>
147+
[EnumMember(Value = "zh")] zh,
148+
/// <summary>
149+
/// Chinese (Simplified)
150+
/// </summary>
151+
[EnumMember(Value = "zh_CN")] zh_CN,
152+
/// <summary>
153+
/// Chinese (Traditional)
154+
/// </summary>
155+
[EnumMember(Value = "zh_TW")] zh_TW,
156+
157+
}
158+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
using Newtonsoft.Json;
2+
using System.Collections.Generic;
3+
using System.Runtime.Serialization;
4+
using System.Text;
5+
6+
namespace FikaAmazonAPI.AmazonSpApiSDK.Models.ProductTypes
7+
{
8+
9+
/// <summary>
10+
/// An Amazon product type with a definition available.
11+
/// </summary>
12+
[DataContract]
13+
public class ProductType
14+
{
15+
/// <summary>
16+
/// The name of the Amazon product type.
17+
/// </summary>
18+
/// <value>The name of the Amazon product type.</value>
19+
[DataMember(Name = "name", EmitDefaultValue = false)]
20+
[JsonProperty(PropertyName = "name")]
21+
public string Name { get; set; }
22+
23+
/// <summary>
24+
/// The Amazon marketplace identifiers for which the product type definition is available.
25+
/// </summary>
26+
/// <value>The Amazon marketplace identifiers for which the product type definition is available.</value>
27+
[DataMember(Name = "marketplaceIds", EmitDefaultValue = false)]
28+
[JsonProperty(PropertyName = "marketplaceIds")]
29+
public List<string> MarketplaceIds { get; set; }
30+
31+
32+
/// <summary>
33+
/// Get the string presentation of the object
34+
/// </summary>
35+
/// <returns>String presentation of the object</returns>
36+
public override string ToString()
37+
{
38+
var sb = new StringBuilder();
39+
sb.Append("class ProductType {\n");
40+
sb.Append(" Name: ").Append(Name).Append("\n");
41+
sb.Append(" MarketplaceIds: ").Append(MarketplaceIds).Append("\n");
42+
sb.Append("}\n");
43+
return sb.ToString();
44+
}
45+
46+
/// <summary>
47+
/// Get the JSON string presentation of the object
48+
/// </summary>
49+
/// <returns>JSON string presentation of the object</returns>
50+
public string ToJson()
51+
{
52+
return JsonConvert.SerializeObject(this, Formatting.Indented);
53+
}
54+
55+
}
56+
}

0 commit comments

Comments
 (0)