Skip to content

refactor: rename show methods to get #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/API/AbstractAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(ArkClient $client)
*
* @return array|null|bool
*/
protected function get(string $path, array $query = [])
protected function requestGet(string $path, array $query = [])
{
$response = $this->client->getHttpClient()->get($this->buildUrl($path), [
'query' => Arr::dot($query),
Expand All @@ -58,7 +58,7 @@ protected function get(string $path, array $query = [])
*
* @return array|null|bool
*/
protected function post(string $path, array $parameters = [])
protected function requestPost(string $path, array $parameters = [])
{
$response = $this->client->getHttpClient()->post(
$this->buildUrl($path),
Expand Down
2 changes: 1 addition & 1 deletion src/API/ApiNodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ class ApiNodes extends AbstractAPI
*/
public function all(array $query = []): ?array
{
return $this->get('api-nodes', $query);
return $this->requestGet('api-nodes', $query);
}
}
2 changes: 1 addition & 1 deletion src/API/Blockchain.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ class Blockchain extends AbstractAPI
*/
public function blockchain(): ?array
{
return $this->get('blockchain');
return $this->requestGet('blockchain');
}
}
12 changes: 6 additions & 6 deletions src/API/Blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Blocks extends AbstractAPI
*/
public function all(array $query = []): ?array
{
return $this->get('blocks', $query);
return $this->requestGet('blocks', $query);
}

/**
Expand All @@ -25,9 +25,9 @@ public function all(array $query = []): ?array
*
* @return array
*/
public function show(string $id): ?array
public function get(string $id): ?array
{
return $this->get("blocks/{$id}");
return $this->requestGet("blocks/{$id}");
}

/**
Expand All @@ -37,7 +37,7 @@ public function show(string $id): ?array
*/
public function first(): ?array
{
return $this->get('blocks/first');
return $this->requestGet('blocks/first');
}

/**
Expand All @@ -47,7 +47,7 @@ public function first(): ?array
*/
public function last(): ?array
{
return $this->get('blocks/last');
return $this->requestGet('blocks/last');
}

/**
Expand All @@ -60,6 +60,6 @@ public function last(): ?array
*/
public function transactions(string $id, array $query = []): ?array
{
return $this->get("blocks/{$id}/transactions", $query);
return $this->requestGet("blocks/{$id}/transactions", $query);
}
}
4 changes: 2 additions & 2 deletions src/API/Commits.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class Commits extends AbstractAPI
*
* @return array
*/
public function show(int $height): ?array
public function get(int $height): ?array
{
return $this->get("commits/{$height}");
return $this->requestGet("commits/{$height}");
}
}
10 changes: 5 additions & 5 deletions src/API/Delegates.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Delegates extends AbstractAPI
*/
public function all(array $query = []): ?array
{
return $this->get('delegates', $query);
return $this->requestGet('delegates', $query);
}

/**
Expand All @@ -25,9 +25,9 @@ public function all(array $query = []): ?array
*
* @return array
*/
public function show(string $id): ?array
public function get(string $id): ?array
{
return $this->get("delegates/{$id}");
return $this->requestGet("delegates/{$id}");
}

/**
Expand All @@ -40,7 +40,7 @@ public function show(string $id): ?array
*/
public function blocks(string $id, array $query = []): ?array
{
return $this->get("delegates/{$id}/blocks", $query);
return $this->requestGet("delegates/{$id}/blocks", $query);
}

/**
Expand All @@ -53,6 +53,6 @@ public function blocks(string $id, array $query = []): ?array
*/
public function voters(string $id, array $query = []): ?array
{
return $this->get("delegates/{$id}/voters", $query);
return $this->requestGet("delegates/{$id}/voters", $query);
}
}
2 changes: 1 addition & 1 deletion src/API/EVM.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ public function ethCall(array $payload): ?array
'Content-Type' => 'application/json',
];

return $this->withApi('evm')->post('api/', $body, $headers);
return $this->withApi('evm')->requestPost('api/', $body, $headers);
}
}
10 changes: 5 additions & 5 deletions src/API/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Node extends AbstractAPI
*/
public function status(): ?array
{
return $this->get('node/status');
return $this->requestGet('node/status');
}

/**
Expand All @@ -23,7 +23,7 @@ public function status(): ?array
*/
public function syncing(): ?array
{
return $this->get('node/syncing');
return $this->requestGet('node/syncing');
}

/**
Expand All @@ -33,7 +33,7 @@ public function syncing(): ?array
*/
public function configuration(): ?array
{
return $this->get('node/configuration');
return $this->requestGet('node/configuration');
}

/**
Expand All @@ -43,7 +43,7 @@ public function configuration(): ?array
*/
public function crypto(): ?array
{
return $this->get('node/configuration/crypto');
return $this->requestGet('node/configuration/crypto');
}

