Skip to content

Commit 8ae79e1

Browse files
committed
removed function and added filters to listVersions() function
1 parent f751bba commit 8ae79e1

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

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

Lines changed: 14 additions & 17 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,19 +41,4 @@ public function getVersions(array $ids)
2941

3042
return $this->collectionFromResult($result);
3143
}
32-
33-
/**
34-
* @return mixed
35-
*/
36-
public function listVersionsFilter(array $filters)
37-
{
38-
$filterList = [];
39-
foreach ($filters as $key => $value) {
40-
$filterList[] = $key .':' . $value;
41-
}
42-
43-
$result = $this->connection()->get($this->getEndpoint() .'/synchronization', ['filter' => implode(',', $filterList)]);
44-
45-
return $this->collectionFromResult($result);
46-
}
4744
}

0 commit comments

Comments
 (0)