Skip to content

Commit

Permalink
createShipment: packetId -> packetIds
Browse files Browse the repository at this point in the history
  • Loading branch information
radimvaculik committed Oct 29, 2023
1 parent af2ba4d commit a6270bc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
21 changes: 17 additions & 4 deletions src/ApiRest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,26 @@ public function createPacketClaim(ClaimAttributes $attributes): iterable

/**
*
* @param string $packetId
* @param string $customBarcode
* @param string[] $packetIds
* @param ?string $customBarcode
* @return iterable<mixed>
*/
public function createShipment(string $packetId, string $customBarcode): iterable
public function createShipment(array $packetIds, ?string $customBarcode = null): iterable
{
return $this->callApi(__FUNCTION__, ['packetId' => $packetId, 'customBarcode' => $customBarcode]);
$variables = [
'packetIds' => [
'id' => $packetIds
],
];

if ($customBarcode !== null) {
$variables['customBarcode'] = $customBarcode;
}

return $this->callApi(
__FUNCTION__,
$variables,
);
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/ApiSoap.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,12 @@ public function createPacketClaim(ClaimAttributes $attributes)


/**
* @param string[] $packetIds
* @return mixed
*/
public function createShipment(string $packetId, string $customBarcode)
public function createShipment(array $packetIds, string $customBarcode)
{
return $this->soap->createShipment($this->apiKey, $packetId, $customBarcode);
return $this->soap->createShipment($this->apiKey, $packetIds, $customBarcode);
}


Expand Down
3 changes: 2 additions & 1 deletion src/IApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ public function createPacket(PacketAttributes $attributes);
public function createPacketClaim(ClaimAttributes $attributes);

/**
* @param string[] $packetIds
* @return mixed
*/
public function createShipment(string $packetId, string $customBarcode);
public function createShipment(array $packetIds, string $customBarcode);

/**
* @return mixed
Expand Down

0 comments on commit a6270bc

Please sign in to comment.