Skip to content

Commit 2702245

Browse files
committed
feat(storage-api-client): require BranchAwareClient for swapTables
The /tables/{id}/swap route is only registered under /v2/storage/branch/{branchId}/... (isAvailableWithoutBranch: false), so calling swapTables() on a plain Client previously produced a confusing 404. Mirror the existing guard pattern used by refreshTableInformationInBucket() and pullTableToBranch() and throw a ClientException with a clear message instead. Update the SwapTableTest call sites to use a BranchAwareClient and add an explicit test for the new guard.
1 parent 7f3f561 commit 2702245

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/Keboola/StorageApi/Client.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,10 @@ public function dropTable($tableId, $options = ['async' => true])
14391439
*/
14401440
public function swapTables(string $tableId, string $targetTableId): array
14411441
{
1442+
if (!$this instanceof BranchAwareClient) {
1443+
throw new ClientException('Swapping tables is supported only in dev branch. Use BranchAwareClient instance.');
1444+
}
1445+
14421446
/** @var array<string, mixed> $result */
14431447
$result = $this->apiPostJson("tables/{$tableId}/swap", [
14441448
'targetTableId' => $targetTableId,

0 commit comments

Comments
 (0)