MONEI / Shopify-api-node

Node Shopify connector sponsored by MONEI
https://monei.com/shopify-payment-gateway/
MIT License
946 stars 277 forks source link

This enables usage of pagination for orders and products #447

Closed LarsBuur closed 3 years ago

LarsBuur commented 3 years ago

No original work here. It´s basically what @YourWishes suggests in #288. Could and should be extended throughout the api for lists.

Usage example:

  const orderList: IOrder[] = [];
  const orderStatus = 'any';

  let params = { status: orderStatus, limit: 250 };

  do {
    const orders = await shopify.order.list(params);

    for (const order of orders) {
      orderList.push(order);
    }

    params = orders.nextPageParameters;
  } while (params !== undefined);

  console.log(`after while loop len:${orderList.length}`)
coveralls commented 3 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling bf132607bdbd5a3439e13e26d5e37b7189223c2c on LarsBuur:master into a0cdad61c1f49971d119114db2926a0e98a1a5f1 on MONEI:master.

dankeller101 commented 3 years ago

Just wanted to drop in to say this would be very helpful for us on our project that depends on this wrapper! Let me know if there's any way I can help make this land sooner.

davidmm07 commented 3 years ago

@lpinca Check this PR

lpinca commented 3 years ago

It should be done for all supported endpoints.