shipthisapi-python 3.0.3__tar.gz → 3.0.5__tar.gz
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.
- {shipthisapi_python-3.0.3 → shipthisapi_python-3.0.5}/PKG-INFO +1 -1
- {shipthisapi_python-3.0.3 → shipthisapi_python-3.0.5}/ShipthisAPI/__init__.py +1 -1
- {shipthisapi_python-3.0.3 → shipthisapi_python-3.0.5}/ShipthisAPI/shipthisapi.py +41 -6
- {shipthisapi_python-3.0.3 → shipthisapi_python-3.0.5}/setup.py +1 -1
- {shipthisapi_python-3.0.3 → shipthisapi_python-3.0.5}/shipthisapi_python.egg-info/PKG-INFO +1 -1
- {shipthisapi_python-3.0.3 → shipthisapi_python-3.0.5}/README.md +0 -0
- {shipthisapi_python-3.0.3 → shipthisapi_python-3.0.5}/setup.cfg +0 -0
- {shipthisapi_python-3.0.3 → shipthisapi_python-3.0.5}/shipthisapi_python.egg-info/SOURCES.txt +0 -0
- {shipthisapi_python-3.0.3 → shipthisapi_python-3.0.5}/shipthisapi_python.egg-info/dependency_links.txt +0 -0
- {shipthisapi_python-3.0.3 → shipthisapi_python-3.0.5}/shipthisapi_python.egg-info/requires.txt +0 -0
- {shipthisapi_python-3.0.3 → shipthisapi_python-3.0.5}/shipthisapi_python.egg-info/top_level.txt +0 -0
|
@@ -321,14 +321,18 @@ class ShipthisAPI:
|
|
|
321
321
|
params = {}
|
|
322
322
|
if only_fields:
|
|
323
323
|
params["only"] = only_fields
|
|
324
|
-
return await self._make_request(
|
|
324
|
+
return await self._make_request(
|
|
325
|
+
"GET", path, query_params=params if params else None
|
|
326
|
+
)
|
|
325
327
|
else:
|
|
326
328
|
params = {}
|
|
327
329
|
if filters:
|
|
328
330
|
params["query_filter_v2"] = json.dumps(filters)
|
|
329
331
|
if only_fields:
|
|
330
332
|
params["only"] = only_fields
|
|
331
|
-
resp = await self._make_request(
|
|
333
|
+
resp = await self._make_request(
|
|
334
|
+
"GET", f"incollection/{collection_name}", params
|
|
335
|
+
)
|
|
332
336
|
if isinstance(resp, dict) and resp.get("items"):
|
|
333
337
|
return resp.get("items")[0]
|
|
334
338
|
return None
|
|
@@ -378,7 +382,9 @@ class ShipthisAPI:
|
|
|
378
382
|
if not meta:
|
|
379
383
|
params["meta"] = "false"
|
|
380
384
|
|
|
381
|
-
response = await self._make_request(
|
|
385
|
+
response = await self._make_request(
|
|
386
|
+
"GET", f"incollection/{collection_name}", params
|
|
387
|
+
)
|
|
382
388
|
|
|
383
389
|
if isinstance(response, dict):
|
|
384
390
|
return response.get("items", [])
|
|
@@ -416,13 +422,25 @@ class ShipthisAPI:
|
|
|
416
422
|
)
|
|
417
423
|
|
|
418
424
|
async def create_item(
|
|
419
|
-
self,
|
|
425
|
+
self,
|
|
426
|
+
collection_name: str,
|
|
427
|
+
data: Dict[str, Any],
|
|
428
|
+
ignore_new_required: bool = False,
|
|
429
|
+
skip_sequence_if_exists: bool = False,
|
|
430
|
+
replicate_count: int = 0,
|
|
431
|
+
input_filters: Optional[Dict[str, Any]] = None,
|
|
432
|
+
action_op_data: Optional[Dict[str, Any]] = None,
|
|
420
433
|
) -> Dict[str, Any]:
|
|
421
|
-
"""Create a new item in a collection.
|
|
434
|
+
"""Create a new item in a collection with all advanced Shipthis features.
|
|
422
435
|
|
|
423
436
|
Args:
|
|
424
437
|
collection_name: Name of the collection.
|
|
425
438
|
data: Document data.
|
|
439
|
+
ignore_new_required: Ignore new required fields (default: False).
|
|
440
|
+
skip_sequence_if_exists: Skip sequence if exists (default: False).
|
|
441
|
+
replicate_count: Number of times to replicate the item (default: 0).
|
|
442
|
+
input_filters: Input filters (optional).
|
|
443
|
+
action_op_data: Action operation data (optional).
|
|
426
444
|
|
|
427
445
|
Returns:
|
|
428
446
|
Created document data.
|
|
@@ -430,10 +448,26 @@ class ShipthisAPI:
|
|
|
430
448
|
Raises:
|
|
431
449
|
ShipthisAPIError: If the request fails.
|
|
432
450
|
"""
|
|
451
|
+
params = {}
|
|
452
|
+
if replicate_count > 0:
|
|
453
|
+
params["replicate_count"] = min(replicate_count, 100)
|
|
454
|
+
if input_filters:
|
|
455
|
+
params["input_filters"] = json.dumps(input_filters)
|
|
456
|
+
|
|
457
|
+
request_payload = {
|
|
458
|
+
"reqbody": data,
|
|
459
|
+
"ignore_new_required": ignore_new_required,
|
|
460
|
+
"skip_sequence_if_exists": skip_sequence_if_exists,
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
if action_op_data:
|
|
464
|
+
request_payload["action_op_data"] = action_op_data
|
|
465
|
+
|
|
433
466
|
resp = await self._make_request(
|
|
434
467
|
"POST",
|
|
435
468
|
f"incollection/{collection_name}",
|
|
436
|
-
|
|
469
|
+
query_params=params,
|
|
470
|
+
request_data=request_payload,
|
|
437
471
|
)
|
|
438
472
|
if isinstance(resp, dict) and resp.get("data"):
|
|
439
473
|
return resp.get("data")
|
|
@@ -646,6 +680,7 @@ class ShipthisAPI:
|
|
|
646
680
|
ShipthisAPIError: If the request fails.
|
|
647
681
|
"""
|
|
648
682
|
import time
|
|
683
|
+
|
|
649
684
|
if date is None:
|
|
650
685
|
date = int(time.time() * 1000)
|
|
651
686
|
|
|
File without changes
|
|
File without changes
|
{shipthisapi_python-3.0.3 → shipthisapi_python-3.0.5}/shipthisapi_python.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{shipthisapi_python-3.0.3 → shipthisapi_python-3.0.5}/shipthisapi_python.egg-info/requires.txt
RENAMED
|
File without changes
|
{shipthisapi_python-3.0.3 → shipthisapi_python-3.0.5}/shipthisapi_python.egg-info/top_level.txt
RENAMED
|
File without changes
|