PAT-1866 Migrate sync-actions-api-php-client onto php-api-client-base#524
Open
pepamartinec wants to merge 1 commit into
Open
PAT-1866 Migrate sync-actions-api-php-client onto php-api-client-base#524pepamartinec wants to merge 1 commit into
pepamartinec wants to merge 1 commit into
Conversation
d97dafc to
16ba038
Compare
dad6940 to
5093d3a
Compare
16ba038 to
ce49294
Compare
Replace the hand-rolled Guzzle client (auth/retry/logging middleware and a
Symfony-validator constructor) with the shared keboola/php-api-client-base.
php-api-client-base:
- ApiClient::sendRequest() now returns the ResponseInterface (was void; a
backward-compatible widening) so clients can decode the raw body themselves.
The now-redundant private doSendRequest() is folded into it.
sync-actions-api-php-client:
- Rename Client -> SyncActionsApiClient; delegate transport to the base ApiClient
via StorageApiTokenAuthenticator, with unpacked constructor params. Keep the
historical default of 10 retries.
- Add SyncActionsClientException (extends the base ClientException) and
SyncActionsErrorMessageResolver (formats "{code}: {error}").
- callAction() decodes the raw response body to a faithful deep stdClass -- the
base client's array decode would collapse empty/integer-keyed objects.
ActionResponse is a plain stdClass DTO; getActions() uses the array-based
ResponseModelInterface.
- Delete ApiClientConfiguration, StorageApiTokenAuthenticator, RetryDecider and the
local ResponseModelInterface/ClientException (now provided by the base lib).
ce49294 to
ffea9e6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release Notes
https://linear.app/keboola/issue/PAT-1866
Migrate
sync-actions-api-php-clientonto the sharedkeboola/php-api-client-base, matching the migrations already done for the vault, sandboxes, and git-service clients. The hand-rolled Guzzle client — its auth/retry/logging middleware stack and Symfony-validator constructor — is replaced by the baseApiClient, so transport, retries, error handling, and authentication are now shared across clients.The public
Clientis renamed toSyncActionsApiClientwith an unpacked constructor (individual params instead of anApiClientConfigurationobject), authenticates via the baseStorageApiTokenAuthenticator, and keeps the historical default of 10 retries. Failures throw a per-clientSyncActionsClientException(extends the baseClientException), formatted by a smallSyncActionsErrorMessageResolver.A sync action returns an arbitrary, component-defined payload that callers read as
$response->data->whatever, soActionResponse.datastays a deepstdClass.callAction()decodes the raw response body withjson_decode(..., false)to preserve the object/array distinction — the base client's array decode would collapse{}to[]and renumber integer-keyed objects. That needs a small, backward-compatible base-lib change, included here since it's trivial:ApiClient::sendRequest()now returns theResponseInterfaceinstead ofvoid(and the now-redundant privatedoSendRequest()is folded into it).getActions()still uses the array-basedsendRequestAndMapResponse(its payload is a flat list of strings).Key changes:
php-api-client-base:ApiClient::sendRequest()returns theResponseInterface(wasvoid;doSendRequest()merged in) — backward-compatible.Client→SyncActionsApiClient; delegate transport to the baseApiClient.SyncActionsClientException+SyncActionsErrorMessageResolver.callAction()decodes the raw body to a faithfulstdClass;ActionResponseis a plain DTO.ApiClientConfiguration,StorageApiTokenAuthenticator,RetryDecider, and the localResponseModelInterface/ClientException(now provided by the base lib).keboola/php-api-client-base; dropsymfony/validatorandsymfony/config.Plans for customer communication
None.
Impact analysis
Breaking API change for consumers of
sync-actions-api-php-client(notablyconnection): the exception type is renamed (Keboola\SyncActionsClient\Exception\ClientException→SyncActionsClientException), the constructor signature is unpacked (noApiClientConfiguration), and the client class is renamed. Response reading ($response->data->...) is unchanged and now correct for empty/integer-keyed objects. Thephp-api-client-basechange is backward-compatible (avoidmethod now returns a value), so the other clients are unaffected. Requires a majorsync-actions-api-php-clientbump and a minorphp-api-client-basebump.Change type
Refactoring
Justification
Consolidate Keboola PHP API clients onto the shared
php-api-client-base(PAT-1866).Deployment
Merge & automatic deploy.
Rollback plan
Revert of this PR.
Post release support plan
None.