-
Notifications
You must be signed in to change notification settings - Fork 92
Extended features #5
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
Conversation
Nightbr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should create a full documentation (like Symfony MailjetBundle) using mkdocs and create github pages for the full documentation.
README.md
Outdated
| ... | ||
| Mailjet\LaravelMailjet\MailjetServiceProvider::class, | ||
| Mailjet\LaravelMailjet\MailjetMailServiceProvider::class, | ||
| Mailjet\LaravelMailjet\Providers\MailjetServiceProvider::class, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a CHANGELOG for this BC-change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, by the way I have for the moment left the Facade, for MailjetServiceProvider and implemented a separate (new) contract + service provider. Do you think I should just leave MailjetServiceProvider in the old namespace, to avoid breaking changes ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I think we should not change this for retro-compatibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good, I'll leave the old facade and provider as it was and let the user choose between facade/contract approach.
src/Model/Campaign.php
Outdated
| * @param array $property | ||
| * @return Properties | ||
| */ | ||
| public function removeOptionalProperty($property) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's many properties which can be unset by a single call to this function, the parameter should better be plural, properties?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also use type array in parameters
public function removeOptionalProperty(array $property) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my "mind" the method was there for adding a single property,but ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok so let it this way. Make sense to add or remove only one property at time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the PHP doc above states it's an array, plus it loops on items
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the loop is to delete the right item
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs is wrong @return Properties should have been the array. Note I implement setOptionalProperties for multiple properties and addOptionalProperty for single property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you want to add a property you do this:
$campaign->addOptionalProperty(array("key"=>"value"));
same thing when you want to remove:
$campaign->removeOptionalProperty(array("key"=>"value"));
that's why it's and array in parameter...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes you are right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise you could do this:
public function addOptionalProperty($key, $value)
and
public function removeOptionalProperty($key)
src/Model/Contact.php
Outdated
| protected $properties; | ||
| protected $action; | ||
|
|
||
| public function __construct($email, $name = null, array $properties = []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not follow same naming convention than other model, which is optionalProperties?
If name is optional, why put it in the constructor?
| } | ||
|
|
||
| if (!is_null($this->properties)) { | ||
| #$result[self::PROPERTIES_KEY] = $this->removeNullProperties($this->properties); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To delete?
src/Model/EventCallbackUrl.php
Outdated
| const EVENT_TYPE_SPAM = 'spam'; | ||
| const EVENT_TYPE_BLOCKED = 'blocked'; | ||
| const EVENT_TYPE_UNSUB = 'unsub'; | ||
| const EVENT_TYPE_TYPOFIX = 'typofix'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all const, I think the best is to implement const into the wrapper and use them in all libraries. Look at this issue mailjet/mailjet-apiv3-php#82
src/Model/EventCallbackUrl.php
Outdated
| const EVENT_TYPE_UNSUB = 'unsub'; | ||
| const EVENT_TYPE_TYPOFIX = 'typofix'; | ||
| const EVENT_TYPE_SENT = 'sent'; | ||
| const EVENT_TYPE_PARSEAPI = 'parseapi'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecated
src/Services/ContactsListService.php
Outdated
| $contact->setAction(Contact::ACTION_UNSUB); | ||
| $response = $this->_exec($listId, $contact); | ||
| if (!$response->success()) { | ||
| $this->throwError("ContactsListManager:unsub() failed", $response); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method is named unsubscribe
src/Services/ContactsListService.php
Outdated
| } | ||
| $response = $this->_exec($listId, $contact); | ||
| if (!$response->success()) { | ||
| $this->throwError("ContactsListManager:sub() failed", $response); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method is named subscribe
| * @param Contact $contact | ||
| * @param string $action | ||
| */ | ||
| public function create($listId, Contact $contact, $action=Contact::ACTION_ADDFORCE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confusing, I would expect it to create a contact list
src/Services/ContactsListService.php
Outdated
| * @param Contact $contact | ||
| * @param string $oldEmail | ||
| */ | ||
| public function changeEmail($listId, Contact $contact, $oldEmail) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update sounds better than change?
| { | ||
| $batchResults = []; | ||
| // we send multiple smaller requests instead of a bigger one | ||
| $contactChunks = array_chunk($contactsList->getContacts(), self::CONTACT_BATCH_SIZE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API will always return up to 1000 (default value for self::CONTACT_BATCH_SIZE). You then will always send one request. Plus I don't see pagination to handle lists bigger than 1000s contacts?
src/Model/Contact.php
Outdated
| public function __construct($email, array $optionalProperties = []) | ||
| { | ||
| $this->email = $email; | ||
| $this->name = $name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$name doesn't exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ouch thanks @Nightbr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nightbr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not commit built documentation and non-related files (screenshot of mailjetBundle Symfony)
|
The structure Resources/doc is a Symfony related structure you should not use it for Laravel Package also, remove Resources/config which is Symfony related. I recommand you create a doc folder at root of the project: Where you will put the documentation. |
|
Hi @Nightbr thanks for feedback, I did not know it was Symfony Specific. |
|
Some reviews:
|
|
You can also add a badge to the README.md
|
|
Love the Mailjet Mkdocs theme! It's pretty neat! |
No description provided.