Skip to content

Commit

Permalink
πŸ“ Add sort documentation to README
Browse files Browse the repository at this point in the history
  • Loading branch information
amcintosh committed Oct 1, 2023
1 parent 8571989 commit bfb94ea
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 bfb94ea

Please sign in to comment.