shipstation-node icon indicating copy to clipboard operation
shipstation-node copied to clipboard

Shipments getAll Return Type is incorrect

Open Deejerz88 opened this issue 1 year ago • 1 comments

Hey, first of all, thank you for all of work on this, it's been really helpful!

When attempting to use shipments.getAll, I noticed that the return type of the method is Promise<IShipment[]> when it should be Promise<IShipmentPaginationResult> (which doesn't currently exist) similar to the orders.getAll return. Because of this, attempting to access shipments from the returned object fails. I was able to work around it by importing your models and creating my own:

  interface IShipmentPaginatedResults extends Models.IPaginatedResult {
    shipments: Models.IShipment[];
  }

and then casting the results

  const { shipments, page, pages } = (await shipstation.shipments.getAll({
    pageSize: 500,
    shipDateStart: orderDateStart,
  })) as unknown as IShipmentPaginatedResults 

Just wanted to give you a heads up. Thanks again!

--DJ

Deejerz88 avatar Sep 10 '23 16:09 Deejerz88

+1

Gr8z avatar Mar 27 '24 01:03 Gr8z