| POST, GET | /api/InventoryDetail |
|---|
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 BaseRequest:
# @ApiMember(DataType="string", Description="This is your AIM API Key provided by Tri-Tech", IsRequired=true, Name="ApiKey", ParameterType="Header")
api_key: Optional[str] = None
"""
This is your AIM API Key provided by Tri-Tech
"""
# @ApiMember(DataType="string", Description="The OAuthToken token return by AeServices30", IsRequired=true, Name="OAuthToken", ParameterType="Header")
o_auth_token: Optional[str] = None
"""
The OAuthToken token return by AeServices30
"""
# @ApiMember(DataType="string", Description="The Device ID of the Mobile Device. Not used for non-mobile devices.", Name="DeviceId", ParameterType="Header")
device_id: Optional[str] = None
"""
The Device ID of the Mobile Device. Not used for non-mobile devices.
"""
# @ApiMember(DataType="string", Description="An identifier for your integration", IsRequired=true, Name="AppId", ParameterType="Header")
app_id: Optional[str] = None
"""
An identifier for your integration
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BaseSecureRequest(BaseRequest):
# @ApiMember(DataType="string", Description="The Login Token return by the Security API. Required for secured calls.", Name="Token", ParameterType="Header")
token: Optional[str] = None
"""
The Login Token return by the Security API. Required for secured calls.
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BaseResponseResult:
# @ApiMember(DataType="string", Description="", Name="StatusCode", ParameterType="body")
status_code: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="Login", ParameterType="body")
login: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="ErrorCode", ParameterType="body")
error_code: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="ErrorDisplayText", ParameterType="body")
error_display_text: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="ErrorMessage", ParameterType="body")
error_message: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="DomainName", ParameterType="body")
domain_name: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="IPAddress", ParameterType="body")
ip_address: Optional[str] = None
"""
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BaseResponse:
# @ApiMember(DataType="BaseResponseResult", Description="", Name="Status", ParameterType="body")
status: Optional[BaseResponseResult] = None
"""
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ImageInfo:
url: Optional[str] = None
image_stream: Optional[str] = None
image_size: Optional[str] = None
error_message: Optional[str] = None
uri_pk: Optional[int] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InventoryDetailAttribute:
name: Optional[str] = None
value: Optional[str] = None
priority: int = 0
# @ApiMember(DataType="int", Description="1 is 'Don't Send to Web', 2 is 'Send To Web'", Name="WebType", ParameterType="query")
web_type: int = 0
"""
1 is 'Don't Send to Web', 2 is 'Send To Web'
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class LocationInfo:
id: int = 0
desc: Optional[str] = None
short_desc: Optional[str] = None
region: Optional[str] = None
latitude: Decimal = decimal.Decimal(0)
longitude: Decimal = decimal.Decimal(0)
in_store_pickup: Optional[str] = None
active: bool = False
cash_sale_acct: Optional[int] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InventoryDetailBySerial:
sas_pk: int = 0
serial: Optional[str] = None
retail: Decimal = decimal.Decimal(0)
our_price: Decimal = decimal.Decimal(0)
sale_price: Optional[Decimal] = None
status: Optional[str] = None
sale_info: Optional[str] = None
price_a: Decimal = decimal.Decimal(0)
price_b: Decimal = decimal.Decimal(0)
price_c: Decimal = decimal.Decimal(0)
min_price: Decimal = decimal.Decimal(0)
active_e_price: Decimal = decimal.Decimal(0)
allow_price_change: bool = False
cost: Optional[Decimal] = None
weighted_cost: Optional[Decimal] = None
notes: Optional[str] = None
attributes: Optional[List[InventoryDetailAttribute]] = None
images: Optional[List[ImageInfo]] = None
has_images: bool = False
is_activee_holdback: bool = False
customer_acct: Optional[int] = None
available_for_s_t_r: bool = False
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InventoryDetailSubstitute:
model: Optional[str] = None
sku: Optional[str] = None
mfg: Optional[str] = None
description: Optional[str] = None
price: Decimal = decimal.Decimal(0)
available_qty: Decimal = decimal.Decimal(0)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InventoryDetailByLocation:
saq_pk: int = 0
location_info: Optional[LocationInfo] = None
serials: Optional[List[InventoryDetailBySerial]] = None
substitutes: Optional[List[InventoryDetailSubstitute]] = None
retail: Decimal = decimal.Decimal(0)
our_price: Decimal = decimal.Decimal(0)
sale_price: Optional[Decimal] = None
sale_info: Optional[str] = None
price_a: Decimal = decimal.Decimal(0)
price_b: Decimal = decimal.Decimal(0)
price_c: Decimal = decimal.Decimal(0)
min_price: Decimal = decimal.Decimal(0)
active_e_price: Decimal = decimal.Decimal(0)
customer_price: Decimal = decimal.Decimal(0)
allow_price_change: bool = False
qty: Decimal = decimal.Decimal(0)
qty_avail: Decimal = decimal.Decimal(0)
activee_holdback_qty: Decimal = decimal.Decimal(0)
reorder_min: int = 0
reorder_max: int = 0
average_cost: Optional[Decimal] = None
weighted_cost: Optional[Decimal] = None
locator: Optional[str] = None
selection_code: Optional[str] = None
selection_code_description: Optional[str] = None
spiff: Decimal = decimal.Decimal(0)
current_spot_check_qty: Optional[Decimal] = None
qty_out: Decimal = decimal.Decimal(0)
qty_on_order: Decimal = decimal.Decimal(0)
available_for_s_t_r: Decimal = decimal.Decimal(0)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InventoryDetailByVariant:
sku_pk: int = 0
sku: Optional[str] = None
vendor_cost: Optional[Decimal] = None
vendor_name: Optional[str] = None
attributes: Optional[List[InventoryDetailAttribute]] = None
location_details: Optional[List[InventoryDetailByLocation]] = None
images: Optional[List[ImageInfo]] = None
has_images: bool = False
barcodes: Optional[List[str]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AddOnDetail:
sad_pk: int = 0
sku_pk: int = 0
cat_pk: int = 0
sub_pk: int = 0
item: Optional[str] = None
description: Optional[str] = None
price: Decimal = decimal.Decimal(0)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ActiveEInfo:
dimension: Optional[str] = None
web_description: Optional[str] = None
summary: Optional[str] = None
se_title: Optional[str] = None
se_description: Optional[str] = None
se_keywords: Optional[str] = None
se_alt_text: Optional[str] = None
se_html_free_text: Optional[str] = None
unpublished: bool = False
free_shipping: bool = False
is_featured: bool = False
web_category_ids: Optional[List[int]] = None
hide_price: bool = False
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InventoryDetailResponse(BaseResponse):
sad_pk: int = 0
inv_type: Optional[str] = None
model: Optional[str] = None
description: Optional[str] = None
mfg: Optional[str] = None
category: int = 0
category_description: Optional[str] = None
sub_category: int = 0
sub_category_description: Optional[str] = None
selection_code: Optional[str] = None
selection_code_description: Optional[str] = None
sell_serials_online: bool = False
notes: Optional[str] = None
images: Optional[List[ImageInfo]] = None
has_images: bool = False
variant_details: Optional[List[InventoryDetailByVariant]] = None
add_ons: Optional[List[AddOnDetail]] = None
active_e_info: Optional[ActiveEInfo] = None
weight: Decimal = decimal.Decimal(0)
unit: Optional[str] = None
ship_charge: Decimal = decimal.Decimal(0)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InventoryDetailRequest(BaseSecureRequest):
"""
InventoryDetailRequires active-e Inventory Service
"""
# @ApiMember(DataType="integer", Description="The PK being used for lookup. Can be used in conjunction with PkType. Do not use if Model is passed in.", Format="int64", Name="Pk", ParameterType="query")
pk: Optional[int] = None
"""
The PK being used for lookup. Can be used in conjunction with PkType. Do not use if Model is passed in.
"""
# @ApiMember(DataType="string", Description="The type of PK being used for lookup. Can be SAD, SKU, SAS, or EXT. Only used if PK is passed in. Defaults to SAD if not sent.", Name="PkType", ParameterType="query")
pk_type: Optional[str] = None
"""
The type of PK being used for lookup. Can be SAD, SKU, SAS, or EXT. Only used if PK is passed in. Defaults to SAD if not sent.
"""
# @ApiMember(DataType="string", Description="The Model being used for lookup. Do not use if Pk is passed in.", Name="Model", ParameterType="query")
model: Optional[str] = None
"""
The Model being used for lookup. Do not use if Pk is passed in.
"""
skip_images: bool = False
include_serial_info: bool = False
# @ApiMember(DataType="integer", Description="If sent, the Customer Acct will be used for customer specific pricing.", Format="int32", Name="CustomerAcct", ParameterType="query")
customer_acct: Optional[int] = None
"""
If sent, the Customer Acct will be used for customer specific pricing.
"""
Python InventoryDetailRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/InventoryDetail HTTP/1.1
Host: active-ewebservice.biz
Accept: application/json
Content-Type: application/json
Content-Length: length
{"Pk":0,"PkType":"String","Model":"String","SkipImages":false,"IncludeSerialInfo":false,"CustomerAcct":0,"Token":"String","ApiKey":"String","OAuthToken":"String","DeviceId":"String","AppId":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"SadPk":0,"InvType":"String","Model":"String","Description":"String","Mfg":"String","Category":0,"CategoryDescription":"String","SubCategory":0,"SubCategoryDescription":"String","SelectionCode":"String","SelectionCodeDescription":"String","SellSerialsOnline":false,"Notes":"String","Images":[{"Url":"String","ImageStream":"String","ImageSize":"String","ErrorMessage":"String","UriPk":0}],"HasImages":true,"VariantDetails":[{}],"AddOns":[{}],"ActiveEInfo":{"Dimension":"String","WebDescription":"String","Summary":"String","SETitle":"String","SEDescription":"String","SEKeywords":"String","SEAltText":"String","SEHtmlFreeText":"String","Unpublished":false,"FreeShipping":false,"IsFeatured":false,"WebCategoryIds":[0],"HidePrice":false},"Weight":0,"Unit":"String","ShipCharge":0,"Status":{"StatusCode":"String","Login":"String","ErrorCode":"String","ErrorDisplayText":"String","ErrorMessage":"String","DomainName":"String","IpAddress":"String"}}