stephanstapel / BrickOwlSharp

.net library to connect to BrickOwl brick shop
MIT License
1 stars 0 forks source link

Inventory type is missing some properties #3

Closed norberto5 closed 3 months ago

norberto5 commented 3 months ago

/inventory/list endpoint returns properties external_lot_ids and ids like this:

{ "con": "new", "full_con": "new", "qty": "1", "lot_id": "12345678", "price": "4.760", "base_price": "4.760", "final_price": "4.760", "url": "https://xxx.brickowl.com/store/lego-vespa-125-set-10298-instructions", "owl_id": "499687", "public_note": null, "personal_note": "remarks etc", "sale_percent": "0", "bulk_qty": "1", "for_sale": "1", "my_cost": "1.234", "lot_weight": null, "reserve_uid": null, "boid": "589522", "external_lot_ids": { "other": "359885471" }, "type": "Instructions", "ids": [ { "id": "10298-1", "type": "set_number" }, { "id": "589522", "type": "boid" }, { "id": "6409617", "type": "item_no" }, { "id": "6409618", "type": "item_no" }, { "id": "6447654", "type": "item_no" }, { "id": "6447655", "type": "item_no" }, { "id": "6519908", "type": "item_no" }, { "id": "6519909", "type": "item_no" } ], "tier_price": [] },

They should be added to Inventory class

stephanstapel commented 3 months ago

Thanks for the suggestion. Do you have more examples for external_lot_ids? It's a bit difficult to implement this without a proper understanding of the structure

norberto5 commented 3 months ago

I've imported inventory from .BSX file and all the items have the same structure

    "external_lot_ids": {
        "other": "some_string_here"
    },

I've also manually added a test item to the store inventory and set the external id from the UI on BrickOwl and it looks like this too. The value of "other" property is a string (it can be bricklink lot id, but you can set there your own string).

The API documentation sucks, and they don't share the example responses with all possible properties :/ So I assume, it can be mapped like the structure above and if someone finds another structure for it, it can be further extended.

stephanstapel commented 3 months ago

can you please test the latest code change with your data?

norberto5 commented 3 months ago

I didn't run it yet, but I've reviewed your code change and it won't work, because the structure is different. External ids have only one property "other" of string value. It's not a list of References.

stephanstapel commented 3 months ago

unfortunately, it turned out that is even more weird than one can imagine. If external_lot_ids is empty, Brick Owl writes an array:

grafik

if it is not empty, an object is written instead:

grafik

norberto5 commented 3 months ago

Hey @stephanstapel, are you going to release the new version as a nuget package, so I can test the changes, or should I clone the repo locally?

stephanstapel commented 3 months ago

done