diff --git a/src/Client.php b/src/Client.php index 4d6e8a2..3b52a70 100644 --- a/src/Client.php +++ b/src/Client.php @@ -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).