EmmaSharp icon indicating copy to clipboard operation
EmmaSharp copied to clipboard

Add all emma subscriptions endpoints

Open joseph3114 opened this issue 4 years ago • 4 comments

Added all subscription endpoints and models. Tested each in our company's Emma environment. Usage is as follows:

Get Subscriptions: var getallsubs = emmasharp.GetAccountSubscritpions();

Get Subscription Details: var getasub = emmasharp.GetAccountSubscription("sub id");

Get Members of a Subscription: var getmembersofasub = emmasharp.GetSubscriptionMembers("sub id");

Get Opted-Out Members of a Subscription: var checkforoptout = emmasharp.GetOptOutSubscriptionMembers("sub id");

Create a New Subscription Option: SubscriptionNew newSub = new SubscriptionNew { Name = "Test New API", Description = "This was programmatically added by the API" }; var postNewSub = emmasharp.PostNewSubscription(newSub);

Subscribe Member IDs in Bulk: SubscriptionBulk memberIds = new SubscriptionBulk { MemberIds = new List<long> { memberid, memberid} };

var bulkmemmeers = emmasharp.PostBulkMemberSubscrpitions(memberIds, "sub id");

Update Name or Description of an Existing Subscrpition: SubscriptionNew editSub = new SubscriptionNew{ Name = "Test New API - UPDATED", Description = "This was programmatically added by the API - UPDATED" }; var editasub = emmasharp.EditSubscrpition(editSub, "sub id");

Delete an Existing Subscrpition: var deleteasub = emmasharp.DeleteSubscrpition("sub id");

joseph3114 avatar Feb 02 '21 18:02 joseph3114

@joseph3114 can you add tests?

Heanthor avatar Jun 27 '21 23:06 Heanthor

Hi joseph3114,

I'm checking out your PR as you seem to have implemented the Subscriptions model. Only thing I noticed is "SubscriptionImportBulk" seems to be missing. Would you be able to commit that object / source file to this pull request? Otherwise, I fixed the missing angle iron on the one tag that the CI test was complaining about on Line 22 of Methods/Subscriptions.cs:

was missing it's leading angle iron: /parm>

Otherwise, I also updated the two Nuget dependencies "RestSharp" and "Netwonsoft" to current versions.

EDIT: Never mind, I just saw that the file is there, but wasn't in the Visual Studio project. Sorry for the confusion. I'm going to submit a pull request to your fork.

SECOND EDIT: By the way, thank you for writing the Subscriptions model! I was bummed while developing a PowerShell wrapper for this and finding out that Subscriptions didn't exist. I was asked to get the Subscriptions piece working as well on my end and was pleasantly surprised when I saw your pull request.

lwg-galuise avatar Jun 30 '21 22:06 lwg-galuise

@lwg-galuise Same use case on my end, my company only needed the API to manage subscriptions....the one thing this package was missing. Hope it's working! Approved the PR and put it into the master on mine.

joseph3114 avatar Jul 01 '21 14:07 joseph3114

It works like a charm! Thank you!

lwg-galuise avatar Jul 01 '21 15:07 lwg-galuise