Skip to content

Commit 3d52696

Browse files
authored
Merge pull request #47 from it-can/master
Added filter function to Synchronizable trait
2 parents 6ba0f73 + 8ae79e1 commit 3d52696

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/Picqer/Financials/Moneybird/Actions/Synchronizable.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,21 @@ trait Synchronizable
1010
/**
1111
* @return mixed
1212
*/
13-
public function listVersions()
13+
public function listVersions(array $filters = [])
1414
{
15-
$result = $this->connection()->get($this->getEndpoint() . '/synchronization');
15+
$filter = [];
16+
17+
if ( ! empty($filters))
18+
{
19+
$filterList = [];
20+
foreach ($filters as $key => $value) {
21+
$filterList[] = $key .':' . $value;
22+
}
23+
24+
$filter = ['filter' => implode(',', $filterList)];
25+
}
26+
27+
$result = $this->connection()->get($this->getEndpoint() . '/synchronization', $filter);
1628

1729
return $this->collectionFromResult($result);
1830
}
@@ -29,5 +41,4 @@ public function getVersions(array $ids)
2941

3042
return $this->collectionFromResult($result);
3143
}
32-
3344
}

0 commit comments

Comments
 (0)