From 9f31f8eac8fe2a518ad55acdc2ffb9d074300152 Mon Sep 17 00:00:00 2001 From: Shachar MW <53349272+cheddZy@users.noreply.github.com> Date: Sat, 30 Nov 2024 16:42:17 +0200 Subject: [PATCH 1/5] Added to Resend.php Facade: Contact, Audience and Batch methods --- src/Facades/Resend.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Facades/Resend.php b/src/Facades/Resend.php index f4b29cf..5ac00cd 100644 --- a/src/Facades/Resend.php +++ b/src/Facades/Resend.php @@ -4,6 +4,9 @@ use Illuminate\Support\Facades\Facade; use Resend\Service\ApiKey; +use Resend\Service\Audience; +use Resend\Service\Batch; +use Resend\Service\Contact; use Resend\Service\Domain; use Resend\Service\Email; @@ -24,6 +27,20 @@ public static function emails(): Email return static::getFacadeRoot()->emails; } + public static function contacts(): Contact + { + return static::getFacadeRoot()->contacts; + } + + public static function audiences(): Audience + { + return static::getFacadeRoot()->audiences; + } + public static function batch(): Batch + { + return static::getFacadeRoot()->batch; + } + /** * Get the registered name of the component. */ From ef398c97265ad06e30b75186bf943ca32435fdc2 Mon Sep 17 00:00:00 2001 From: Shachar MW <53349272+cheddZy@users.noreply.github.com> Date: Sun, 1 Dec 2024 01:24:18 +0200 Subject: [PATCH 2/5] Replaced Facade methods for PHPDoc --- src/Facades/Resend.php | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/Facades/Resend.php b/src/Facades/Resend.php index 5ac00cd..1576c8a 100644 --- a/src/Facades/Resend.php +++ b/src/Facades/Resend.php @@ -10,6 +10,16 @@ use Resend\Service\Domain; use Resend\Service\Email; +/** + * @method static Contact contacts() Manage Resend contacts. Contacts Docs + * @method static Audience audiences() Manage Resend audiences. Audience Docs + * @method static Batch batch() Create and send Resend Batches. + * ... + * @see Resend Docs + * @package resend-laravel + */ + + class Resend extends Facade { public static function apiKeys(): ApiKey @@ -27,20 +37,6 @@ public static function emails(): Email return static::getFacadeRoot()->emails; } - public static function contacts(): Contact - { - return static::getFacadeRoot()->contacts; - } - - public static function audiences(): Audience - { - return static::getFacadeRoot()->audiences; - } - public static function batch(): Batch - { - return static::getFacadeRoot()->batch; - } - /** * Get the registered name of the component. */ From bad30eb0a9b8c755e38b92d7101b6e2cb18ee771 Mon Sep 17 00:00:00 2001 From: Shachar MW <53349272+cheddZy@users.noreply.github.com> Date: Sun, 1 Dec 2024 12:19:21 +0200 Subject: [PATCH 3/5] Replaced existing Facade methods for PHPDoc --- src/Facades/Resend.php | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/src/Facades/Resend.php b/src/Facades/Resend.php index 1576c8a..595d63a 100644 --- a/src/Facades/Resend.php +++ b/src/Facades/Resend.php @@ -3,6 +3,7 @@ namespace Resend\Laravel\Facades; use Illuminate\Support\Facades\Facade; +use Resend\Laravel\ResendServiceProvider; use Resend\Service\ApiKey; use Resend\Service\Audience; use Resend\Service\Batch; @@ -11,32 +12,23 @@ use Resend\Service\Email; /** - * @method static Contact contacts() Manage Resend contacts. Contacts Docs - * @method static Audience audiences() Manage Resend audiences. Audience Docs + * Provides Resend integration for Laravel and Symfony Mailer. + * + * @method static Contact contacts() Manage Resend contacts. + * @method static Audience audiences() Manage Resend audiences through the Resend Email API. * @method static Batch batch() Create and send Resend Batches. - * ... - * @see Resend Docs + * @method static ApiKey apiKeys() Create, remove or list API keys. + * @method static Email emails() Manage emails through the Resend Email API. + * @method static Domain domains() Manage domains through the Resend Email API. + * * @package resend-laravel + * @see Resend Docs + * @see API Reference */ class Resend extends Facade { - public static function apiKeys(): ApiKey - { - return static::getFacadeRoot()->apiKeys; - } - - public static function domains(): Domain - { - return static::getFacadeRoot()->domains; - } - - public static function emails(): Email - { - return static::getFacadeRoot()->emails; - } - /** * Get the registered name of the component. */ From 429f0b3a8066a86d86fff7e2943880f411665d03 Mon Sep 17 00:00:00 2001 From: Shachar MW <53349272+cheddZy@users.noreply.github.com> Date: Sun, 1 Dec 2024 12:36:40 +0200 Subject: [PATCH 4/5] Adding the previously existing methods back (woops!) --- src/Facades/Resend.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Facades/Resend.php b/src/Facades/Resend.php index 595d63a..71453cc 100644 --- a/src/Facades/Resend.php +++ b/src/Facades/Resend.php @@ -3,7 +3,6 @@ namespace Resend\Laravel\Facades; use Illuminate\Support\Facades\Facade; -use Resend\Laravel\ResendServiceProvider; use Resend\Service\ApiKey; use Resend\Service\Audience; use Resend\Service\Batch; @@ -17,9 +16,6 @@ * @method static Contact contacts() Manage Resend contacts. * @method static Audience audiences() Manage Resend audiences through the Resend Email API. * @method static Batch batch() Create and send Resend Batches. - * @method static ApiKey apiKeys() Create, remove or list API keys. - * @method static Email emails() Manage emails through the Resend Email API. - * @method static Domain domains() Manage domains through the Resend Email API. * * @package resend-laravel * @see Resend Docs @@ -27,8 +23,24 @@ */ + class Resend extends Facade { + public static function apiKeys(): ApiKey + { + return static::getFacadeRoot()->apiKeys; + } + + public static function domains(): Domain + { + return static::getFacadeRoot()->domains; + } + + public static function emails(): Email + { + return static::getFacadeRoot()->emails; + } + /** * Get the registered name of the component. */ From 35969b7cd6d4a2e891ac2ff81eb6bec0a865edb4 Mon Sep 17 00:00:00 2001 From: Shachar MW <53349272+cheddZy@users.noreply.github.com> Date: Thu, 19 Dec 2024 20:59:08 +0200 Subject: [PATCH 5/5] Added tests for new methods, updated Resend facade with PHPDoc --- src/Facades/Resend.php | 18 +++--------------- tests/Facades/Resend.php | 8 +++++++- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/Facades/Resend.php b/src/Facades/Resend.php index 71453cc..82e32b2 100644 --- a/src/Facades/Resend.php +++ b/src/Facades/Resend.php @@ -16,6 +16,9 @@ * @method static Contact contacts() Manage Resend contacts. * @method static Audience audiences() Manage Resend audiences through the Resend Email API. * @method static Batch batch() Create and send Resend Batches. + * @method static ApiKey apiKeys() Manage Resend API keys. + * @method static Domain domains() Manage Resend domains. + * @method static Email emails() Manage Resend Emails. * * @package resend-laravel * @see Resend Docs @@ -26,21 +29,6 @@ class Resend extends Facade { - public static function apiKeys(): ApiKey - { - return static::getFacadeRoot()->apiKeys; - } - - public static function domains(): Domain - { - return static::getFacadeRoot()->domains; - } - - public static function emails(): Email - { - return static::getFacadeRoot()->emails; - } - /** * Get the registered name of the component. */ diff --git a/tests/Facades/Resend.php b/tests/Facades/Resend.php index 3e2cf43..6a4e37a 100644 --- a/tests/Facades/Resend.php +++ b/tests/Facades/Resend.php @@ -3,6 +3,9 @@ use Resend\Client; use Resend\Laravel\Facades\Resend; use Resend\Service\ApiKey; +use Resend\Service\Audience; +use Resend\Service\Batch; +use Resend\Service\Contact; use Resend\Service\Domain; use Resend\Service\Email; @@ -25,5 +28,8 @@ expect(Resend::apiKeys())->toBeInstanceOf(ApiKey::class) ->and(Resend::domains())->toBeInstanceOf(Domain::class) - ->and(Resend::emails())->toBeInstanceOf(Email::class); + ->and(Resend::emails())->toBeInstanceOf(Email::class) + ->and(Resend::contacts())->toBeInstanceOf(Contact::class) + ->and(Resend::batch())->toBeInstanceOf(Batch::class) + ->and(Resend::audiences())->toBeInstanceOf(Audience::class); });