Ecwid / ecwid-mailchimp

MailChimp API Wrapper for Java
Apache License 2.0
86 stars 83 forks source link

Add support for MailChimp API version 2.0 #11

Closed basiliscus closed 10 years ago

basiliscus commented 11 years ago

Hi All,

I've started working on adding support for MailChimp API version 2.0.

The following v2.0 methods have been implemented in d180eb2477e21fd55fcf434fd5036e28a1c06649:

lists/batch-subscribe lists/batch-unsubscribe lists/member-info lists/members lists/subscribe lists/unsubscribe lists/update-member

Please have a look at https://github.com/Ecwid/ecwid-mailchimp/tree/master/src/main/java/com/ecwid/mailchimp/method/v2_0/lists to see the implementation details.

The old v1.3 methods can still be used, however they all have been moved from 'com.ecwid.mailchimp.method' package to 'com.ecwid.mailchimp.method.v1_3' one. I realize that this is a breaking change, but I hope it won't really be a pain to update the package names in the existing code.

One more noticeable change: I've decided not to use enums as API v2.0 parameter fields. For example, the "status" field had enum type in v1.3 "listMembers" method implementation, but the new v2.0 "lists/members" declares it simply as String. Despite enums are safer and more convenient, I've found them difficult to maintain (due to the API inconsistency).

The new 2.0.0.0-SNAPSHOT release can be found in https://oss.sonatype.org/content/repositories/snapshots/ Maven repository. Just add the following declarations to your pom.xml to get it:

<repository>
      <id>sonatype-snapshots</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
...
<dependency>
    <groupId>com.ecwid</groupId>
    <artifactId>ecwid-mailchimp</artifactId>
    <version>2.0.0.0-SNAPSHOT</version>
</dependency>

As always, feedback and contributions are welcome. Thanks.

jtammen commented 11 years ago

This comes at the right time for me–I was just about to start my own Java implementation of the MailChimp API V2 (-; I just played around a bit with API methods lists/subscribe and lists/member-info, did not try out the other ones, yet. No problems so far, looks good to me! Will report in later if I come across any issues.

Thanks for your efforts!

basiliscus commented 11 years ago

Thanks for the feedback.

Just to inform watchers: the new version (2.0.0.0) has been released and is now accessible in Maven Central. Overall 10 v2.0 methods are currently supported: https://github.com/Ecwid/ecwid-mailchimp/wiki/Wrapped-MailChimp-API-methods