Skip to content

Commit

Permalink
Added getShippingLabelHeaders to retrieve header info from the shippi…
Browse files Browse the repository at this point in the history
…ng label endpoint. This contains the track and trace code.
  • Loading branch information
sanderlissenburg committed Jan 24, 2025
1 parent 83eccca commit 9ba5475
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -1800,6 +1800,31 @@ public function getShippingLabel(string $shippingLabelId): ?string
return $this->request('GET', $url, $options, $responseTypes);
}

/**
* Retrieves the headers of a shipping label by shipping label id. Shipping label metadata, for example the X-Track-And-Trace-Code, are added as headers
* in the response.
*
* @param string $shippingLabelId
* @return string|null
* @throws Exception\ConnectException
* @throws Exception\Exception
* @throws Exception\RateLimitException
* @throws Exception\ResponseException
* @throws Exception\UnauthorizedException
*/
public function getShippingLabelHeaders(string $shippingLabelId): ?array
{
$url = "retailer/shipping-labels/{$shippingLabelId}";
$options = [
'produces' => 'application/vnd.retailer.v10+pdf',
];
$responseTypes = [
'404' => 'null',
];

return $this->request('HEAD', $url, $options, $responseTypes);
}

/**
* Retrieves all event notification subscriptions for a given retailer. Each subscription may have different types
* of events and a destination, which could either be a URL (for WEBHOOK) or a topic name (for GCP_PUBSUB).
Expand Down

0 comments on commit 9ba5475

Please sign in to comment.