update resources

Signed-off-by: Maurice Preuß (envoyr) <hello@envoyr.com>
This commit is contained in:
2025-05-02 06:27:53 +02:00
parent 1725ec68de
commit 1d2119a32b
33 changed files with 303 additions and 320 deletions

View File

@@ -6,7 +6,7 @@ use Anikeen\Id\ApiOperations\Request;
use Anikeen\Id\Exceptions\RequestRequiresClientIdException;
use Anikeen\Id\Resources\Orders;
use Anikeen\Id\Result;
use GuzzleHttp\Exception\GuzzleException;
use Throwable;
trait ManagesOrders
{
@@ -15,12 +15,15 @@ trait ManagesOrders
/**
* Get orders from the current user.
*
* @throws RequestRequiresClientIdException
* @throws GuzzleException
* @throws Throwable
*/
public function orders(array $parameters = []): Orders
{
return (new Orders($this->request('GET', 'v1/orders', [], $parameters)))
->setBillable($this);
if (!isset($this->ordersCache)) {
$this->ordersCache = Orders::builder(fn() => $this->request('GET', 'v1/orders', [], $parameters))
->setBillable($this);
}
return $this->ordersCache;
}
}