Added default params to the client for query and action.

This commit is contained in:
flash 2024-11-14 02:22:09 +00:00
parent 93ec139171
commit 1cbc1edb06
4 changed files with 7 additions and 7 deletions

View file

@ -1 +1 @@
2.0.0
2.0.1

View file

@ -43,11 +43,11 @@ class HttpRpcClient implements RpcClient {
return RpciiMsgPack::decode($request->execute());
}
public function query(string $action, array $params): mixed {
public function query(string $action, array $params = []): mixed {
return $this->callProcedure(false, $action, $params);
}
public function action(string $action, array $params): mixed {
public function action(string $action, array $params = []): mixed {
return $this->callProcedure(true, $action, $params);
}

View file

@ -24,7 +24,7 @@ interface RpcClient {
* @param array<string, mixed> $params Parameters to query with.
* @return mixed Result of the query.
*/
function query(string $procedure, array $params): mixed;
function query(string $procedure, array $params = []): mixed;
/**
* Makes an RPC action call.
@ -33,5 +33,5 @@ interface RpcClient {
* @param array<string, mixed> $params Parameters to query with.
* @return mixed Result of the procedure call.
*/
function action(string $procedure, array $params): mixed;
function action(string $procedure, array $params = []): mixed;
}

View file

@ -22,11 +22,11 @@ class ScopedRpcClient implements RpcClient {
return $this->base->scopeTo($this->prefix . $prefix);
}
public function query(string $procedure, array $params): mixed {
public function query(string $procedure, array $params = []): mixed {
return $this->base->query($this->prefix . $procedure, $params);
}
public function action(string $procedure, array $params): mixed {
public function action(string $procedure, array $params = []): mixed {
return $this->base->action($this->prefix . $procedure, $params);
}
}