Skip to content
This repository was archived by the owner on Sep 5, 2025. It is now read-only.
Open
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
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
56 changes: 56 additions & 0 deletions src/ClientWrapper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

declare(strict_types=1);

namespace Keboola\QueryApi;

class ClientWrapper extends Client
{
/**
* @inheritdoc
*/
public function __construct(
array $config,
private readonly string $workspaceId,
private readonly string $branchId,
) {
parent::__construct($config);
}

/**
* Submit a new query job
*
* @param array{statements: string[], transactional?: bool} $requestBody
* @return array<string, mixed>
*/
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<array<string, mixed>>,
* results: array{
* "columns": array<array{
* "name": string,
* "type": "text",
* }>,
* "data": array<array<int, string>>,
* "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);
}
}