{"action":"closed","issue":{"url":"https://api.github.com/repos/spatie/laravel-newsletter/issues/55","repository_url":"https://api.github.com/repos/spatie/laravel-newsletter","labels_url":"https://api.github.com/repos/spatie/laravel-newsletter/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/spatie/laravel-newsletter/issues/55/comments","events_url":"https://api.github.com/repos/spatie/laravel-newsletter/issues/55/events","html_url":"https://github.com/spatie/laravel-newsletter/issues/55","id":187903984,"number":55,"title":"Post Vs. Put","user":{"login":"jrean","id":5646128,"avatar_url":"https://avatars.githubusercontent.com/u/5646128?v=3","gravatar_id":"","url":"https://api.github.com/users/jrean","html_url":"https://github.com/jrean","followers_url":"https://api.github.com/users/jrean/followers","following_url":"https://api.github.com/users/jrean/following{/other_user}","gists_url":"https://api.github.com/users/jrean/gists{/gist_id}","starred_url":"https://api.github.com/users/jrean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrean/subscriptions","organizations_url":"https://api.github.com/users/jrean/orgs","repos_url":"https://api.github.com/users/jrean/repos","events_url":"https://api.github.com/users/jrean/events{/privacy}","received_events_url":"https://api.github.com/users/jrean/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-08T05:15:59Z","updated_at":"2016-11-08T07:17:42Z","closed_at":"2016-11-08T07:17:42Z","body":"Hi,\r\n\r\nThank you for your quality work!\r\nOn my next project, I'm giving a try to your package. I usually used `drew/mailchimp-api` package.\r\n\r\n```\r\n/**\r\n     * @param string $email\r\n     * @param array  $mergeFields\r\n     * @param string $listName\r\n     * @param array  $options\r\n     *\r\n     * @return array|bool\r\n     *\r\n     * @throws \\Spatie\\Newsletter\\Exceptions\\InvalidNewsletterList\r\n     */\r\n    public function subscribe($email, $mergeFields = [], $listName = '', $options = [])\r\n    {\r\n        $list = $this->lists->findByName($listName);\r\n        $defaultOptions = [\r\n            'email_address' => $email,\r\n            'status' => 'subscribed',\r\n            'email_type' => 'html',\r\n        ];\r\n        if (count($mergeFields)) {\r\n            $defaultOptions['merge_fields'] = $mergeFields;\r\n        }\r\n        $options = array_merge($defaultOptions, $options);\r\n        $response = $this->mailChimp->post(\"lists/{$list->getId()}/members\", $options);\r\n        if (! $this->lastActionSucceeded()) {\r\n            return false;\r\n        }\r\n        return $response;\r\n    }\r\n```\r\n\r\nI always use something like:\r\n\r\n```\r\n$mailchimp->put(\"lists/$list/members/\" . $mailchimp->subscriberHash($email), $args);\r\n```\r\n\r\nIt has the benefit of updating a user if he is already subscribed. `Post` doesn't (if I'm not wrong).\r\n\r\nWould you consider to switch to put instead or to introduce a new method such as `subscribeOrUpdate()`?\r\n\r\nFor instance, it can be very useful for \"groups\". A user can subscribe trough several forms and will be added/updated to several MC groups. Hence why the use of `put` is very handy.\r\n\r\nCheers"}}
{"actor":{"display_login":"freekmurze"}}