Skip to content

Commit 25bc9d3

Browse files
committed
Merge branch 'drscream-contacts-filter-update' into development
2 parents 674a380 + 1c073d3 commit 25bc9d3

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ $client = $api->contact();
6363

6464
// filters
6565
$client->size = 100;
66+
$client->email = 'john.doe@example.com';
67+
$client->name = 'John Doe';
6668
$client->number = 123456;
6769
$client->customer = true;
6870
$client->vendor = false;
@@ -279,4 +281,4 @@ $response = $client->getPage(0);
279281
// can be possible null because the response body can be empty
280282
$json = \Sysix\LexOffice\Utils::getJsonFromResponse($response); // as object
281283
$json = \Sysix\LexOffice\Utils::getJsonFromResponse($response, true); // as associative array
282-
```
284+
```

src/Clients/Contact.php

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ class Contact extends PaginationClient
1717

1818
protected string $resource = 'contacts';
1919

20+
public ?string $email = null;
21+
22+
public ?string $name = null;
23+
2024
public ?int $number = null;
2125

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

2630
protected function buildQueryParams(array $params): string
2731
{
32+
$params['email'] = $this->email;
33+
$params['name'] = $this->name;
2834
$params['number'] = $this->number;
2935
$params['customer'] = $this->customer;
3036
$params['vendor'] = $this->vendor;

tests/Clients/ContactTest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,16 @@ public function testGetPageWithFilters(): void
2929
{
3030
[$api, $client] = $this->createClientMockObject(Contact::class);
3131

32+
$client->email = 'john.doe@example.com';
33+
$client->name = 'John Doe';
3234
$client->number = 12345;
3335
$client->customer = true;
3436
$client->vendor = false;
3537

3638
$client->getPage(0);
3739

3840
$this->assertEquals(
39-
$api->apiUrl . '/v1/contacts?page=0&number=12345&customer=1&vendor=0&size=100',
41+
$api->apiUrl . '/v1/contacts?page=0&email=john.doe%40example.com&name=John+Doe&number=12345&customer=1&vendor=0&size=100',
4042
$api->getRequest()->getUri()->__toString()
4143
);
4244
}

0 commit comments

Comments
 (0)