Skip to content

Commit

Permalink
Add new contact filters for email and name
Browse files Browse the repository at this point in the history
It should be possible to filter by email address or / and name as
described in the API.

References:

- https://developers.lexoffice.io/docs/#contacts-endpoint-purpose
  • Loading branch information
drscream committed Apr 12, 2024
1 parent 674a380 commit e435e1a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ $client = $api->contact();

// filters
$client->size = 100;
$client->email = '[email protected]';
$client->name = 'John Doe';
$client->number = 123456;
$client->customer = true;
$client->vendor = false;
Expand Down Expand Up @@ -279,4 +281,4 @@ $response = $client->getPage(0);
// can be possible null because the response body can be empty
$json = \Sysix\LexOffice\Utils::getJsonFromResponse($response); // as object
$json = \Sysix\LexOffice\Utils::getJsonFromResponse($response, true); // as associative array
```
```
6 changes: 6 additions & 0 deletions src/Clients/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class Contact extends PaginationClient

protected string $resource = 'contacts';

public ?string $email = null;

public ?string $name = null;

public ?int $number = null;

public ?bool $customer = null;
Expand All @@ -25,6 +29,8 @@ class Contact extends PaginationClient

protected function buildQueryParams(array $params): string
{
$params['email'] = $this->email;
$params['name'] = $this->name;
$params['number'] = $this->number;
$params['customer'] = $this->customer;
$params['vendor'] = $this->vendor;
Expand Down

0 comments on commit e435e1a

Please sign in to comment.