v3.0.0-rc1
This release candidate updates the library architecture to allow support for both API key-based authentication (existing) and OAuth authentication (new)
- Now to instantiate a Mailchimp connection you need to instantiate a MailchimpApiInterface and a MailchimpApiIUser with something like the following:
// Instantiate MailchimpApiInterface
$authentication_settings = [
'access_token' => $this->stateService->get('mailchimp_access_token'),
'data_center' => $this->stateService->get('mailchimp_data_center'),
'api_user' => 'oauth',
];
// Use Mailchimp2 for OAuth and Mailchimp for api_key.
$api_class = new Mailchimp2($authentication_settings);
$http_options = [
'timeout' => $this->config->get('api_timeout'),
'headers' => [
'User-Agent' => _mailchimp_get_user_agent(),
],
];
// Instantiate a MailchimpApiUser or a class that extends it (ie. MailchimpLists, MailchimpSignups, etc..)
$mailchip_object = new MailchimpApiUser($api_class, $http_options);