mcohen01 / node-quickbooks

nodejs client for Intuit's Quickbooks API
332 stars 235 forks source link

[Question] How do you send query parameters in a `find` call? #211

Open yashsway opened 1 year ago

yashsway commented 1 year ago

My goal: use the findInvoices method to fetch a list of invoices by customer ID, with the InvoiceLink field included for each invoice.

According to https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#the-invoice-object, the InvoiceLink field is only included if the query param include=invoiceLink is passed in.

Sharable link for the invoice sent to external customers. The link is generated only for invoices with online payment enabled and having a valid customer email address. Include query param include=invoiceLink to get the link back on query response.

Here's a snippet of my code:

  getInvoices(customerId: string, limit: number = 1000): Promise<QuickbooksInvoiceEntity[]> {
    return new Promise((res, rej) => {
      this.apiClient.findInvoices(
        {
          CustomerRef: customerId,
          limit,
        },
        (err, invoices: QuickbooksQueryResponse<QuickbooksInvoiceQueryResponse>) => {
          if (err) {
            rej(err);
            return;
          }

          res(invoices.QueryResponse.Invoice);
        },
      );
    });
  }

I can't find any details regarding how I pass in query parameters? Looks like the keys I specify are specifically for the where clause. (other than things like sorting, limits, pagination, and count)

charlie-s commented 1 year ago

See https://github.com/mcohen01/node-quickbooks/issues/163#issuecomment-1631477573