From 8c11958d950eb9fe6167fa2ff87365c9931c943d Mon Sep 17 00:00:00 2001 From: C <0xicl33n@gmail.com> Date: Sun, 4 Jan 2026 11:36:07 -0800 Subject: [PATCH] test --- src/asquare.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/asquare.py b/src/asquare.py index 285d5ec..ed8f46d 100644 --- a/src/asquare.py +++ b/src/asquare.py @@ -64,15 +64,15 @@ async def get_item_by_id(item_id: str) -> dict: Exception: If item not found or API error """ try: - result = await client.catalog.retrieve_catalog_object( - object_id=item_id, include_related_objects=True + result = await client.catalog.batch_retrieve_catalog_objects( + body={"object_ids": [item_id], "include_related_objects": True} ) result_json = json.loads(result.model_dump_json()) - if not result_json.get("object"): + if not result_json.get("objects"): raise ValueError(f"Item {item_id} not found") - obj = result_json["object"] + obj = result_json["objects"][0] item_data = obj.get("item_data", {}) return { @@ -107,16 +107,16 @@ async def get_item_by_variation_id(variation_id: str) -> dict: Exception: If variation/item not found or API error """ try: - # Get variation object - result = await client.catalog.retrieve_catalog_object( - object_id=variation_id, include_related_objects=True + # Get variation object using batch_retrieve + result = await client.catalog.batch_retrieve_catalog_objects( + body={"object_ids": [variation_id], "include_related_objects": True} ) result_json = json.loads(result.model_dump_json()) - if not result_json.get("object"): + if not result_json.get("objects"): raise ValueError(f"Variation {variation_id} not found") - variation_obj = result_json["object"] + variation_obj = result_json["objects"][0] # Get parent item ID from variation item_id = variation_obj.get("item_variation_data", {}).get("item_id")