本文整理汇总了C#中MailChimpManager.GetMemberInfo方法的典型用法代码示例。如果您正苦于以下问题:C# MailChimpManager.GetMemberInfo方法的具体用法?C# MailChimpManager.GetMemberInfo怎么用?C# MailChimpManager.GetMemberInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MailChimpManager
的用法示例。
在下文中一共展示了MailChimpManager.GetMemberInfo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMemberInfo_Successful
public void GetMemberInfo_Successful()
{
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
ListResult lists = mc.GetLists();
List<EmailParameter> emails = new List<EmailParameter>();
EmailParameter email1 = new EmailParameter()
{
Email = "[email protected]"
};
EmailParameter email2 = new EmailParameter()
{
Email = "[email protected]"
};
emails.Add(email1);
emails.Add(email2);
// Act
MemberInfoResult results = mc.GetMemberInfo(lists.Data[1].Id, emails);
// Assert
Assert.IsNotNull(results);
}
示例2: BatchUnsubscribe
/// <summary>
/// Batches the unsubscribe.
/// </summary>
/// <param name="recordList">The records</param>
public virtual BatchUnsubscribeResult BatchUnsubscribe(IEnumerable<MailChimpEventQueueRecord> recordList)
{
if (String.IsNullOrEmpty(_mailChimpSettings.DefaultListId))
throw new ArgumentException("MailChimp list is not specified");
var mc = new MailChimpManager(_mailChimpSettings.ApiKey);
var emails = recordList.Select(sub => new EmailParameter() {Email = sub.Email}).ToList();
MemberInfoResult emailInfos = mc.GetMemberInfo(_mailChimpSettings.DefaultListId, emails);
emails.Clear();
foreach (var member in emailInfos.Data)
{
if (member!=null && member.Status.ToLower().Contains("subscribed"))
{
emails.Add(new EmailParameter() { Email = member.Email });
}
}
////remove email if it's subscribed to mailchimp list
BatchUnsubscribeResult results = mc.BatchUnsubscribe(_mailChimpSettings.DefaultListId, emails, false, true, true);
return results;
}
示例3: SubscribeWithGroupSelectionUsingDictonary_Successful
public void SubscribeWithGroupSelectionUsingDictonary_Successful() {
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
ListResult lists = mc.GetLists();
EmailParameter email = new EmailParameter() {
Email = "[email protected]"
};
// find a list with interest groups...
string strListID = null;
int nGroupingID = 0;
string strGroupName = null;
foreach (ListInfo li in lists.Data) {
List<InterestGrouping> interests = mc.GetListInterestGroupings(li.Id);
if (interests != null) {
if (interests.Count > 0) {
if (interests[0].GroupNames.Count > 0) {
strListID = li.Id;
nGroupingID = interests[0].Id;
strGroupName = interests[0].GroupNames[0].Name;
break;
}
}
}
}
Assert.IsNotNull(strListID, "no lists found in this account with groupings / group names");
Assert.AreNotEqual(0, nGroupingID);
Assert.IsNotNull(strGroupName);
MergeVar mvso = new MergeVar();
mvso.Groupings = new List<Grouping>();
mvso.Groupings.Add(new Grouping());
mvso.Groupings[0].Id = nGroupingID;
mvso.Groupings[0].GroupNames = new List<string>();
mvso.Groupings[0].GroupNames.Add(strGroupName);
mvso.Add("FNAME","Testy" + DateTime.Now);
mvso.Add("LNAME", "Testerson" + DateTime.Now);
// Act
EmailParameter results = mc.Subscribe(strListID, email, mvso);
// Assert
Assert.IsNotNull(results);
Assert.IsTrue(!string.IsNullOrEmpty(results.LEId));
// load
List<EmailParameter> emails = new List<EmailParameter>();
emails.Add(results);
MemberInfoResult memberInfos = mc.GetMemberInfo(strListID, emails);
// Assert
Assert.AreEqual(1, memberInfos.SuccessCount);
Assert.AreEqual(2, memberInfos.Data[0].MemberMergeInfo.Count);
Assert.AreEqual(mvso["FNAME"], memberInfos.Data[0].MemberMergeInfo["FNAME"]);
Assert.AreEqual(mvso["LNAME"], memberInfos.Data[0].MemberMergeInfo["LNAME"]);
}
示例4: 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]"
}
};
MergeVar mVar1 = new MergeVar();
mVar1.Add("FNAME", "first1" + DateTime.Now);
mVar1.Add("LNAME", "last1" + DateTime.Now);
email1.MergeVars = mVar1;
emails.Add(email1);
BatchEmailParameter email2 = new BatchEmailParameter()
{
Email = new EmailParameter()
{
Email = "[email protected]"
}
};
MergeVar mVar2 = new MergeVar();
mVar2.Add("FNAME", "first2" + DateTime.Now);
mVar2.Add("LNAME", "last2" + DateTime.Now);
email2.MergeVars = mVar2;
emails.Add(email2);
// Act
BatchSubscribeResult results = mc.BatchSubscribe(lists.Data[0].Id, emails);
// Assert
Assert.IsNotNull(results);
Assert.IsTrue(results.AddCount == 2);
// load
List<EmailParameter> emailsP = new List<EmailParameter>();
emailsP.Add(email1.Email);
MemberInfoResult memberInfo = mc.GetMemberInfo(lists.Data[0].Id, emailsP);
Assert.AreEqual(mVar1["FNAME"], memberInfo.Data[0].MemberMergeInfo["FNAME"]);
Assert.AreEqual(mVar1["LNAME"], memberInfo.Data[0].MemberMergeInfo["LNAME"]);
}
示例5: UpdateMember_Successful
public void UpdateMember_Successful()
{
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
ListResult lists = mc.GetLists();
EmailParameter email = new EmailParameter()
{
Email = "[email protected]"
};
var listId = lists.Data[0].Id;
MyMergeVar mergeVar = new MyMergeVar();
EmailParameter subscriptionResults = mc.Subscribe(listId, email, mergeVar, "html", false, true);
// Act
mergeVar.FirstName = "some name";
mc.UpdateMember(listId, subscriptionResults, mergeVar);
// load
List<EmailParameter> emails = new List<EmailParameter>();
emails.Add(email);
MemberInfoResult memberInfos = mc.GetMemberInfo(listId, emails);
// Assert
Assert.IsTrue(memberInfos.Data[0].MemberMergeInfo.ContainsKey("FNAME"));
Assert.AreEqual("some name", memberInfos.Data[0].MemberMergeInfo["FNAME"]);
}