Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed filters to by fluent rather than array based #61

Merged
merged 1 commit into from
May 3, 2024

Conversation

dcblogdev
Copy link
Owner

This PR changes filtering from:

Xero::contacts()->get(int $page = 1, string $where = null)

to fluent methods:

->filter() methods are optional and can add multiple filters. Only filters set out in an emum are supported:

 case IDS = 'ids';
 case INCLUDEARCHIVED = 'includeArchived';
 case ORDER = 'order';
 case PAGE = 'page';
 case SEARCHTERM = 'searchTerm';
 case SUMMARYONLY = 'summaryOnly';
 case WHERE = 'where';

Usage

Xero::contacts()
->filter('page', 1)
->filter('where', 'EmailAddress=="info@abfl.com"')
->filter('where', 'ContactID==Guid("74ea95ea-6e1e-435d-9c30-0dff8ae1bd80")')
->filter('searchTerm', 'info')
->filter('includeArchived', 'false')
->filter('order', 'name')
->filter('summaryOnly', 'true')
->get();

@dcblogdev dcblogdev merged commit 3f0b252 into main May 3, 2024
2 checks passed
@dcblogdev dcblogdev deleted the improve-filters branch May 3, 2024 16:36
@FortuneV13
Copy link

This is great. Please can you update the readme to use the new filter(). Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants