Skip to content

Commit

Permalink
Merge pull request #56 from amcintosh/issue_55_sort_docs
Browse files Browse the repository at this point in the history
πŸ“ Add sort documentation to README
  • Loading branch information
amcintosh authored Oct 1, 2023
2 parents 8571989 + bfb94ea commit 0602c9b
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,30 @@ echo $client->outstanding_balance->amount; // null, new client has no balance

##### Sorting

TODO:
To sort the results of a list call by supported fields (see the documentation for that resource) a
`SortBuilder` can be used.

```php
use amcintosh\FreshBooks\Builder\SortBuilder;

$sort = new SortBuilder();
$sort->ascending("invoice_date");

$invoices = $freshBooksClient->invoices()->list($accountId, builders: [$sort]);
```

to sort by the invoice date in ascending order, or:

```php
use amcintosh\FreshBooks\Builder\SortBuilder;

$sort = new SortBuilder();
$sort->descending("invoice_date");

$invoices = $freshBooksClient->invoices()->list($accountId, builders: [$sort]);
```

for descending order.

## Development

Expand Down

0 comments on commit 0602c9b

Please sign in to comment.