Skip to content

Commit 3f1ebf4

Browse files
committed
Added SearchListingsItems function and related models
1 parent 1cf4a40 commit 3f1ebf4

File tree

9 files changed

+452
-1
lines changed

9 files changed

+452
-1
lines changed
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
/*
2+
* Selling Partner API for Listings Items
3+
*
4+
* The Selling Partner API for Listings Items (Listings Items API) provides programmatic access to selling partner listings on Amazon. Use this API in collaboration with the Selling Partner API for Product Type Definitions, which you use to retrieve the information about Amazon product types needed to use the Listings Items API. For more information, see the [Listings Items API Use Case Guide](doc:listings-items-api-v2021-08-01-use-case-guide).
5+
*
6+
* OpenAPI spec version: 2021-08-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.Linq;
17+
using System.Runtime.Serialization;
18+
using System.Text;
19+
20+
namespace FikaAmazonAPI.AmazonSpApiSDK.Models.ListingsItems
21+
{
22+
/// <summary>
23+
/// Selling partner listings items and search related metadata.
24+
/// </summary>
25+
[DataContract]
26+
public partial class ItemSearchResults : IEquatable<ItemSearchResults>, IValidatableObject
27+
{
28+
public ItemSearchResults()
29+
{
30+
31+
}
32+
33+
/// <summary>
34+
/// Initializes a new instance of the <see cref="ItemSearchResults" /> class.
35+
/// </summary>
36+
/// <param name="numberOfResults">The total number of selling partner listings items found for the search criteria (only results up to the page count limit will be returned per request regardless of the number found). (required).</param>
37+
/// <param name="pagination">If available, the nextToken and/or previousToken values required to return paginated results.</param>
38+
/// <param name="items">A list of listings items. (required).</param>
39+
public ItemSearchResults(int numberOfResults = default(int), Pagination pagination = default(Pagination), List<Item> items = default(List<Item>))
40+
{
41+
// to ensure "numberOfResults" is required (not null)
42+
if (numberOfResults == null)
43+
{
44+
throw new InvalidDataException("numberOfResults is a required property for ItemSearchResults and cannot be null");
45+
}
46+
else
47+
{
48+
this.NumberOfResults = numberOfResults;
49+
}
50+
51+
// to ensure "items" is required (not null)
52+
if (items == null)
53+
{
54+
throw new InvalidDataException("items is a required property for ItemSearchResults and cannot be null");
55+
}
56+
else
57+
{
58+
this.Items = items;
59+
}
60+
this.Pagination = pagination;
61+
}
62+
63+
/// <summary>
64+
/// The total number of selling partner listings items found for the search criteria (only results up to the page count limit will be returned per request regardless of the number found).
65+
/// </summary>
66+
/// <value>The total number of selling partner listings items found for the search criteria (only results up to the page count limit will be returned per request regardless of the number found).</value>
67+
[DataMember(Name = "numberOfResults", EmitDefaultValue = false)]
68+
public int NumberOfResults { get; set; }
69+
70+
/// <summary>
71+
/// If available, the nextToken and/or previousToken values required to return paginated results.
72+
/// </summary>
73+
/// <value>If available, the nextToken and/or previousToken values required to return paginated results.</value>
74+
[DataMember(Name = "pagination", EmitDefaultValue = false)]
75+
public Pagination Pagination { get; set; }
76+
77+
/// <summary>
78+
/// A list of listings items.
79+
/// </summary>
80+
/// <value>A list of listings items.</value>
81+
[DataMember(Name = "items", EmitDefaultValue = false)]
82+
public List<Item> Items { get; set; }
83+
84+
/// <summary>
85+
/// Returns the string presentation of the object
86+
/// </summary>
87+
/// <returns>String presentation of the object</returns>
88+
public override string ToString()
89+
{
90+
var sb = new StringBuilder();
91+
sb.Append("class ItemSearchResults {\n");
92+
sb.Append(" NumberOfResults: ").Append(NumberOfResults).Append("\n");
93+
sb.Append(" Pagination: ").Append(Pagination).Append("\n");
94+
sb.Append(" Items: ").Append(Items).Append("\n");
95+
sb.Append("}\n");
96+
return sb.ToString();
97+
}
98+
99+
/// <summary>
100+
/// Returns the JSON string presentation of the object
101+
/// </summary>
102+
/// <returns>JSON string presentation of the object</returns>
103+
public string ToJson()
104+
{
105+
return JsonConvert.SerializeObject(this, Formatting.Indented);
106+
}
107+
108+
/// <summary>
109+
/// Returns true if objects are equal
110+
/// </summary>
111+
/// <param name="input">Object to be compared</param>
112+
/// <returns>Boolean</returns>
113+
public override bool Equals(object input)
114+
{
115+
return this.Equals(input as ItemSearchResults);
116+
}
117+
118+
/// <summary>
119+
/// Returns true if ItemSearchResults instances are equal
120+
/// </summary>
121+
/// <param name="input">Instance of ItemSearchResults to be compared</param>
122+
/// <returns>Boolean</returns>
123+
public bool Equals(ItemSearchResults input)
124+
{
125+
if (input == null)
126+
return false;
127+
128+
return
129+
(
130+
this.NumberOfResults == input.NumberOfResults ||
131+
(this.NumberOfResults != null &&
132+
this.NumberOfResults.Equals(input.NumberOfResults))
133+
) &&
134+
(
135+
this.Pagination == input.Pagination ||
136+
(this.Pagination != null &&
137+
this.Pagination.Equals(input.Pagination))
138+
) &&
139+
(
140+
this.Items == input.Items ||
141+
this.Items != null &&
142+
this.Items.SequenceEqual(input.Items)
143+
);
144+
}
145+
146+
/// <summary>
147+
/// Gets the hash code
148+
/// </summary>
149+
/// <returns>Hash code</returns>
150+
public override int GetHashCode()
151+
{
152+
unchecked // Overflow is fine, just wrap
153+
{
154+
int hashCode = 41;
155+
if (this.NumberOfResults != null)
156+
hashCode = hashCode * 59 + this.NumberOfResults.GetHashCode();
157+
if (this.Pagination != null)
158+
hashCode = hashCode * 59 + this.Pagination.GetHashCode();
159+
if (this.Items != null)
160+
hashCode = hashCode * 59 + this.Items.GetHashCode();
161+
return hashCode;
162+
}
163+
}
164+
165+
/// <summary>
166+
/// To validate all properties of the instance
167+
/// </summary>
168+
/// <param name="validationContext">Validation context</param>
169+
/// <returns>Validation Result</returns>
170+
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
171+
{
172+
yield break;
173+
}
174+
}
175+
176+
}
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
/*
2+
* Selling Partner API for Listings Items
3+
*
4+
* The Selling Partner API for Listings Items (Listings Items API) provides programmatic access to selling partner listings on Amazon. Use this API in collaboration with the Selling Partner API for Product Type Definitions, which you use to retrieve the information about Amazon product types needed to use the Listings Items API. For more information, see the [Listings Items API Use Case Guide](doc:listings-items-api-v2021-08-01-use-case-guide).
5+
*
6+
* OpenAPI spec version: 2021-08-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.Runtime.Serialization;
16+
using System.Text;
17+
18+
namespace FikaAmazonAPI.AmazonSpApiSDK.Models.ListingsItems
19+
{
20+
/// <summary>
21+
/// Contains tokens to fetch from a certain page.
22+
/// </summary>
23+
[DataContract]
24+
public partial class Pagination : IEquatable<Pagination>, IValidatableObject
25+
{
26+
/// <summary>
27+
/// Initializes a new instance of the <see cref="Pagination" /> class.
28+
/// </summary>
29+
/// <param name="nextToken">A token that can be used to fetch the next page.</param>
30+
/// <param name="previousToken">A token that can be used to fetch the previous page.</param>
31+
public Pagination(string nextToken = default(string), string previousToken = default(string))
32+
{
33+
this.NextToken = nextToken;
34+
this.PreviousToken = previousToken;
35+
}
36+
37+
/// <summary>
38+
/// A token that can be used to fetch the next page.
39+
/// </summary>
40+
/// <value>A token that can be used to fetch the next page.</value>
41+
[DataMember(Name="nextToken", EmitDefaultValue=false)]
42+
public string NextToken { get; set; }
43+
44+
/// <summary>
45+
/// A token that can be used to fetch the previous page.
46+
/// </summary>
47+
/// <value>A token that can be used to fetch the previous page.</value>
48+
[DataMember(Name = "previousToken", EmitDefaultValue = false)]
49+
public string PreviousToken { get; set; }
50+
51+
/// <summary>
52+
/// Returns the string presentation of the object
53+
/// </summary>
54+
/// <returns>String presentation of the object</returns>
55+
public override string ToString()
56+
{
57+
var sb = new StringBuilder();
58+
sb.Append("class Pagination {\n");
59+
sb.Append(" NextToken: ").Append(NextToken).Append("\n");
60+
sb.Append(" PreviousToken: ").Append(PreviousToken).Append("\n");
61+
sb.Append("}\n");
62+
return sb.ToString();
63+
}
64+
65+
/// <summary>
66+
/// Returns the JSON string presentation of the object
67+
/// </summary>
68+
/// <returns>JSON string presentation of the object</returns>
69+
public virtual string ToJson()
70+
{
71+
return JsonConvert.SerializeObject(this, Formatting.Indented);
72+
}
73+
74+
/// <summary>
75+
/// Returns true if objects are equal
76+
/// </summary>
77+
/// <param name="input">Object to be compared</param>
78+
/// <returns>Boolean</returns>
79+
public override bool Equals(object input)
80+
{
81+
return this.Equals(input as Pagination);
82+
}
83+
84+
/// <summary>
85+
/// Returns true if Pagination instances are equal
86+
/// </summary>
87+
/// <param name="input">Instance of Pagination to be compared</param>
88+
/// <returns>Boolean</returns>
89+
public bool Equals(Pagination input)
90+
{
91+
if (input == null)
92+
return false;
93+
94+
return
95+
(
96+
this.NextToken == input.NextToken ||
97+
(this.NextToken != null &&
98+
this.NextToken.Equals(input.NextToken))
99+
) &&
100+
(
101+
this.PreviousToken == input.PreviousToken ||
102+
(this.PreviousToken != null &&
103+
this.PreviousToken.Equals(input.PreviousToken))
104+
);
105+
}
106+
107+
/// <summary>
108+
/// Gets the hash code
109+
/// </summary>
110+
/// <returns>Hash code</returns>
111+
public override int GetHashCode()
112+
{
113+
unchecked // Overflow is fine, just wrap
114+
{
115+
int hashCode = 41;
116+
if (this.NextToken != null)
117+
hashCode = hashCode * 59 + this.NextToken.GetHashCode();
118+
if (this.PreviousToken != null)
119+
hashCode = hashCode * 59 + this.PreviousToken.GetHashCode();
120+
return hashCode;
121+
}
122+
}
123+
124+
/// <summary>
125+
/// To validate all properties of the instance
126+
/// </summary>
127+
/// <param name="validationContext">Validation context</param>
128+
/// <returns>Validation Result</returns>
129+
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
130+
{
131+
// NextToken (string) maxLength
132+
if(this.NextToken != null && this.NextToken.Length > 1024)
133+
{
134+
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for NextToken, length must be less than 1024.", new [] { "NextToken" });
135+
}
136+
137+
// NextToken (string) minLength
138+
if(this.NextToken != null && this.NextToken.Length < 1)
139+
{
140+
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for NextToken, length must be greater than 1.", new [] { "NextToken" });
141+
}
142+
143+
// PreviousToken (string) maxLength
144+
if (this.PreviousToken != null && this.PreviousToken.Length > 1024)
145+
{
146+
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PreviousToken, length must be less than 1024.", new[] { "PreviousToken" });
147+
}
148+
149+
// PreviousToken (string) minLength
150+
if (this.PreviousToken != null && this.PreviousToken.Length < 1)
151+
{
152+
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PreviousToken, length must be greater than 1.", new[] { "PreviousToken" });
153+
}
154+
155+
yield break;
156+
}
157+
}
158+
159+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Selling Partner API for Listings Items
3+
*
4+
* The Selling Partner API for Listings Items (Listings Items API) provides programmatic access to selling partner listings on Amazon. Use this API in collaboration with the Selling Partner API for Product Type Definitions, which you use to retrieve the information about Amazon product types needed to use the Listings Items API. For more information, see the [Listings Items API Use Case Guide](doc:listings-items-api-v2021-08-01-use-case-guide).
5+
*
6+
* OpenAPI spec version: 2021-08-01
7+
*
8+
* Generated by: https://github.com/swagger-api/swagger-codegen.git
9+
*/
10+
11+
using Newtonsoft.Json;
12+
using Newtonsoft.Json.Converters;
13+
using System;
14+
using System.Collections.Generic;
15+
using System.Runtime.Serialization;
16+
using System.Text;
17+
18+
namespace FikaAmazonAPI.AmazonSpApiSDK.Models.ListingsItems
19+
{
20+
/// <summary>
21+
/// An attribute by which to sort the returned listing items.
22+
/// </summary>
23+
/// <value>An attribute by which to sort the returned listing items.</value>
24+
[JsonConverter(typeof(StringEnumConverter))]
25+
public enum SortBy
26+
{
27+
/// <summary>
28+
/// Enum sku for value: sku
29+
/// </summary>
30+
[EnumMember(Value = "sku")]
31+
sku = 1,
32+
33+
/// <summary>
34+
/// Enum createdDate for value: createdDate
35+
/// </summary>
36+
[EnumMember(Value = "createdDate")]
37+
createdDate = 2,
38+
39+
/// <summary>
40+
/// Enum lastUpdatedDate for value: lastUpdatedDate
41+
/// </summary>
42+
[EnumMember(Value = "lastUpdatedDate")]
43+
lastUpdatedDate = 3
44+
}
45+
}

0 commit comments

Comments
 (0)