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

@@ -5,7 +5,7 @@ namespace Anikeen\Id\Concerns;
use Anikeen\Id\ApiOperations\Request;
use Anikeen\Id\Exceptions\RequestRequiresClientIdException;
use Anikeen\Id\Resources\Subscriptions;
use GuzzleHttp\Exception\GuzzleException;
use Throwable;
trait ManagesSubscriptions
{
@@ -14,12 +14,15 @@ trait ManagesSubscriptions
/**
* Get subscriptions from the current user.
*
* @throws RequestRequiresClientIdException
* @throws GuzzleException
* @throws Throwable
*/
public function subscriptions(): Subscriptions
{
return (new Subscriptions($this->request('GET', 'v1/subscriptions')))
->setBillable($this);
if (!isset($this->subscriptionsCache)) {
$this->subscriptionsCache = Subscriptions::builder(fn() => $this->request('GET', 'v1/subscriptions'))
->setBillable($this);
}
return $this->subscriptionsCache;
}
}