-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add restCreateCollection method to enable calling a rest create metho…
…d which returns a collection rather than a single result. Add ParcelMultiEndpoint to allow creating multi-collo shipments.
- Loading branch information
Ash
committed
Nov 15, 2023
1 parent
2bdc222
commit 97081da
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Imbue\SendCloud\Endpoints; | ||
|
||
use Imbue\SendCloud\Exceptions\ApiException; | ||
use Imbue\SendCloud\Resources\Collections\ParcelCollection; | ||
use Imbue\SendCloud\Resources\GenericStatus; | ||
use Imbue\SendCloud\Resources\Parcel; | ||
use Imbue\SendCloud\Resources\ParcelMulti; | ||
use Imbue\SendCloud\Resources\ResourceFactory; | ||
|
||
class ParcelMultiEndpoint extends AbstractEndpoint | ||
{ | ||
/** @var string */ | ||
protected $resourcePath = 'parcels'; | ||
|
||
/** | ||
* @return Parcel | ||
*/ | ||
protected function getResourceObject(): Parcel | ||
{ | ||
return new Parcel($this->client); | ||
} | ||
|
||
/** | ||
* @param $previous | ||
* @param $next | ||
* @return ParcelCollection | ||
*/ | ||
protected function getResourceCollectionObject($previous, $next): ParcelCollection | ||
{ | ||
return new ParcelCollection($this->client, $previous, $next); | ||
} | ||
|
||
/** | ||
* @param array $data | ||
* @return ParcelCollection | ||
* @throws ApiException | ||
*/ | ||
public function create(array $data = []): ParcelCollection | ||
{ | ||
return $this->restCreateCollection($data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters