A simple API that supports almost all calls and which is mapped to objects accordingly.
$client = new \HarmSmits\SendCloudClient\Client(
"...",
"..."
);
Going over all parcels is really easy:
$cursor = null;
while (($result = $client->getParcels($cursor))) {
$cursor = $result->getNext();
foreach ($result->getParcels() as $parcel) {
...
}
}
Statuses work likewise:
foreach ($client->getParcelStatuses() as $parcelStatus) {
...
}
Same for brands:
$cursor = null;
while (($result = $client->getBrands($cursor))) {
$cursor = $result->getNext();
foreach ($result->getBrands() as $brand) {
...
}
}
Everything can be done asynchronously as well
$promise = $client->asyncGetParcelStatuses();
...
$result = $promise->wait();
The following methods can be used directly from the client, suffix with Async
if you want to get a promise.
- getParcels
- getParcel
- createParcel
- createParcels
- updateParcel
- cancelOrDeleteParcel
- getParcelReturnPortalUrl
- getParcelDocuments
- getParcelStatuses
- getReturns
- getReturn
- getBrands
- getBrand
- getShippingMethods
- getShippingMethod
- getPdfLabel
- getBulkPdfLabel
- getUser
- getInvoices
- getInvoice
- getSenderAddresses
- getSenderAddress
- getIntegrations