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

[Feature Request] More fluent syntax for common use cases #30

Open
bkuhl opened this issue Jan 12, 2020 · 0 comments
Open

[Feature Request] More fluent syntax for common use cases #30

bkuhl opened this issue Jan 12, 2020 · 0 comments

Comments

@bkuhl
Copy link

@bkuhl bkuhl commented Jan 12, 2020

I'm a new user of the SDK, but it looks like this snippet is the best way to determine if an email is currently subscribed or not:

$subscription = $this->mailerLite->subscribers()->find($user->email);
if (property_exists($subscription, 'error') && $subscription->error->code === 123) {
   
}

This isn't very readable, and I was only able to obtain the 123 error code through trial & error as I didn't come across it in the documentation. It'd be great if there was a class constant representing this error code or if a shorthand helper method could be added such as if ($this->mailerLite->subscribers()->isSubscribed($email) that either returned a bool or threw an exception on error (e.g. 404).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.