MailChimp.NET icon indicating copy to clipboard operation
MailChimp.NET copied to clipboard

An attempt to remove ServiceStack dependency, update .NET version to 4.5 and make this cross-platform

Open theofanis opened this issue 10 years ago • 2 comments

Please see @jtourkos's and my work here: https://github.com/theofanis/MailChimp.NET

This is a late night's work, no more than a couple of hours in total. Our main purpose was to overcome ServiceStack dependency for one of our internal projects, but made a few more changes to fulfill requirements others may find useful and start building from there in order to make this compatible with their projects. Please see some notes below as well:

  • Created a PCL MailChimp.Portable targeting mobile platforms, .net 4.5 and the new ASP.NET 5.0 (.NET Core) and copy-pasted all existing class files from MailChimp project
  • Didn't rename namespaces in existing classes as to not break code referencing this
  • Removed Servicestack dependency
    • Json.NET now handles de/serialization
    • HttpClient now makes REST API calls (not using await, blocking with .Result as to not change the Interfaces at all, although that is not hard at all if one wants to make this 100% async)
  • Changed ListInfo.DateLastCampaign to DateTime? to overcome null value deserialization
  • Created a JsonConverter to use on properties that are objects in JSON responses but appear as empty arrays when their value should be null. For example, Campaign.SegmentOpts which is of type CampaignSegmentOptions but may appear as an empty array in the JSON response when fetching campaigns
  • ReplacedDataMember attributes with JsonProperty

Disclaimer: The portable project is not unit tested at all and may not work corrrectly for all calls

theofanis avatar Dec 22 '15 14:12 theofanis

@theofanis This is a great effort! I think we should bump the major version information in the build, and you should make an official pull request. Many folks have expressed a desire to see these changes. Also: I think we should expose the async/await methods as the first-class API signatures.

Thoughts?

danesparza avatar Dec 23 '15 03:12 danesparza

Sorry for the delay man. Feel free to act on the pr. My contribution will probably be limited from now on because of time restrictions, but I will definitely keep my eye on this.

Btw, you can probably change the interfaces to make them fully async in the Portable project, since that's a new one and keep the old one for legacy compatibility.

Cheers!

theofanis avatar Dec 29 '15 13:12 theofanis