/**
Expand All @@ -55,6 +55,6 @@ public function crypto(): ?array
*/
public function fees(?int $days = null): ?array
{
return $this->get('node/fees', ['days' => $days]);
return $this->requestGet('node/fees', ['days' => $days]);
}
}
6 changes: 3 additions & 3 deletions src/API/Peers.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Peers extends AbstractAPI
*/
public function all(array $query = []): ?array
{
return $this->get('peers', $query);
return $this->requestGet('peers', $query);
}

/**
Expand All @@ -25,8 +25,8 @@ public function all(array $query = []): ?array
*
* @return array
*/
public function show(string $ip): ?array
public function get(string $ip): ?array
{
return $this->get("peers/{$ip}");
return $this->requestGet("peers/{$ip}");
}
}
6 changes: 3 additions & 3 deletions src/API/Receipts.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Receipts extends AbstractAPI
*/
public function all(array $query = []): ?array
{
return $this->get('receipts', $query);
return $this->requestGet('receipts', $query);
}

/**
Expand All @@ -27,9 +27,9 @@ public function all(array $query = []): ?array
*
* @return array
*/
public function show(string $txHash): ?array
public function get(string $txHash): ?array
{
$result = $this->get('receipts', ['txHash' => $txHash])['data'];
$result = $this->requestGet('receipts', ['txHash' => $txHash])['data'];

if (empty($result)) {
throw new Exception(sprintf('No receipt found for transaction %s', $txHash));
Expand Down
8 changes: 4 additions & 4 deletions src/API/Rounds.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Rounds extends AbstractAPI
*/
public function all(array $query = []): ?array
{
return $this->get('rounds', $query);
return $this->requestGet('rounds', $query);
}

/**
Expand All @@ -25,9 +25,9 @@ public function all(array $query = []): ?array
*
* @return array
*/
public function show(int $round_id): ?array
public function get(int $round_id): ?array
{
return $this->get("rounds/{$round_id}");
return $this->requestGet("rounds/{$round_id}");
}

/**
Expand All @@ -39,6 +39,6 @@ public function show(int $round_id): ?array
*/
public function delegates(int $round_id): ?array
{
return $this->get("rounds/{$round_id}/delegates");
return $this->requestGet("rounds/{$round_id}/delegates");
}
}
22 changes: 11 additions & 11 deletions src/API/Transactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Transactions extends AbstractAPI
*/
public function all(array $query = []): ?array
{
return $this->get('transactions', $query);
return $this->requestGet('transactions', $query);
}

/**
Expand All @@ -27,7 +27,7 @@ public function all(array $query = []): ?array
*/
public function create(array $transactions): ?array
{
return $this->withApi('transactions')->post('transactions', compact('transactions'));
return $this->withApi('transactions')->requestPost('transactions', compact('transactions'));
}

/**
Expand All @@ -37,9 +37,9 @@ public function create(array $transactions): ?array
*
* @return array
*/
public function show(string $id): ?array
public function get(string $id): ?array
{
return $this->get("transactions/{$id}");
return $this->requestGet("transactions/{$id}");
}

/**
Expand All @@ -49,7 +49,7 @@ public function show(string $id): ?array
*/
public function allUnconfirmed(): ?array
{
return $this->withApi('transactions')->get('transactions/unconfirmed');
return $this->withApi('transactions')->requestGet('transactions/unconfirmed');
}

/**
Expand All @@ -59,9 +59,9 @@ public function allUnconfirmed(): ?array
*
* @return array
*/
public function showUnconfirmed(string $id): ?array
public function getUnconfirmed(string $id): ?array
{
return $this->withApi('transactions')->get("transactions/unconfirmed/{$id}");
return $this->withApi('transactions')->requestGet("transactions/unconfirmed/{$id}");
}

/**
Expand All @@ -71,7 +71,7 @@ public function showUnconfirmed(string $id): ?array
*/
public function types(): ?array
{
return $this->get('transactions/types');
return $this->requestGet('transactions/types');
}

/**
Expand All @@ -81,7 +81,7 @@ public function types(): ?array
*/
public function fees(): ?array
{
return $this->get('transactions/fees');
return $this->requestGet('transactions/fees');
}

/**
Expand All @@ -91,7 +91,7 @@ public function fees(): ?array
*/
public function schemas(): ?array
{
return $this->get('transactions/schemas');
return $this->requestGet('transactions/schemas');
}

/**
Expand All @@ -101,6 +101,6 @@ public function schemas(): ?array
*/
public function configuration(): ?array
{
return $this->withApi('transactions')->get('configuration');
return $this->withApi('transactions')->requestGet('configuration');
}
}
6 changes: 3 additions & 3 deletions src/API/Votes.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Votes extends AbstractAPI
*/
public function all(array $query = []): ?array
{
return $this->get('votes', $query);
return $this->requestGet('votes', $query);
}

/**
Expand All @@ -25,8 +25,8 @@ public function all(array $query = []): ?array
*
* @return array
*/
public function show(string $id): ?array
public function get(string $id): ?array
{
return $this->get("votes/{$id}");
return $this->requestGet("votes/{$id}");
}
}
Loading