sphere-node-sdk icon indicating copy to clipboard operation
sphere-node-sdk copied to clipboard

Add matchBySku method to inventoryEntries

Open emmenko opened this issue 10 years ago • 4 comments

client.inventoryEntries.all().matchBySku(['a', 'b', 'c', 'd']).fetch()

The function is an helper to build a query predicate using in operator

predicate = 'sku in ("a", "b", "c", "d")'

See https://github.com/sphereio/sphere-stock-import/blob/master/src/coffee/stockimport.coffee#L223-L227

emmenko avatar May 01 '15 10:05 emmenko

And what about a more general function, like: client.inventoryEntries.all().where('sku').in(['a', 'b', 'c', 'd']).fetch()

yanns avatar May 02 '15 15:05 yanns

It would be nice, but unfortunately not possible. where doesn't return a query builder but the instance of the service. Also it can be chained multiple times and it would be really hard to build the predicate like this.

emmenko avatar May 02 '15 17:05 emmenko

OK, thx for the info!

yanns avatar May 02 '15 20:05 yanns

This should be available also for products.

hajoeichler avatar May 22 '15 14:05 hajoeichler