[AJDA-2500] Add PaginationHelper, JobStatus enum, remove executeWorkspaceQuery#476
[AJDA-2500] Add PaginationHelper, JobStatus enum, remove executeWorkspaceQuery#476ondrajodas merged 2 commits intomainfrom
Conversation
|
There was a problem hiding this comment.
Pull request overview
This PR extends the Query Service API PHP client to support pagination when fetching job results by introducing optional query parameters and plumbing them through higher-level query execution.
Changes:
- Added optional
pageSizeandoffsetparameters toClient::getJobResults()and appended them as Guzzlequeryparameters when provided. - Extended the internal
sendRequest()helper to accept optional query parameters passed through to Guzzle. - Added PHPUnit coverage for
getJobResults()query parameter behavior and forexecuteWorkspaceQuery()forwarding pagination.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| libs/query-service-api-client/src/Client.php | Adds optional pagination query params to job results fetching and extends request helper to support query parameters. |
| libs/query-service-api-client/tests/Phpunit/ClientTest.php | Adds tests asserting correct query string construction and pagination forwarding behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| int $maxWaitSeconds = self::DEFAULT_MAX_WAIT_SECONDS, | ||
| int $maxPollWaitMs = self::DEFAULT_MAX_POLL_WAIT_MS, | ||
| ?int $pageSize = null, | ||
| ): WorkspaceQueryResponse { |
There was a problem hiding this comment.
executeWorkspaceQuery only added $pageSize but the PR description says both pageSize and offset should be supported and propagated. Consider adding an optional ?int $offset = null parameter here as well (after $pageSize) so callers can control the results offset when using executeWorkspaceQuery.
There was a problem hiding this comment.
Intentionally not added — the Linear issue (AJDA-2500) specifies only $pageSize for executeWorkspaceQuery. $offset is available directly on getJobResults for callers who need fine-grained control.
There was a problem hiding this comment.
Já tomu teda ale taky moc nerozumím jak to pak bude stránkovat :)
There was a problem hiding this comment.
no todle nebude stránkovat no... já nevím jestli tu logiku stránkování úplně strkat sem... mě se upřímně celá tahle executeWorkspaceQuery metoda moc nelíbí :D
There was a problem hiding this comment.
No, ale o to šlo, aby tohle stránkovalo ne? podle toho k čemu to směřuje https://linear.app/keboola/issue/AJDA-2501/editor-service-sqldataprovider-paginate-executequery-to-fetch-all-job
no jestli ju uděláš líp, tak hurá do toho, je to úzký hrdlo
| $queryParams['offset'] = $offset; | ||
| } | ||
| return JobResultsResponse::fromResponse( | ||
| $this->sendRequest('GET', $url, null, $queryParams !== [] ? $queryParams : null), |
There was a problem hiding this comment.
tady bych si to podminku asi odpustil - resp. nechal sendRequest at si to vyresi
| int $maxWaitSeconds = self::DEFAULT_MAX_WAIT_SECONDS, | ||
| int $maxPollWaitMs = self::DEFAULT_MAX_POLL_WAIT_MS, | ||
| ?int $pageSize = null, | ||
| ): WorkspaceQueryResponse { |
There was a problem hiding this comment.
Já tomu teda ale taky moc nerozumím jak to pak bude stránkovat :)
…ults, remove executeWorkspaceQuery
624e869 to
6e3b662
Compare
|
protikus k tomu - https://github.com/keboola/editor-service/pull/85 |
Summary
$pageSizeand$offsetparameters toClient::getJobResults()PaginationHelperclass to fetch all result pages for completed statementsJobStatusstring-backed enum replacing hardcoded status stringsexecuteWorkspaceQuery()method andWorkspaceQueryResponseclass (breaking changes)Breaking changes
getStatus()onStatement,JobStatusResponse,JobResultsResponsenow returnsJobStatusenum instead ofstringClient::executeWorkspaceQuery()removed — usesubmitQueryJob()+waitForJobCompletion()+PaginationHelper::getAllResults()insteadResponse\WorkspaceQueryResponseclass removed