Skip to content

Commit dbeb419

Browse files
authored
add new price_type and price_type_label attributes (#105)
1 parent 96653a2 commit dbeb419

6 files changed

Lines changed: 221 additions & 4 deletions

File tree

amazon_paapi/models/item_result.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,120 @@
11
from typing import List
2+
23
from ..sdk import models
34

45
"""Shared models"""
6+
7+
58
class ApiLabelLocale:
69
label: str
710
locale: str
811

12+
913
class ApiMultiValuedAttributeStr(ApiLabelLocale, models.MultiValuedAttribute):
1014
display_values: List[str]
1115

16+
1217
class ApiDisplayValuesType:
1318
display_value: str
1419
type: str
1520

21+
1622
class ApiMultiValuedAttributeType(ApiLabelLocale, models.MultiValuedAttribute):
1723
display_values: List[ApiDisplayValuesType]
1824

25+
1926
class ApiUnitBasedAttribute(ApiLabelLocale, models.UnitBasedAttribute):
2027
display_value: float
2128
unit: str
2229

30+
2331
class ApiSingleStringValuedAttribute(ApiLabelLocale, models.SingleStringValuedAttribute):
2432
display_value: str
2533

34+
2635
class ApiSingleBooleanValuedAttribute(ApiLabelLocale, models.SingleBooleanValuedAttribute):
2736
display_value: bool
2837

38+
2939
class ApiSingleIntegerValuedAttribute(ApiLabelLocale, models.SingleIntegerValuedAttribute):
3040
display_value: float
3141

42+
3243
class ApiPrice:
3344
amount: float
3445
currency: str
3546
price_per_unit: float
3647
display_amount: str
48+
price_type: str
49+
price_type_label: str
50+
3751

3852
"""Image models"""
53+
54+
3955
class ApiImageSize(models.ImageSize):
4056
url: str
4157
height: str
4258
width: str
4359

60+
4461
class ApiImageType(models.ImageType):
4562
large: ApiImageSize
4663
medium: ApiImageSize
4764
small: ApiImageSize
4865

66+
4967
class ApiImages(models.Images):
5068
primary: ApiImageType
5169
variants: List[ApiImageType]
5270

71+
5372
"""Item info models"""
73+
74+
5475
class ApiByLineInfo(models.ByLineInfo):
5576
brand: ApiSingleStringValuedAttribute
5677
contributors: ApiSingleStringValuedAttribute
5778
manufacturer: ApiSingleStringValuedAttribute
5879

80+
5981
class ApiClassifications(models.Classifications):
6082
binding: ApiSingleStringValuedAttribute
6183
product_group: ApiSingleStringValuedAttribute
6284

85+
6386
class ApiContentInfo(models.ContentInfo):
6487
edition: ApiSingleStringValuedAttribute
6588
languages: ApiMultiValuedAttributeType
6689

90+
6791
class ApiContentRating(models.ContentRating):
6892
audience_rating: ApiSingleStringValuedAttribute
6993

94+
7095
class ApiExternalIds(models.ExternalIds):
7196
ea_ns: ApiMultiValuedAttributeStr
7297
isb_ns: ApiMultiValuedAttributeStr
7398
up_cs: ApiMultiValuedAttributeStr
7499

100+
75101
class ApiFeatures():
76102
features: ApiMultiValuedAttributeStr
77103

104+
78105
class ApiManufactureInfo(models.ManufactureInfo):
79106
item_part_number: ApiSingleStringValuedAttribute
80107
model: ApiSingleStringValuedAttribute
81108
warranty: ApiSingleStringValuedAttribute
82109

110+
83111
class ApiItemDimensions(models.DimensionBasedAttribute):
84112
height: ApiUnitBasedAttribute
85113
length: ApiUnitBasedAttribute
86114
weight: ApiUnitBasedAttribute
87115
width: ApiUnitBasedAttribute
88116

117+
89118
class ApiProductInfo(models.ProductInfo):
90119
color: ApiSingleStringValuedAttribute
91120
is_adult_product: ApiSingleBooleanValuedAttribute
@@ -94,19 +123,23 @@ class ApiProductInfo(models.ProductInfo):
94123
size: ApiSingleStringValuedAttribute
95124
unit_count: ApiSingleIntegerValuedAttribute
96125

126+
97127
class ApiTechnicalInfo(models.TechnicalInfo):
98128
formats: ApiMultiValuedAttributeStr
99129
energy_efficiency_class: ApiSingleStringValuedAttribute
100130

131+
101132
class ApiTradeInPrice(models.TradeInPrice):
102133
amount: float
103134
currency: str
104135
display_amount: str
105136

137+
106138
class ApiTradeInInfo(models.TradeInInfo):
107139
is_eligible_for_trade_in: bool
108140
price: ApiTradeInPrice
109141

142+
110143
class ApiItemInfo(models.ItemInfo):
111144
by_line_info: ApiByLineInfo
112145
classifications: ApiClassifications
@@ -120,59 +153,74 @@ class ApiItemInfo(models.ItemInfo):
120153
title: ApiSingleStringValuedAttribute
121154
trade_in_info: ApiTradeInInfo
122155

156+
123157
"""Offers model"""
158+
159+
124160
class ApiOfferAvailability(models.OfferAvailability):
125161
max_order_quantity: int
126162
message: str
127163
min_order_quantity: int
128164
type: str
129165

166+
130167
class ApiOfferConditionInfo:
131168
display_value: str
132169
label: str
133170
locale: str
134171
value: str
135172

173+
136174
class ApiOfferSubCondition(ApiOfferConditionInfo, models.OfferSubCondition):
137175
pass
138176

177+
139178
class ApiOfferConditionNote(models.OfferConditionNote):
140179
locale: str
141180
value: str
142181

182+
143183
class ApiOfferCondition(ApiOfferConditionInfo, models.OfferCondition):
144184
sub_condition: ApiOfferSubCondition
145185
condition_note: ApiOfferConditionNote
146186

187+
147188
class ApiOfferDeliveryInfo(models.OfferDeliveryInfo):
148189
is_amazon_fulfilled: bool
149190
is_free_shipping_eligible: bool
150191
is_prime_eligible: bool
151192

193+
152194
class ApiOfferLoyaltyPoints(models.OfferLoyaltyPoints):
153195
points: int
154196

197+
155198
class ApiOfferMerchantInfo(models.OfferMerchantInfo):
156199
default_shipping_country: str
157200
feedback_count: int
158201
feedback_rating: float
159202
id: str
160203
name: str
161204

205+
162206
class ApiOfferSavings(ApiPrice, models.OfferSavings):
163207
percentage: float
164208

209+
165210
class ApiOfferPrice(ApiPrice, models.OfferPrice):
166211
savings: models.OfferSavings
167212

213+
168214
class ApiOfferProgramEligibility(models.OfferProgramEligibility):
169215
is_prime_exclusive: bool
170216
is_prime_pantry: bool
171217

218+
172219
class ApiPromotion(ApiPrice, models.OfferPromotion):
173220
type: str
174221
discount_percent: float
175222

223+
176224
class ApiListings(models.OfferListing):
177225
availability: ApiOfferAvailability
178226
condition: ApiOfferCondition
@@ -187,10 +235,14 @@ class ApiListings(models.OfferListing):
187235
saving_basis: ApiPrice
188236
violates_map: bool
189237

238+
190239
class ApiOffers(models.Offers):
191240
listings: List[ApiListings]
192241

242+
193243
"""Browse node info model"""
244+
245+
194246
class ApiBrowseNode(models.BrowseNode):
195247
ancestor: str
196248
context_free_name: str
@@ -199,16 +251,21 @@ class ApiBrowseNode(models.BrowseNode):
199251
is_root: str
200252
sales_rank: str
201253

254+
202255
class ApiWebsiteSalesRank(models.WebsiteSalesRank):
203256
context_free_name: str
204257
display_name: str
205258
sales_rank: str
206259

260+
207261
class ApiBrowseNodeInfo(models.BrowseNodeInfo):
208262
browse_nodes: List[ApiBrowseNode]
209263
website_sales_rank: ApiWebsiteSalesRank
210264

265+
211266
"""Main model"""
267+
268+
212269
class Item(models.Item):
213270
asin: str
214271
browse_node_info: ApiBrowseNodeInfo

amazon_paapi/sdk/models/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
https://webservices.amazon.com/paapi5/documentation/index.html # noqa: E501
2626
"""
2727

28-
2928
# import models into model package
3029
from .availability import Availability
3130
from .browse_node import BrowseNode
@@ -88,6 +87,7 @@
8887
from .offers import Offers
8988
from .partner_type import PartnerType
9089
from .price import Price
90+
from .price_type import PriceType
9191
from .product_advertising_api_client_exception import ProductAdvertisingAPIClientException
9292
from .product_advertising_api_service_exception import ProductAdvertisingAPIServiceException
9393
from .product_info import ProductInfo

amazon_paapi/sdk/models/offer_price.py

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import six
3030

3131
from .offer_savings import OfferSavings # noqa: F401,E501
32+
from .price_type import PriceType # noqa: F401,E501
3233

3334

3435
class OfferPrice(object):
@@ -49,6 +50,8 @@ class OfferPrice(object):
4950
'currency': 'str',
5051
'display_amount': 'str',
5152
'price_per_unit': 'float',
53+
'price_type': 'PriceType',
54+
'price_type_label': 'str',
5255
'savings': 'OfferSavings'
5356
}
5457

@@ -57,16 +60,20 @@ class OfferPrice(object):
5760
'currency': 'Currency',
5861
'display_amount': 'DisplayAmount',
5962
'price_per_unit': 'PricePerUnit',
63+
'price_type': 'PriceType',
64+
'price_type_label': 'PriceTypeLabel',
6065
'savings': 'Savings'
6166
}
6267

63-
def __init__(self, amount=None, currency=None, display_amount=None, price_per_unit=None, savings=None): # noqa: E501
68+
def __init__(self, amount=None, currency=None, display_amount=None, price_per_unit=None, price_type=None, price_type_label=None, savings=None): # noqa: E501
6469
"""OfferPrice - a model defined in Swagger""" # noqa: E501
6570

6671
self._amount = None
6772
self._currency = None
6873
self._display_amount = None
6974
self._price_per_unit = None
75+
self._price_type = None
76+
self._price_type_label = None
7077
self._savings = None
7178
self.discriminator = None
7279

@@ -78,6 +85,10 @@ def __init__(self, amount=None, currency=None, display_amount=None, price_per_un
7885
self.display_amount = display_amount
7986
if price_per_unit is not None:
8087
self.price_per_unit = price_per_unit
88+
if price_type is not None:
89+
self.price_type = price_type
90+
if price_type_label is not None:
91+
self.price_type_label = price_type_label
8192
if savings is not None:
8293
self.savings = savings
8394

@@ -165,6 +176,48 @@ def price_per_unit(self, price_per_unit):
165176

166177
self._price_per_unit = price_per_unit
167178

179+
@property
180+
def price_type(self):
181+
"""Gets the price_type of this OfferPrice. # noqa: E501
182+
183+
184+
:return: The price_type of this OfferPrice. # noqa: E501
185+
:rtype: PriceType
186+
"""
187+
return self._price_type
188+
189+
@price_type.setter
190+
def price_type(self, price_type):
191+
"""Sets the price_type of this OfferPrice.
192+
193+
194+
:param price_type: The price_type of this OfferPrice. # noqa: E501
195+
:type: PriceType
196+
"""
197+
198+
self._price_type = price_type
199+
200+
@property
201+
def price_type_label(self):
202+
"""Gets the price_type_label of this OfferPrice. # noqa: E501
203+
204+
205+
:return: The price_type_label of this OfferPrice. # noqa: E501
206+
:rtype: str
207+
"""
208+
return self._price_type_label
209+
210+
@price_type_label.setter
211+
def price_type_label(self, price_type_label):
212+
"""Sets the price_type_label of this OfferPrice.
213+
214+
215+
:param price_type_label: The price_type_label of this OfferPrice. # noqa: E501
216+
:type: str
217+
"""
218+
219+
self._price_type_label = price_type_label
220+
168221
@property
169222
def savings(self):
170223
"""Gets the savings of this OfferPrice. # noqa: E501

0 commit comments

Comments
 (0)