From dbee0824a8f92fa599f8e53206ffa4f762ab910f Mon Sep 17 00:00:00 2001 From: Brian Faust Date: Sun, 2 Dec 2018 13:28:27 +0200 Subject: [PATCH] fix: pass query parameters to 2.0 endpoints --- CHANGELOG.md | 6 ++++++ src/API/Two/Blocks.php | 9 ++++++--- src/API/Two/Delegates.php | 12 ++++++++---- src/API/Two/Transactions.php | 6 ++++-- src/API/Two/Votes.php | 6 ++++-- src/API/Two/Wallets.php | 18 ++++++++++++------ 6 files changed, 40 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3e15a4..c545d73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## Unreleased +## 0.1.5 - 2018-12-02 + +### Fixed: + +- Pass `query` parameters to 2.0 endpoints + ## 0.1.4 - 2018-11-23 ### Changed: diff --git a/src/API/Two/Blocks.php b/src/API/Two/Blocks.php index a76dfe2..dc661c2 100644 --- a/src/API/Two/Blocks.php +++ b/src/API/Two/Blocks.php @@ -25,11 +25,13 @@ class Blocks extends AbstractAPI /** * Get all blocks. * + * @param array $query + * * @return array */ - public function all(): array + public function all(array $query = []): array { - return $this->get('blocks'); + return $this->get('blocks', $query); } /** @@ -48,10 +50,11 @@ public function show(string $id): array * Get all transactions by the given block. * * @param string $id + * @param array $query * * @return array */ - public function transactions(string $id): array + public function transactions(string $id, array $query = []): array { return $this->get("blocks/{$id}/transactions"); } diff --git a/src/API/Two/Delegates.php b/src/API/Two/Delegates.php index 3934aec..fcaf803 100644 --- a/src/API/Two/Delegates.php +++ b/src/API/Two/Delegates.php @@ -25,11 +25,13 @@ class Delegates extends AbstractAPI /** * Get all accounts. * + * @param array $query + * * @return array */ - public function all(): array + public function all(array $query = []): array { - return $this->get('delegates'); + return $this->get('delegates', $query); } /** @@ -48,10 +50,11 @@ public function show(string $id): array * Get all blocks for the given delegate. * * @param string $id + * @param array $query * * @return array */ - public function blocks(string $id): array + public function blocks(string $id, array $query = []): array { return $this->get("delegates/{$id}/blocks"); } @@ -60,10 +63,11 @@ public function blocks(string $id): array * Get all voters for the given delegate. * * @param string $id + * @param array $query * * @return array */ - public function voters(string $id): array + public function voters(string $id, array $query = []): array { return $this->get("delegates/{$id}/voters"); } diff --git a/src/API/Two/Transactions.php b/src/API/Two/Transactions.php index d43d24b..b18779d 100644 --- a/src/API/Two/Transactions.php +++ b/src/API/Two/Transactions.php @@ -25,11 +25,13 @@ class Transactions extends AbstractAPI /** * Get all transactions. * + * @param array $query + * * @return array */ - public function all(): array + public function all(array $query = []): array { - return $this->get('transactions'); + return $this->get('transactions', $query); } /** diff --git a/src/API/Two/Votes.php b/src/API/Two/Votes.php index 7a8347c..4d5c6b5 100644 --- a/src/API/Two/Votes.php +++ b/src/API/Two/Votes.php @@ -25,11 +25,13 @@ class Votes extends AbstractAPI /** * Get all votes. * + * @param array $query + * * @return array */ - public function all(): array + public function all(array $query = []): array { - return $this->get('votes'); + return $this->get('votes', $query); } /** diff --git a/src/API/Two/Wallets.php b/src/API/Two/Wallets.php index 717b37d..4e2b172 100644 --- a/src/API/Two/Wallets.php +++ b/src/API/Two/Wallets.php @@ -25,11 +25,13 @@ class Wallets extends AbstractAPI /** * Get all wallets. * + * @param array $query + * * @return array */ - public function all(): array + public function all(array $query = []): array { - return $this->get('wallets'); + return $this->get('wallets', $query); } /** @@ -48,10 +50,11 @@ public function show(string $id): array * Get all transactions for the given wallet. * * @param string $id + * @param array $query * * @return array */ - public function transactions(string $id): array + public function transactions(string $id, array $query = []): array { return $this->get("wallets/{$id}/transactions"); } @@ -60,10 +63,11 @@ public function transactions(string $id): array * Get all transactions sent by the given wallet. * * @param string $id + * @param array $query * * @return array */ - public function sentTransactions(string $id): array + public function sentTransactions(string $id, array $query = []): array { return $this->get("wallets/{$id}/transactions/sent"); } @@ -72,10 +76,11 @@ public function sentTransactions(string $id): array * Get all transactions received by the given wallet. * * @param string $id + * @param array $query * * @return array */ - public function receivedTransactions(string $id): array + public function receivedTransactions(string $id, array $query = []): array { return $this->get("wallets/{$id}/transactions/received"); } @@ -84,10 +89,11 @@ public function receivedTransactions(string $id): array * Get all votes by the given wallet. * * @param string $id + * @param array $query * * @return array */ - public function votes(string $id): array + public function votes(string $id, array $query = []): array { return $this->get("wallets/{$id}/votes"); }