本文整理汇总了C#中MailChimpManager.GetLists方法的典型用法代码示例。如果您正苦于以下问题:C# MailChimpManager.GetLists方法的具体用法?C# MailChimpManager.GetLists怎么用?C# MailChimpManager.GetLists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MailChimpManager
的用法示例。
在下文中一共展示了MailChimpManager.GetLists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetDefaultSubscribersList
private void SetDefaultSubscribersList(string accessToken, string dataCenter)
{
var mc = new MailChimpManager(accessToken, dataCenter);
var lists = mc.GetLists();
if (lists.Data.Any())
_settingsManager.SetValue(_subscribersListIdPropertyName, lists.Data[0].Id);
}
示例2: BatchSubscribe_Successful
public void BatchSubscribe_Successful()
{
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
ListResult lists = mc.GetLists();
List<BatchEmailParameter> emails = new List<BatchEmailParameter>();
BatchEmailParameter email1 = new BatchEmailParameter()
{
Email = new EmailParameter()
{
Email = "[email protected]"
}
};
BatchEmailParameter email2 = new BatchEmailParameter()
{
Email = new EmailParameter()
{
Email = "[email protected]"
}
};
emails.Add(email1);
emails.Add(email2);
// Act
BatchSubscribeResult results = mc.BatchSubscribe(lists.Data[1].Id, emails);
// Assert
Assert.IsNotNull(results);
Assert.IsTrue(results.AddCount == 2);
}
示例3: GetMemberActivity_Successful
public void GetMemberActivity_Successful()
{
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
ListResult lists = mc.GetLists();
Assert.IsNotNull(lists.Data);
Assert.IsTrue(lists.Data.Any());
MembersResult members = mc.GetAllMembersForList(lists.Data[0].Id);
Assert.IsNotNull(members.Data);
Assert.IsTrue(members.Data.Any());
List<EmailParameter> memberEmails = new List<EmailParameter>();
foreach (MemberInfo member in members.Data)
{
memberEmails.Add(new EmailParameter() { Email = member.Email });
}
// Act
MemberActivityResult results = mc.GetMemberActivity(lists.Data[0].Id, memberEmails);
// Assert
Assert.IsNotNull(results);
Assert.IsTrue(results.Data.Any());
}
示例4: Send
public void Send(String idUser, String firstName, String email)
{
String emailAPI = ConfigurationManager.AppSettings["MailChimpAPI"].ToString();
MailChimpManager mc = new MailChimpManager(emailAPI);
ListResult lists = mc.GetLists();
EmailConfirm emailConfirm = new EmailConfirm();
//emailConfirm.Groupings = new List<Grouping>();
//emailConfirm.Groupings.Add(new Grouping());
//emailConfirm.Groupings[0].Id = 1234; // replace with your grouping id
//emailConfirm.Groupings[0].GroupNames = new List<string>();
//emailConfirm.Groupings[0].GroupNames.Add("Your Group Name");
emailConfirm.FirstName = firstName;
emailConfirm.IdUser = idUser;
// Create the email parameter
EmailParameter parameters = new EmailParameter()
{
Email = email
};
// ListResult lr = mc.GetLists();
EmailParameter results = mc.Subscribe("d31fd680be", parameters, emailConfirm);
}
示例5: Update
public ActionResult Update(string id)
{
var defaultEvent = service.GetDefaultEvent();
int eventid = defaultEvent.ID;
MailChimpManager mc = new MailChimpManager(_mailchimpKey);
ListInfo mailingList = mc.GetLists().Data.Where(l=>l.Id==id).SingleOrDefault();
List<BatchEmailParameter> batchList = new List<BatchEmailParameter>();
if (mailingList.Name.Contains("Speakers"))
{
foreach (var speaker in service.GetSpeakers(eventid))
{
MyMergeVar myMergeVars = new MyMergeVar();
myMergeVars.FirstName = speaker.FirstName;
myMergeVars.LastName = speaker.LastName; // Create the email parameter
BatchEmailParameter batchEmail = new BatchEmailParameter();
EmailParameter email = new EmailParameter()
{
Email = speaker.Email
};
batchEmail.Email = email;
batchEmail.MergeVars = myMergeVars;
batchList.Add(batchEmail);
}
}
if (mailingList.Name.Contains("Attendees"))
{
foreach (var attendee in service.GetAllAttendees(eventid))
{
MyMergeVar myMergeVars = new MyMergeVar();
myMergeVars.FirstName = attendee.FirstName;
myMergeVars.LastName = attendee.LastName; // Create the email parameter
EmailParameter email = new EmailParameter()
{
Email = attendee.Email
};
BatchEmailParameter batchEmail = new BatchEmailParameter();
batchEmail.Email = email;
batchEmail.MergeVars = myMergeVars;
batchList.Add(batchEmail);
}
}
BatchSubscribeResult bResult = mc.BatchSubscribe(id, batchList, false, true, true);
//MyMergeVar myMergeVars = new MyMergeVar();
//myMergeVars.FirstName = subscriber.FirstName;
//myMergeVars.LastName = subscriber.LastName; // Create the email parameter
//EmailParameter email = new EmailParameter()
//{
// Email = subscriber.EmailAddress
//};
//EmailParameter results = mc.Subscribe(_mailchimpGroupId, email, myMergeVars);
return RedirectToAction("Index");
}
示例6: GetLists_Successful
public void GetLists_Successful()
{
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
// Act
ListResult details = mc.GetLists();
// Assert
Assert.IsNotNull(details.Data);
}
示例7: Index
//
// GET: /MailingList/
public ActionResult Index()
{
var defaultEvent = service.GetDefaultEvent();
int eventid = defaultEvent.ID;
ViewBag.Event = service.GetEvent(eventid);
int eventYear = ViewBag.Event.StartTime.Year;
MailChimpManager mc = new MailChimpManager(_mailchimpKey);
List<ListInfo> mailingLists = mc.GetLists().Data.Where(l=>l.Name.Contains(eventYear.ToString())).ToList();
return View(mailingLists);
}
示例8: GetAbuseReport_Successful
public void GetAbuseReport_Successful()
{
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
ListResult lists = mc.GetLists();
// Act
AbuseResult details = mc.GetListAbuseReports(lists.Data[0].Id);
// Assert
Assert.IsNotNull(details.Data);
}
示例9: GetListActivity_Successful
public void GetListActivity_Successful()
{
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
ListResult lists = mc.GetLists();
// Act
List<ListActivity> results = mc.GetListActivity(lists.Data[1].Id);
// Assert
Assert.IsNotNull(results);
Assert.IsTrue(results.Any());
}
示例10: StaticSegment_Successful
public void StaticSegment_Successful()
{
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
ListResult lists = mc.GetLists();
// Act
List<StaticSegment> results = mc.GetStaticSegmentsFromList(lists.Data[1].Id);
// Assert
Assert.IsNotNull(results);
}
示例11: GetListInterestGroupings_Successful
public void GetListInterestGroupings_Successful()
{
// Arrange
MailChimpManager mc = new MailChimpManager("efb48a02f2f56120e2f3f6e2fef71803-us6");
ListResult lists = mc.GetLists(new ListFilter(){ListName = "TestAPIGetInterestGroup"});
Assert.IsNotNull(lists);
Assert.IsTrue(lists.Data.Any());
// Act
List<InterestGrouping> results = mc.GetListInterestGroupings(lists.Data.FirstOrDefault().Id);
// Assert
Assert.IsNotNull(results);
Assert.IsTrue(results.Any());
}
示例12: Subscribe_Successful
public void Subscribe_Successful()
{
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
ListResult lists = mc.GetLists();
EmailParameter email = new EmailParameter()
{
Email = "[email protected]"
};
// Act
EmailParameter results = mc.Subscribe(lists.Data[1].Id, email);
// Assert
Assert.IsNotNull(results);
Assert.IsTrue(!string.IsNullOrEmpty(results.LEId));
}
示例13: CampaignSegmentTest_Successful
public void CampaignSegmentTest_Successful()
{
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
ListResult lists = mc.GetLists();
CampaignSegmentOptions options = new CampaignSegmentOptions();
options.Match= "All";
string dateListCreated = lists.Data[1].DateCreated;
List<CampaignSegmentCriteria> conditions = new List<CampaignSegmentCriteria>();
conditions.Add(new CampaignSegmentCriteria { Field = "date", Operator = "eq", Value = dateListCreated });
options.Conditions = conditions;
string listId = lists.Data[1].Id;
// Act
CampaignSegmentTestResult result = mc.CampaignSegmentTest(listId,options);
// Assert
Assert.IsTrue(result.Total == 1);
}
示例14: StaticSegmentAdd_Successful
public void StaticSegmentAdd_Successful()
{
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
ListResult lists = mc.GetLists();
//Get existing segments
List<StaticSegment> segments = mc.GetStaticSegmentsFromList(lists.Data[1].Id);
StaticSegmentDeleteResult deleteResult;
//Check to see if test segment exists, delete if it does.
if (segments.Where(x => x.Name == "TestSegment").Count() > 0)
deleteResult = mc.StaticSegmentDelete(lists.Data[1].Id, segments.Where(x => x.Name == "TestSegment").FirstOrDefault().Id);
// Act
StaticSegmentAddResult results = mc.StaticSegmentAdd(lists.Data[1].Id, "TestSegment");
// Assert
Assert.IsTrue(!string.IsNullOrEmpty(results.Id));
}
示例15: ExportGetListsWithSinceFilterInFuture_Successful
public void ExportGetListsWithSinceFilterInFuture_Successful()
{
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
MailChimpExportManager mce = new MailChimpExportManager(TestGlobal.Test_APIKey);
ListResult lists = mc.GetLists();
Assert.IsNotNull(lists.Data);
Assert.IsTrue(lists.Data.Any());
string listId = lists.Data[0].Id;
Assert.IsNotNull(lists.Data[0].Id);
// Act
var results = mce.GetAllMembersForList(listId, since: DateTime.UtcNow.AddDays(1).ToString() );
// Assert
Assert.IsNotNull(results);
Assert.IsTrue(results.Count == 0, "Export should contain 0 records. No record should have a LAST_UPDATED date in the future.");
}