Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added to Resend.php Facade: Contact, Audience and Batch methods #70

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions src/Facades/Resend.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,31 @@

use Illuminate\Support\Facades\Facade;
use Resend\Service\ApiKey;
use Resend\Service\Audience;
use Resend\Service\Batch;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
use Resend\Service\Batch;
use Resend\Service\Batch;
use Resend\Service\Broadcast;

use Resend\Service\Contact;
use Resend\Service\Domain;
use Resend\Service\Email;

class Resend extends Facade
{
public static function apiKeys(): ApiKey
{
return static::getFacadeRoot()->apiKeys;
}
/**
* 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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @method static Batch batch() Create and send Resend Batches.
* @method static Batch batch() Create and send Resend Batches.
* @method static Broadcast broadcasts() Create and send broadcasts to your audience.

* @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 <a href="https://resend.com/docs/introduction">Resend Docs</a>
* @see <a href="https://resend.com/docs/api-reference/introduction">API Reference</a>
*/

public static function domains(): Domain
{
return static::getFacadeRoot()->domains;
}

public static function emails(): Email
{
return static::getFacadeRoot()->emails;
}

class Resend extends Facade
{
/**
* Get the registered name of the component.
*/
Expand Down
8 changes: 7 additions & 1 deletion tests/Facades/Resend.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
use Resend\Client;
use Resend\Laravel\Facades\Resend;
use Resend\Service\ApiKey;
use Resend\Service\Audience;
use Resend\Service\Batch;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
use Resend\Service\Batch;
use Resend\Service\Batch;
use Resend\Service\Broadcast;

use Resend\Service\Contact;
use Resend\Service\Domain;
use Resend\Service\Email;

Expand All @@ -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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
->and(Resend::batch())->toBeInstanceOf(Batch::class)
->and(Resend::batch())->toBeInstanceOf(Batch::class)
->and(Resend::broadcasts())->toBeInstanceOf(Broadcast::class)

->and(Resend::audiences())->toBeInstanceOf(Audience::class);
});