Skip to content

Commit 4c82897

Browse files
author
yzi
committed
add Catalog Items result property [classifications]
1 parent 3c39806 commit 4c82897

File tree

4 files changed

+186
-4
lines changed

4 files changed

+186
-4
lines changed

Source/FikaAmazonAPI.SampleCode/CatalogItemsSample.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public CatalogItemsSample(AmazonConnection amazonConnection)
1313
}
1414

1515
[Obsolete("This method deprecated in June 2022. Please use GetCatalogItem(ParameterGetCatalogItem parameterListCatalogItem) instead.", true)]
16-
public void GetCatalogItemAsync()
16+
public void GetCatalogItemAsync()
1717
{
1818
var item = amazonConnection.CatalogItem.GetCatalogItem("B00CZC5F0G");
1919

@@ -26,7 +26,7 @@ public void ListCatalogCategories()
2626
}
2727

2828
[Obsolete("This method deprecated in June 2022. Please use SearchCatalogItems202204 instead.", true)]
29-
public void ListCatalogItems()
29+
public void ListCatalogItems()
3030
{
3131
var items = amazonConnection.CatalogItem.ListCatalogItems(new Parameter.CatalogItems.ParameterListCatalogItems()
3232
{
@@ -42,6 +42,7 @@ public async Task GetCatalogItem()
4242
{
4343
ASIN = "B00JK2YANC",
4444
includedData = new[] { IncludedData.attributes,
45+
IncludedData.classifications,
4546
IncludedData.salesRanks,
4647
IncludedData.summaries,
4748
IncludedData.productTypes,
@@ -59,6 +60,7 @@ public async Task SearchCatalogItems()
5960
{
6061
keywords = new[] { "vitamin c" },
6162
includedData = new[] { IncludedData.attributes,
63+
IncludedData.classifications,
6264
IncludedData.salesRanks,
6365
IncludedData.summaries,
6466
IncludedData.productTypes,

Source/FikaAmazonAPI/AmazonSpApiSDK/Models/CatalogItems/V20220401/Item.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public Item() { }
4242
/// <param name="salesRanks">salesRanks.</param>
4343
/// <param name="summaries">summaries.</param>
4444
/// <param name="vendorDetails">vendorDetails.</param>
45-
public Item(string asin = default(string), ItemAttributes attributes = default(ItemAttributes), ItemDimensions dimensions = default(ItemDimensions), ItemIdentifiers identifiers = default(ItemIdentifiers), ItemImages images = default(ItemImages), ItemProductTypes productTypes = default(ItemProductTypes), ItemRelationships relationships = default(ItemRelationships), ItemSalesRanks salesRanks = default(ItemSalesRanks), ItemSummaries summaries = default(ItemSummaries), ItemVendorDetails vendorDetails = default(ItemVendorDetails))
45+
public Item(string asin = default(string), List<ItemBrowseClassificationsByMarketplace> classifications = default(List<ItemBrowseClassificationsByMarketplace>), ItemAttributes attributes = default(ItemAttributes), ItemDimensions dimensions = default(ItemDimensions), ItemIdentifiers identifiers = default(ItemIdentifiers), ItemImages images = default(ItemImages), ItemProductTypes productTypes = default(ItemProductTypes), ItemRelationships relationships = default(ItemRelationships), ItemSalesRanks salesRanks = default(ItemSalesRanks), ItemSummaries summaries = default(ItemSummaries), ItemVendorDetails vendorDetails = default(ItemVendorDetails))
4646
{
4747
// to ensure "asin" is required (not null)
4848
if (asin == null)
@@ -54,6 +54,7 @@ public Item() { }
5454
this.Asin = asin;
5555
}
5656
this.Attributes = attributes;
57+
this.Classifications = classifications;
5758
this.Dimensions = dimensions;
5859
this.Identifiers = identifiers;
5960
this.Images = images;
@@ -76,6 +77,12 @@ public Item() { }
7677
[DataMember(Name = "attributes", EmitDefaultValue = false)]
7778
public ItemAttributes Attributes { get; set; }
7879

80+
/// <summary>
81+
/// Gets or Sets Classifications
82+
/// </summary>
83+
[DataMember(Name = "classifications", EmitDefaultValue = false)]
84+
public List<ItemBrowseClassificationsByMarketplace> Classifications { get; set; }
85+
7986
/// <summary>
8087
/// Gets or Sets Dimensions
8188
/// </summary>
@@ -134,6 +141,7 @@ public override string ToString()
134141
sb.Append("class Item {\n");
135142
sb.Append(" Asin: ").Append(Asin).Append("\n");
136143
sb.Append(" Attributes: ").Append(Attributes).Append("\n");
144+
sb.Append(" Classifications: ").Append(Classifications).Append("\n");
137145
sb.Append(" Dimensions: ").Append(Dimensions).Append("\n");
138146
sb.Append(" Identifiers: ").Append(Identifiers).Append("\n");
139147
sb.Append(" Images: ").Append(Images).Append("\n");
@@ -186,6 +194,11 @@ public bool Equals(Item input)
186194
(this.Attributes != null &&
187195
this.Attributes.Equals(input.Attributes))
188196
) &&
197+
(
198+
this.Classifications == input.Classifications ||
199+
this.Classifications != null &&
200+
this.Classifications.Equals(input.Classifications)
201+
) &&
189202
(
190203
this.Dimensions == input.Dimensions ||
191204
(this.Dimensions != null &&
@@ -241,6 +254,8 @@ public override int GetHashCode()
241254
hashCode = hashCode * 59 + this.Asin.GetHashCode();
242255
if (this.Attributes != null)
243256
hashCode = hashCode * 59 + this.Attributes.GetHashCode();
257+
if (this.Classifications != null)
258+
hashCode = hashCode * 59 + this.Classifications.GetHashCode();
244259
if (this.Dimensions != null)
245260
hashCode = hashCode * 59 + this.Dimensions.GetHashCode();
246261
if (this.Identifiers != null)

Source/FikaAmazonAPI/AmazonSpApiSDK/Models/CatalogItems/V20220401/ItemBrowseClassification.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected ItemBrowseClassification() { }
3434
/// </summary>
3535
/// <param name="displayName">Display name for the classification. (required).</param>
3636
/// <param name="classificationId">Identifier of the classification (browse node identifier). (required).</param>
37-
public ItemBrowseClassification(string displayName = default(string), string classificationId = default(string))
37+
public ItemBrowseClassification(string displayName = default, string classificationId = default, ItemBrowseClassification parent = default)
3838
{
3939
// to ensure "displayName" is required (not null)
4040
if (displayName == null)
@@ -54,6 +54,8 @@ protected ItemBrowseClassification() { }
5454
{
5555
this.ClassificationId = classificationId;
5656
}
57+
58+
this.Parent = parent;
5759
}
5860

5961
/// <summary>
@@ -70,6 +72,12 @@ protected ItemBrowseClassification() { }
7072
[DataMember(Name = "classificationId", EmitDefaultValue = false)]
7173
public string ClassificationId { get; set; }
7274

75+
/// <summary>
76+
/// Parent classification (browse node) of the current classification.
77+
/// </summary>
78+
[DataMember(Name = "parent", EmitDefaultValue = false)]
79+
public ItemBrowseClassification Parent { get; set; }
80+
7381
/// <summary>
7482
/// Returns the string presentation of the object
7583
/// </summary>
@@ -80,6 +88,7 @@ public override string ToString()
8088
sb.Append("class ItemBrowseClassification {\n");
8189
sb.Append(" DisplayName: ").Append(DisplayName).Append("\n");
8290
sb.Append(" ClassificationId: ").Append(ClassificationId).Append("\n");
91+
sb.Append(" Parent: ").Append(Parent).Append("\n");
8392
sb.Append("}\n");
8493
return sb.ToString();
8594
}
@@ -123,6 +132,11 @@ public bool Equals(ItemBrowseClassification input)
123132
this.ClassificationId == input.ClassificationId ||
124133
(this.ClassificationId != null &&
125134
this.ClassificationId.Equals(input.ClassificationId))
135+
) &&
136+
(
137+
this.Parent == input.Parent ||
138+
this.Parent != null &&
139+
this.Parent.Equals(input.Parent)
126140
);
127141
}
128142

@@ -139,6 +153,8 @@ public override int GetHashCode()
139153
hashCode = hashCode * 59 + this.DisplayName.GetHashCode();
140154
if (this.ClassificationId != null)
141155
hashCode = hashCode * 59 + this.ClassificationId.GetHashCode();
156+
if (this.Parent != null)
157+
hashCode = hashCode * 59 + this.Parent.GetHashCode();
142158
return hashCode;
143159
}
144160
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
/*
2+
* Selling Partner API for Catalog Items
3+
*
4+
* The Selling Partner API for Catalog Items provides programmatic access to information about items in the Amazon catalog. For more information, refer to the [Catalog Items API Use Case Guide](doc:catalog-items-api-v2022-04-01-use-case-guide).
5+
*
6+
* OpenAPI spec version: 2022-04-01
7+
*
8+
* Generated by: https://github.com/swagger-api/swagger-codegen.git
9+
*/
10+
11+
using Newtonsoft.Json;
12+
using System;
13+
using System.Collections.Generic;
14+
using System.ComponentModel.DataAnnotations;
15+
using System.IO;
16+
using System.Runtime.Serialization;
17+
using System.Text;
18+
19+
namespace FikaAmazonAPI.AmazonSpApiSDK.Models.CatalogItems.V20220401
20+
{
21+
/// <summary>
22+
/// Dimensions associated with the item in the Amazon catalog for the indicated Amazon marketplace.
23+
/// </summary>
24+
[DataContract]
25+
public partial class ItemBrowseClassificationsByMarketplace : IEquatable<ItemBrowseClassificationsByMarketplace>, IValidatableObject
26+
{
27+
/// <summary>
28+
/// Initializes a new instance of the <see cref="ItemBrowseClassificationsByMarketplace" /> class.
29+
/// </summary>
30+
[JsonConstructor]
31+
protected ItemBrowseClassificationsByMarketplace() { }
32+
/// <summary>
33+
/// Initializes a new instance of the <see cref="ItemBrowseClassificationsByMarketplace" /> class.
34+
/// </summary>
35+
/// <param name="marketplaceId">Amazon marketplace identifier. (required).</param>
36+
/// <param name="item">Dimensions of an Amazon catalog item..</param>
37+
/// <param name="package">Dimensions of an Amazon catalog item in its packaging..</param>
38+
public ItemBrowseClassificationsByMarketplace(string marketplaceId = default(string), List<ItemBrowseClassification> classifications = default(List<ItemBrowseClassification>))
39+
{
40+
// to ensure "marketplaceId" is required (not null)
41+
if (marketplaceId == null)
42+
{
43+
throw new InvalidDataException("marketplaceId is a required property for ItemDimensionsByMarketplace and cannot be null");
44+
}
45+
else
46+
{
47+
MarketplaceId = marketplaceId;
48+
}
49+
Classifications = classifications;
50+
}
51+
52+
/// <summary>
53+
/// Amazon marketplace identifier.
54+
/// </summary>
55+
/// <value>Amazon marketplace identifier.</value>
56+
[DataMember(Name = "marketplaceId", EmitDefaultValue = false)]
57+
public string MarketplaceId { get; set; }
58+
59+
/// <summary>
60+
/// Classifications of an Amazon catalog item.
61+
/// </summary>
62+
/// <value>Classifications of an Amazon catalog item.</value>
63+
[DataMember(Name = "classifications", EmitDefaultValue = false)]
64+
public List<ItemBrowseClassification> Classifications { get; set; }
65+
66+
/// <summary>
67+
/// Returns the string presentation of the object
68+
/// </summary>
69+
/// <returns>String presentation of the object</returns>
70+
public override string ToString()
71+
{
72+
var sb = new StringBuilder();
73+
sb.Append("class ItemDimensionsByMarketplace {\n");
74+
sb.Append(" MarketplaceId: ").Append(this.MarketplaceId).Append("\n");
75+
sb.Append(" Classifications: ").Append(this.Classifications).Append("\n");
76+
sb.Append("}\n");
77+
return sb.ToString();
78+
}
79+
80+
/// <summary>
81+
/// Returns the JSON string presentation of the object
82+
/// </summary>
83+
/// <returns>JSON string presentation of the object</returns>
84+
public virtual string ToJson()
85+
{
86+
return JsonConvert.SerializeObject(this, Formatting.Indented);
87+
}
88+
89+
/// <summary>
90+
/// Returns true if objects are equal
91+
/// </summary>
92+
/// <param name="input">Object to be compared</param>
93+
/// <returns>Boolean</returns>
94+
public override bool Equals(object input)
95+
{
96+
return Equals(input as ItemBrowseClassificationsByMarketplace);
97+
}
98+
99+
/// <summary>
100+
/// Returns true if ItemDimensionsByMarketplace instances are equal
101+
/// </summary>
102+
/// <param name="input">Instance of ItemDimensionsByMarketplace to be compared</param>
103+
/// <returns>Boolean</returns>
104+
public bool Equals(ItemBrowseClassificationsByMarketplace input)
105+
{
106+
if (input == null)
107+
return false;
108+
109+
return
110+
(
111+
this.MarketplaceId == input.MarketplaceId ||
112+
this.MarketplaceId != null &&
113+
this.MarketplaceId.Equals(input.MarketplaceId)
114+
) &&
115+
(
116+
this.Classifications == input.Classifications ||
117+
this.Classifications != null &&
118+
this.Classifications.Equals(input.Classifications)
119+
);
120+
}
121+
122+
/// <summary>
123+
/// Gets the hash code
124+
/// </summary>
125+
/// <returns>Hash code</returns>
126+
public override int GetHashCode()
127+
{
128+
unchecked // Overflow is fine, just wrap
129+
{
130+
int hashCode = 41;
131+
if (this.MarketplaceId != null)
132+
hashCode = hashCode * 59 + this.MarketplaceId.GetHashCode();
133+
if (this.Classifications != null)
134+
hashCode = hashCode * 59 + this.Classifications.GetHashCode();
135+
return hashCode;
136+
}
137+
}
138+
139+
/// <summary>
140+
/// To validate all properties of the instance
141+
/// </summary>
142+
/// <param name="validationContext">Validation context</param>
143+
/// <returns>Validation Result</returns>
144+
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
145+
{
146+
yield break;
147+
}
148+
}
149+
}

0 commit comments

Comments
 (0)