npm i jumbo-api
const JumboApi = require('jumbo-api');
Getting a product:
Returns a promise.
JumboApi.getProduct('67649PAK') //getting product information for milk
.then((products) => {
console.log(products);
})
.catch((err) => {
console.log(err);
})
Example output:
{ id: '67649PAK',
title: 'Jumbo Verse Halfvolle Melk 2L',
quantityOptions:
[ { defaultAmount: 1,
minimumAmount: 1,
amountStep: 1,
unit: 'pieces',
maximumAmount: 99 } ],
prices:
{ price: { currency: 'EUR', amount: 165 },
unitPrice: { unit: 'l', price: [Object] } },
available: true,
productType: 'Product',
crossSellSKUList: [],
quantity: '2000 ml',
... etc
}
All wrapper functions follow the same format, all return a promise:
JumboApi.method('')
.then((res) => {})
.catch((err) => {});
For an easy read, I will just provide all possible methods and not write the format above.
JumboApi.searchProducts(query, limit, offset)
JumboApi.searchId(productId)
JumboApi.getStores()
JumboApi.getStore(storeId)
JumboApi.getStoreDeliveryTimeSlots(storeId)
JumboApi.getStorePickupTimeSlots(storeId)
JumboApi.getStorePromotions(storeId)
JumboApi.getToken(username, password)
.then((token) => {
// save token for later. Or do something cool.
// keep in mind that due to everything being async, having another function using the token *below* this function will not work
})
.catch((err) => {
console.log(err)
})
JumboApi.getMyOrders(token)
.then((orders) => {})
.catch((err) => {})
This package is still a work in progress, if you would like to help you are free to submit a pr! Check it out on Github