From 4c3a2557cd542351fb7fc3c0211c2f874d0b6425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Jodas?= Date: Tue, 2 Sep 2025 14:25:20 +0200 Subject: [PATCH] Add ClientWrapper --- src/Client.php | 2 +- src/ClientWrapper.php | 56 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 src/ClientWrapper.php diff --git a/src/Client.php b/src/Client.php index 1e5a7a9..1a7ebd7 100644 --- a/src/Client.php +++ b/src/Client.php @@ -22,7 +22,7 @@ class Client private const int DEFAULT_BACKOFF_RETRIES = 3; private const int GUZZLE_CONNECT_TIMEOUT_SECONDS = 10; private const int GUZZLE_TIMEOUT_SECONDS = 120; - private const int DEFAULT_MAX_WAIT_SECONDS = 30; + protected const int DEFAULT_MAX_WAIT_SECONDS = 30; private string $apiUrl; private string $tokenString; diff --git a/src/ClientWrapper.php b/src/ClientWrapper.php new file mode 100644 index 0000000..6a7b295 --- /dev/null +++ b/src/ClientWrapper.php @@ -0,0 +1,56 @@ + + */ + public function submitQueryJobWrapper(array $requestBody): array + { + return $this->submitQueryJob($this->branchId, $this->workspaceId, $requestBody); + } + + /** + * Execute a workspace query and wait for results + * + * @param array{statements: string[], transactional?: bool} $requestBody + * @return array{ + * queryJobId: string, + * status: string, + * statements: array>, + * results: array{ + * "columns": array, + * "data": array>, + * "status": string, + * "rowsAffected": int + * }[], + * } + */ + public function executeWorkspaceQueryWrapper( + array $requestBody, + int $maxWaitSeconds = parent::DEFAULT_MAX_WAIT_SECONDS, + ): array { + return $this->executeWorkspaceQuery($this->branchId, $this->workspaceId, $requestBody, $maxWaitSeconds); + } +}