| GET | /stock/{brand} | Get stock |
|---|
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class StockRequest:
# @ApiMember(Description="Brand", IsRequired=true)
brand: Optional[str] = None
"""
Brand
"""
# @ApiMember(Description="POS Legacy")
pos_codes: Optional[List[str]] = None
"""
POS Legacy
"""
# @ApiMember(Description="Article Codes")
article_codes: Optional[List[str]] = None
"""
Article Codes
"""
# @ApiMember(Description="Include Extra Info")
include_extra_info: bool = False
"""
Include Extra Info
"""
# @ApiMember(Description="Cluster Id")
cluster_ids: Optional[List[str]] = None
"""
Cluster Id
"""
# @ApiMember(Description="Include Consignment NotAuthorized POS")
include_consignment_not_authorized_p_o_s: bool = False
"""
Include Consignment NotAuthorized POS
"""
# @ApiMember(Description="Include Retail Sales Price in the Output, by default: false")
include_r_s_p: bool = False
"""
Include Retail Sales Price in the Output, by default: false
"""
# @ApiMember(Description="In Stock Since date from ")
date_from: Optional[datetime.datetime] = None
"""
In Stock Since date from
"""
# @ApiMember(Description="In Stock Since date to")
date_to: Optional[datetime.datetime] = None
"""
In Stock Since date to
"""
# @ApiMember(Description="Item type, 'standard' OR 'consigned'. By default, all are coming")
type: Optional[str] = None
"""
Item type, 'standard' OR 'consigned'. By default, all are coming
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Pos:
# @ApiMember(Description="Name of the POS", IsRequired=true)
name: Optional[str] = None
"""
Name of the POS
"""
# @ApiMember(Description="POS Code", IsRequired=true)
pos_code: Optional[str] = None
"""
POS Code
"""
# @ApiMember(Description="Pos Code To Be Displayed", IsRequired=true)
pos_code_to_be_displayed: Optional[str] = None
"""
Pos Code To Be Displayed
"""
# @ApiMember(Description="Country of the POS", IsRequired=true)
country: Optional[str] = None
"""
Country of the POS
"""
# @ApiMember(Description="City of the POS", IsRequired=true)
city: Optional[str] = None
"""
City of the POS
"""
# @ApiMember(Description="Postal Code", IsRequired=true)
postal_code: Optional[str] = None
"""
Postal Code
"""
# @ApiMember(Description="State", IsRequired=true)
state: Optional[str] = None
"""
State
"""
# @ApiMember(Description="Street", IsRequired=true)
street: Optional[str] = None
"""
Street
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class UnitNetAmount:
# @ApiMember(Description="Currency Iso Code", IsRequired=true)
currency_iso_code: Optional[str] = None
"""
Currency Iso Code
"""
# @ApiMember(Description="Value", IsRequired=true)
value: Optional[Decimal] = None
"""
Value
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class StockPositionItem:
# @ApiMember(Description="Quantity", IsRequired=true)
quantity: int = 0
"""
Quantity
"""
# @ApiMember(Description="Serial Number")
serial_number: Optional[str] = None
"""
Serial Number
"""
# @ApiMember(Description="Stock Date", IsRequired=true)
stock_date: Optional[str] = None
"""
Stock Date
"""
# @ApiMember(Description="Loaded On Date", IsRequired=true)
loaded_on_date: Optional[str] = None
"""
Loaded On Date
"""
# @ApiMember(Description="Type e.g. consignment or standard", IsRequired=true)
type: Optional[str] = None
"""
Type e.g. consignment or standard
"""
# @ApiMember(Description="Is Consignment Sellable ", IsRequired=true)
is_consignment_sellable: bool = False
"""
Is Consignment Sellable
"""
# @ApiMember(Description="Sell-In Price. Disclaimer: this data will be arriving empty/null due to DealerCost project still being in test phase.")
unit_net_amount: Optional[UnitNetAmount] = None
"""
Sell-In Price. Disclaimer: this data will be arriving empty/null due to DealerCost project still being in test phase.
"""
# @ApiMember(Description="Retail Sales Price")
retail_sales_price: Optional[UnitNetAmount] = None
"""
Retail Sales Price
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class StockItem:
# @ApiMember(Description="Article Code", IsRequired=true)
article_code: Optional[str] = None
"""
Article Code
"""
# @ApiMember(Description="Current Stock Quantity", IsRequired=true)
current_stock_quantity: int = 0
"""
Current Stock Quantity
"""
# @ApiMember(Description="Serial Numbers")
serial_numbers: Optional[List[str]] = None
"""
Serial Numbers
"""
# @ApiMember(Description="Stock Item in Details", IsRequired=true)
stock_positions: Optional[List[StockPositionItem]] = None
"""
Stock Item in Details
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PosStockItem:
# @ApiMember(Description="Brand", IsRequired=true)
brand: Optional[str] = None
"""
Brand
"""
# @ApiMember(Description="Pos Code", IsRequired=true)
pos_code: Optional[str] = None
"""
Pos Code
"""
# @ApiMember(Description="Shared Stock Location", IsRequired=true)
shared_stock_location: Optional[Pos] = None
"""
Shared Stock Location
"""
# @ApiMember(Description="Stock Items")
stock_items: Optional[List[StockItem]] = None
"""
Stock Items
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetStockResponse(List[PosStockItem]):
pass
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetStock(StockRequest):
pass
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /stock/{brand} HTTP/1.1
Host: dev-api-booster.richemont.com
Accept: text/csv
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length []