Enhance list-invoices with advanced filtering (Type, status, dates, amounts) #110
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add advanced filtering capabilities to list-invoices tool
Summary
This PR enhances the
list-invoicestool with comprehensive filtering options, enabling more precise invoice queries through the Xero API. The changes add support for filtering by invoice IDs, statuses, customwhereclauses, and customizable ordering.Changes
New Filtering Parameters
invoiceIds: Filter invoices by specific invoice IDs (array of strings)statuses: Filter by invoice statuses - DRAFT, SUBMITTED, DELETED, AUTHORISED, PAID, VOIDED (array of strings)where: Advanced filtering using Xero's where clause syntax for complex queries including:order: Customizable ordering (defaults to "UpdatedDateUTC DESC")Implementation Details
listXeroInvoiceshandler to use aListInvoicesParamsinterface for better type safetypageparameter optional with default value of 1whereparameter)Updated Files
src/tools/list/list-invoices.tool.ts: Added new parameters and comprehensive documentationsrc/handlers/list-xero-invoices.handler.ts: Refactored to support new filtering optionsREADME.md: Updated tool description to reflect advanced filtering capabilitiesBenefits
Example Use Cases
where=Type=="ACCREC"where=Type=="ACCPAY"where=DueDate<DateTime(2024,12,01) AND Status=="AUTHORISED"statuses=["AUTHORISED","PAID"]where=Type=="ACCREC" AND Status=="AUTHORISED" AND AmountDue>1000