lingxingapi 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of lingxingapi might be problematic. Click here for more details.
- lingxingapi/__init__.py +7 -0
- lingxingapi/ads/__init__.py +0 -0
- lingxingapi/ads/api.py +5946 -0
- lingxingapi/ads/param.py +192 -0
- lingxingapi/ads/route.py +134 -0
- lingxingapi/ads/schema.py +2615 -0
- lingxingapi/api.py +443 -0
- lingxingapi/base/__init__.py +0 -0
- lingxingapi/base/api.py +409 -0
- lingxingapi/base/param.py +59 -0
- lingxingapi/base/route.py +11 -0
- lingxingapi/base/schema.py +198 -0
- lingxingapi/basic/__init__.py +0 -0
- lingxingapi/basic/api.py +466 -0
- lingxingapi/basic/param.py +72 -0
- lingxingapi/basic/route.py +20 -0
- lingxingapi/basic/schema.py +212 -0
- lingxingapi/errors.py +143 -0
- lingxingapi/fba/__init__.py +0 -0
- lingxingapi/fba/api.py +1691 -0
- lingxingapi/fba/param.py +250 -0
- lingxingapi/fba/route.py +30 -0
- lingxingapi/fba/schema.py +987 -0
- lingxingapi/fields.py +50 -0
- lingxingapi/finance/__init__.py +0 -0
- lingxingapi/finance/api.py +3091 -0
- lingxingapi/finance/param.py +616 -0
- lingxingapi/finance/route.py +44 -0
- lingxingapi/finance/schema.py +1243 -0
- lingxingapi/product/__init__.py +0 -0
- lingxingapi/product/api.py +2643 -0
- lingxingapi/product/param.py +934 -0
- lingxingapi/product/route.py +49 -0
- lingxingapi/product/schema.py +1004 -0
- lingxingapi/purchase/__init__.py +0 -0
- lingxingapi/purchase/api.py +496 -0
- lingxingapi/purchase/param.py +126 -0
- lingxingapi/purchase/route.py +11 -0
- lingxingapi/purchase/schema.py +215 -0
- lingxingapi/sales/__init__.py +0 -0
- lingxingapi/sales/api.py +3200 -0
- lingxingapi/sales/param.py +723 -0
- lingxingapi/sales/route.py +70 -0
- lingxingapi/sales/schema.py +1718 -0
- lingxingapi/source/__init__.py +0 -0
- lingxingapi/source/api.py +1799 -0
- lingxingapi/source/param.py +176 -0
- lingxingapi/source/route.py +38 -0
- lingxingapi/source/schema.py +1011 -0
- lingxingapi/tools/__init__.py +0 -0
- lingxingapi/tools/api.py +291 -0
- lingxingapi/tools/param.py +73 -0
- lingxingapi/tools/route.py +8 -0
- lingxingapi/tools/schema.py +169 -0
- lingxingapi/utils.py +411 -0
- lingxingapi/warehourse/__init__.py +0 -0
- lingxingapi/warehourse/api.py +1778 -0
- lingxingapi/warehourse/param.py +506 -0
- lingxingapi/warehourse/route.py +28 -0
- lingxingapi/warehourse/schema.py +926 -0
- lingxingapi-1.0.0.dist-info/METADATA +67 -0
- lingxingapi-1.0.0.dist-info/RECORD +65 -0
- lingxingapi-1.0.0.dist-info/WHEEL +5 -0
- lingxingapi-1.0.0.dist-info/licenses/LICENSE +22 -0
- lingxingapi-1.0.0.dist-info/top_level.txt +1 -0
lingxingapi/fba/param.py
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from typing import Optional
|
|
3
|
+
from pydantic import ValidationInfo, Field, field_validator
|
|
4
|
+
from lingxingapi import utils
|
|
5
|
+
from lingxingapi.base.param import Parameter, PageOffestAndLength
|
|
6
|
+
from lingxingapi.fields import NonEmptyStr, NonNegativeInt
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# 共享参数 ---------------------------------------------------------------------------------------------------------------------
|
|
10
|
+
# . STA Plan ID
|
|
11
|
+
class StaID(Parameter):
|
|
12
|
+
"""查询STA计划ID参数"""
|
|
13
|
+
|
|
14
|
+
# 领星店铺ID
|
|
15
|
+
sid: NonNegativeInt
|
|
16
|
+
# STA计划ID
|
|
17
|
+
inbound_plan_id: NonEmptyStr = Field(alias="inboundPlanId")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# FBA - FBA货件 (STA) ----------------------------------------------------------------------------------------------------------
|
|
21
|
+
# . STA Plans
|
|
22
|
+
class StaPlans(Parameter):
|
|
23
|
+
"""查询STA计划参数"""
|
|
24
|
+
|
|
25
|
+
# 开始日期 (北京时间), 双闭区间, 格式: YYYY-MM-DD
|
|
26
|
+
start_date: str = Field(alias="dateBegin")
|
|
27
|
+
# 结束日期 (北京时间), 双闭区间, 格式: YYYY-MM-DD
|
|
28
|
+
end_date: str = Field(alias="dateEnd")
|
|
29
|
+
# 日期类型 (1: 创建日期; 2: 更新日期)
|
|
30
|
+
date_type: NonNegativeInt = Field(alias="dateType")
|
|
31
|
+
# STA计划名称 (模糊搜索)
|
|
32
|
+
plan_name: Optional[NonEmptyStr] = Field(None, alias="planName")
|
|
33
|
+
# 货件ID或货件单号列表 (精确搜索)
|
|
34
|
+
shipment_ids: Optional[list] = Field(None, alias="shipmentIdList")
|
|
35
|
+
# STA计划状态列表 ('ACTIVE', 'VOIDED', 'SHIPPED', 'ERRORED')
|
|
36
|
+
statuses: Optional[list] = Field(None, alias="statusList")
|
|
37
|
+
# 领星店铺ID列表
|
|
38
|
+
sids: Optional[list] = None
|
|
39
|
+
# 分页页码
|
|
40
|
+
page: NonNegativeInt = 1
|
|
41
|
+
# 分页大小
|
|
42
|
+
length: NonNegativeInt = 200
|
|
43
|
+
|
|
44
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
45
|
+
@field_validator("start_date", "end_date", mode="before")
|
|
46
|
+
@classmethod
|
|
47
|
+
def _validate_date(cls, v, info: ValidationInfo) -> str:
|
|
48
|
+
dt = utils.validate_datetime(v, False, "日期 %s" % info.field_name)
|
|
49
|
+
return "%04d-%02d-%02d" % (dt.year, dt.month, dt.day)
|
|
50
|
+
|
|
51
|
+
@field_validator("shipment_ids", mode="before")
|
|
52
|
+
@classmethod
|
|
53
|
+
def _validate_shipment_ids(cls, v) -> list[str] | None:
|
|
54
|
+
if v is None:
|
|
55
|
+
return None
|
|
56
|
+
return utils.validate_array_of_non_empty_str(
|
|
57
|
+
v, "货件ID或货件单号列表 shipment_ids"
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
@field_validator("statuses", mode="before")
|
|
61
|
+
@classmethod
|
|
62
|
+
def _validate_statuses(cls, v) -> list[str] | None:
|
|
63
|
+
if v is None:
|
|
64
|
+
return None
|
|
65
|
+
return utils.validate_array_of_non_empty_str(v, "STA计划状态列表 statuses")
|
|
66
|
+
|
|
67
|
+
@field_validator("sids", mode="before")
|
|
68
|
+
@classmethod
|
|
69
|
+
def _validate_sids(cls, v) -> list[int] | None:
|
|
70
|
+
if v is None:
|
|
71
|
+
return None
|
|
72
|
+
return utils.validate_array_of_unsigned_int(v, "领星店铺ID列表 sids")
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
# . Packing Group Boxes
|
|
76
|
+
class PackingGroupBoxes(StaID):
|
|
77
|
+
"""查询包装箱信息参数"""
|
|
78
|
+
|
|
79
|
+
packing_group_ids: list = Field(alias="packingGroupIdList")
|
|
80
|
+
|
|
81
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
82
|
+
@field_validator("packing_group_ids", mode="before")
|
|
83
|
+
@classmethod
|
|
84
|
+
def _validate_packing_group_ids(cls, v) -> list[str]:
|
|
85
|
+
return utils.validate_array_of_non_empty_str(
|
|
86
|
+
v, "包装箱ID列表 packing_group_ids"
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
# . Shipments
|
|
91
|
+
class Shipments(PageOffestAndLength):
|
|
92
|
+
"""查询FBA货件列表参数"""
|
|
93
|
+
|
|
94
|
+
# 领星店铺IDs (多个ID用逗号分隔)
|
|
95
|
+
sids: NonEmptyStr = Field(alias="sid")
|
|
96
|
+
# 货件创建开始日期, 左闭右开
|
|
97
|
+
start_date: str
|
|
98
|
+
# 货件创建结束日期, 左闭右开
|
|
99
|
+
end_date: str
|
|
100
|
+
# 子筛选开始日期, 左闭右开
|
|
101
|
+
sub_start_date: Optional[str] = Field(None, alias="start_extra_date")
|
|
102
|
+
# 子筛选结束日期, 左闭右开
|
|
103
|
+
sub_end_date: Optional[str] = Field(None, alias="end_extra_date")
|
|
104
|
+
# 子筛选日期类型 (1: 货件修改日期)
|
|
105
|
+
sub_date_type: Optional[str] = Field(None, alias="extra_date_field")
|
|
106
|
+
# 货件IDs (多个ID用逗号分隔)
|
|
107
|
+
shipment_ids: Optional[str] = Field(None, alias="shipment_id")
|
|
108
|
+
# 货件状态 (多个状态用逗号分隔)
|
|
109
|
+
# ('DELETED', 'CLOSED', 'CANCELLED', 'WORKING', 'RECEIVING', 'SHIPPED', 'READY_TO_SHIP')
|
|
110
|
+
shipment_statuses: Optional[str] = Field(None, alias="shipment_status")
|
|
111
|
+
|
|
112
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
113
|
+
@field_validator("sids", mode="before")
|
|
114
|
+
@classmethod
|
|
115
|
+
def _validate_sids(cls, v) -> str:
|
|
116
|
+
ids = utils.validate_array_of_unsigned_int(v, "领星店铺ID列表 sids")
|
|
117
|
+
return ",".join(map(str, ids))
|
|
118
|
+
|
|
119
|
+
@field_validator("start_date", "end_date", mode="before")
|
|
120
|
+
@classmethod
|
|
121
|
+
def _validate_date(cls, v, info: ValidationInfo) -> str:
|
|
122
|
+
dt = utils.validate_datetime(v, False, "日期 %s" % info.field_name)
|
|
123
|
+
return "%04d-%02d-%02d" % (dt.year, dt.month, dt.day)
|
|
124
|
+
|
|
125
|
+
@field_validator("sub_start_date", "sub_end_date", mode="before")
|
|
126
|
+
@classmethod
|
|
127
|
+
def _validate_sub_date(cls, v, info: ValidationInfo) -> str | None:
|
|
128
|
+
if v is None:
|
|
129
|
+
return None
|
|
130
|
+
dt = utils.validate_datetime(v, False, "日期 %s" % info.field_name)
|
|
131
|
+
return "%04d-%02d-%02d" % (dt.year, dt.month, dt.day)
|
|
132
|
+
|
|
133
|
+
@field_validator("sub_date_type", mode="before")
|
|
134
|
+
@classmethod
|
|
135
|
+
def _validate_sub_date_type(cls, v) -> str | None:
|
|
136
|
+
if v is None:
|
|
137
|
+
return None
|
|
138
|
+
if v == 1:
|
|
139
|
+
return "update"
|
|
140
|
+
if v == "update":
|
|
141
|
+
return v
|
|
142
|
+
raise ValueError("子筛选日期类型 sub_date_type 只能为 (1: 货件修改日期)")
|
|
143
|
+
|
|
144
|
+
@field_validator("shipment_ids", mode="before")
|
|
145
|
+
@classmethod
|
|
146
|
+
def _validate_shipment_ids(cls, v) -> str | None:
|
|
147
|
+
if v is None:
|
|
148
|
+
return None
|
|
149
|
+
ids = utils.validate_array_of_non_empty_str(v, "货件IDs shipment_ids")
|
|
150
|
+
return ",".join(ids)
|
|
151
|
+
|
|
152
|
+
@field_validator("shipment_statuses", mode="before")
|
|
153
|
+
@classmethod
|
|
154
|
+
def _validate_shipment_statuses(cls, v) -> str | None:
|
|
155
|
+
if v is None:
|
|
156
|
+
return None
|
|
157
|
+
statuses = utils.validate_array_of_non_empty_str(
|
|
158
|
+
v, "货件状态 shipment_statuses"
|
|
159
|
+
)
|
|
160
|
+
return ",".join(statuses)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
# . Shipment Details
|
|
164
|
+
class ShipmentDetails(StaID):
|
|
165
|
+
"""查询FBA货件详情参数"""
|
|
166
|
+
|
|
167
|
+
# FBA货件ID
|
|
168
|
+
shipment_ids: list[str] = Field(alias="shipmentIds")
|
|
169
|
+
|
|
170
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
171
|
+
@field_validator("shipment_ids", mode="before")
|
|
172
|
+
@classmethod
|
|
173
|
+
def _validate_shipment_ids(cls, v) -> list[str]:
|
|
174
|
+
return utils.validate_array_of_non_empty_str(v, "FBA货件IDs shipment_ids")
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
# . Shipment Boxes
|
|
178
|
+
class ShipmentBoxes(StaID):
|
|
179
|
+
"""查询FBA货件箱子信息参数"""
|
|
180
|
+
|
|
181
|
+
# FBA货件ID
|
|
182
|
+
shipment_ids: list[str] = Field(alias="shipmentIdList")
|
|
183
|
+
|
|
184
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
185
|
+
@field_validator("shipment_ids", mode="before")
|
|
186
|
+
@classmethod
|
|
187
|
+
def _validate_shipment_ids(cls, v) -> list[str]:
|
|
188
|
+
return utils.validate_array_of_non_empty_str(v, "FBA货件IDs shipment_ids")
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
# . Shipment Transports
|
|
192
|
+
class ShipmentTransports(StaID):
|
|
193
|
+
"""查询STA计划ID和货件ID参数"""
|
|
194
|
+
|
|
195
|
+
# FBA货件ID
|
|
196
|
+
shipment_id: NonEmptyStr = Field(alias="shipmentId")
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
# . Shipment Receipt
|
|
200
|
+
class ShipmentReceiptRecords(PageOffestAndLength):
|
|
201
|
+
"""查询FBA货件收货信息参数"""
|
|
202
|
+
|
|
203
|
+
# 领星店铺ID
|
|
204
|
+
sid: NonNegativeInt
|
|
205
|
+
# 收件日期
|
|
206
|
+
date: str = Field(alias="event_date")
|
|
207
|
+
# FBA货件单号
|
|
208
|
+
shipment_ids: Optional[list] = Field(None, alias="fba_shipment_id")
|
|
209
|
+
|
|
210
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
211
|
+
@field_validator("date", mode="before")
|
|
212
|
+
@classmethod
|
|
213
|
+
def _validate_date(cls, v) -> str:
|
|
214
|
+
dt = utils.validate_datetime(v, False, "收件日期 date")
|
|
215
|
+
return "%04d-%02d-%02d" % (dt.year, dt.month, dt.day)
|
|
216
|
+
|
|
217
|
+
@field_validator("shipment_ids", mode="before")
|
|
218
|
+
@classmethod
|
|
219
|
+
def _validate_shipment_ids(cls, v) -> list[str] | None:
|
|
220
|
+
if v is None:
|
|
221
|
+
return None
|
|
222
|
+
return utils.validate_array_of_non_empty_str(v, "FBA货件单号列表 shipment_ids")
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
# . Shipment Delivery Address
|
|
226
|
+
class ShipmentDeliveryAddress(Parameter):
|
|
227
|
+
"""查询FBA货件收货地址参数"""
|
|
228
|
+
|
|
229
|
+
# 货件唯一记录ID (Shipment.id)
|
|
230
|
+
id: NonNegativeInt
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
# . Ship From Addresses
|
|
234
|
+
class ShipFromAddresses(PageOffestAndLength):
|
|
235
|
+
"""查询FBA货件发货地址参数"""
|
|
236
|
+
|
|
237
|
+
# 领星店铺ID
|
|
238
|
+
sids: Optional[list] = Field(None, alias="sid")
|
|
239
|
+
# 搜索字段 ('alias_name', 'sender_name')
|
|
240
|
+
search_field: Optional[NonEmptyStr] = None
|
|
241
|
+
# 搜索内容 (模糊搜索)
|
|
242
|
+
search_value: Optional[NonEmptyStr] = None
|
|
243
|
+
|
|
244
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
245
|
+
@field_validator("sids", mode="before")
|
|
246
|
+
@classmethod
|
|
247
|
+
def _validate_sids(cls, v) -> list[int] | None:
|
|
248
|
+
if v is None:
|
|
249
|
+
return None
|
|
250
|
+
return utils.validate_array_of_unsigned_int(v, "领星店铺ID列表 sids")
|
lingxingapi/fba/route.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
# fmt: off
|
|
4
|
+
# FBA - FBA货件 (STA) ----------------------------------------------------------------------------------------------------------
|
|
5
|
+
# https://apidoc.lingxing.com/#/docs/FBA/QuerySTATaskList
|
|
6
|
+
STA_PLANS: str = "/amzStaServer/openapi/inbound-plan/page"
|
|
7
|
+
# https://apidoc.lingxing.com/#/docs/FBA/StaTaskDetail
|
|
8
|
+
STA_PLAN_DETAIL: str = "/amzStaServer/openapi/inbound-plan/detail"
|
|
9
|
+
# https://apidoc.lingxing.com/#/docs/FBA/ListPackingGroupItems
|
|
10
|
+
PACKING_GROUPS: str = "/amzStaServer/openapi/inbound-packing/listPackingGroupItems"
|
|
11
|
+
# https://apidoc.lingxing.com/#/docs/FBA/QuerySTATaskBoxInformation
|
|
12
|
+
PACKING_GROUP_BOXES: str = "/amzStaServer/openapi/inbound-plan/listInboundPlanGroupPacking"
|
|
13
|
+
# https://apidoc.lingxing.com/#/docs/FBA/ShipmentPreView
|
|
14
|
+
PLACEMENT_OPTIONS: str = "/amzStaServer/openapi/inbound-shipment/shipmentPreView"
|
|
15
|
+
# https://apidoc.lingxing.com/#/docs/FBA/getInboundPackingBoxInfo
|
|
16
|
+
PLACEMENT_OPTION_BOXES: str = "/amzStaServer/openapi/inbound-packing/getInboundPackingBoxInfo"
|
|
17
|
+
# https://apidoc.lingxing.com/#/docs/FBA/FBAShipmentList
|
|
18
|
+
SHIPMENTS: str = "/erp/sc/data/fba_report/shipmentList"
|
|
19
|
+
# https://apidoc.lingxing.com/#/docs/FBA/ShipmentDetailList
|
|
20
|
+
SHIPMENT_DETAILS: str = "/amzStaServer/openapi/inbound-shipment/shipmentDetailList"
|
|
21
|
+
# https://apidoc.lingxing.com/#/docs/FBA/ListShipmentBoxes
|
|
22
|
+
SHIPMENT_BOXES: str = "/amzStaServer/openapi/inbound-shipment/listShipmentBoxes"
|
|
23
|
+
# https://apidoc.lingxing.com/#/docs/FBA/GetTransportList
|
|
24
|
+
SHIPMENT_TRANSPORTS: str = "/amzStaServer/openapi/inbound-shipment/getTransportList"
|
|
25
|
+
# https://apidoc.lingxing.com/#/docs/FBA/FBAReceivedInventory
|
|
26
|
+
SHIPMENT_RECEIPT_RECORDS: str = "/erp/sc/data/fba_report/receivedInventory"
|
|
27
|
+
# https://apidoc.lingxing.com/#/docs/FBA/ShoppingAddress
|
|
28
|
+
SHIPMENT_DELIVERY_ADDRESS: str = "/basicOpen/openapi/fbaShipment/shoppingAddress"
|
|
29
|
+
# https://apidoc.lingxing.com/#/docs/FBA/ShipFromAddressList
|
|
30
|
+
SHIP_FROM_ADDRESSES: str = "/erp/sc/routing/fba/shipment/shipFromAddressList"
|