Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Next Release

- Adds support for `UspsShipAccount`
- Adds `tracker.retrieveBatch` function

## v8.2.0 (2025-06-18)

Expand Down
13 changes: 13 additions & 0 deletions lib/EasyPost/Service/TrackerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,17 @@ public function create(mixed $params = null): mixed

return self::createResource(self::serviceModelClassName(self::class), $params);
}

/**
* Retrieve a batch of trackers.
*
* @param mixed $params
* @return mixed
*/
public function retrieveBatch(mixed $params = null): mixed
{
$response = Requestor::request($this->client, 'post', '/trackers/batch', $params);

return InternalUtil::convertToEasyPostObject($this->client, $response);
}
}
18 changes: 18 additions & 0 deletions test/EasyPost/TrackerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,22 @@ public function testGetNextPage(): void
throw $error;
}
}

/**
* Test creating a Tracker.
*/
public function testRetrieveBatch(): void
{
TestUtil::setupCassette('trackers/retrieveBatch.yml');

$tracker = self::$client->tracker->create([
'tracking_code' => 'EZ1000000001',
]);

$trackers = self::$client->tracker->retrieveBatch([
'tracking_codes' => [$tracker->tracking_code]
]);

$this->assertContainsOnlyInstancesOf(Tracker::class, $trackers['trackers']);
}
}
162 changes: 162 additions & 0 deletions test/cassettes/trackers/retrieveBatch.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading