コード例 #1
0
        /**
        ** listMemberInfo method definitions
        **/
        public MCMemberInfo listMemberInfo(string listId, string email_address)
        {
            DummyMCMemberInfo tmp = this.api.listMemberInfo(this.apikey, listId, email_address);
            XmlRpcStruct      s   = (XmlRpcStruct)tmp.merges;

            MCMergeVar[] vars  = new MCMergeVar[(s).Count];
            MCMemberInfo toret = new MCMemberInfo();

            //copy everything normal over
            toret.email      = tmp.email;
            toret.email_type = tmp.email_type;
            toret.status     = tmp.status;
            toret.timestamp  = tmp.timestamp;
            int i = 0;

            foreach (string tag in s.Keys)
            {
                MCMergeVar v = new MCMergeVar();
                v.tag   = tag;
                v.val   = (string)s[tag];
                vars[i] = v;
                i++;
            }
            toret.merges = vars;
            return(toret);
        }
コード例 #2
0
    public void list_batch_unsubscribe()
    {
        //  MCBatchUnsubResult listBatchUnsubscribe(string id, MCMemberInfo[] batch, bool delete_member, bool send_goodbye, bool send_notify){
            string list_id = "YOUR_LIST_ID";
            MCMemberInfo[] batch = new MCMemberInfo[2];
            batch[0].email = "*****@*****.**";

            batch[1].email = "*****@*****.**";

            MCBatchResult result = this.api.listBatchUnsubscribe(list_id, batch, false,false,false);
            Console.WriteLine("Success:" + result.success_count);
            Console.WriteLine("Errors:" + result.error_count);
            foreach(MCEmailResult item in result.errors){
                Console.WriteLine("\t [" + item.code + "] " + item.message);
                Console.WriteLine("\t\t email: " + item.row.email);
            }
    }
コード例 #3
0
    public void list_batch_subscribe()
    {
        //listBatchSubscribe(string id, MCMemberInfo[] batch, bool double_optin, bool update_existing, bool replace_interests);
            string list_id = "YOUR_LIST_ID";
            MCMemberInfo[] batch = new MCMemberInfo[2];
            batch[0].email = "*****@*****.**";
            batch[0].email_type = "html";
            batch[0].merges = new MCMergeVar[3];
            batch[0].merges[0].tag = "FNAME";
            batch[0].merges[0].val = "David";
            batch[0].merges[1].tag = "LNAME";
            batch[0].merges[1].val = "Gilmour";
            batch[0].merges[2].tag = "INTERESTS";
            batch[0].merges[2].val = "Sand";

            batch[1].email = "*****@*****.**";
            batch[1].email_type = "html";
            batch[1].merges = new MCMergeVar[3];
            batch[1].merges[0].tag = "FNAME";
            batch[1].merges[0].val = "Roger";
            batch[1].merges[1].tag = "LNAME";
            batch[1].merges[1].val = "Waters";
            batch[1].merges[2].tag = "INTERESTS";
            batch[1].merges[2].val = "Water";

            MCBatchResult result = this.api.listBatchSubscribe(list_id, batch, false);
            Console.WriteLine("Success:" + result.success_count);
            Console.WriteLine("Errors:" + result.error_count);
            foreach(MCEmailResult item in result.errors){
                Console.WriteLine("\t [" + item.code + "] " + item.message);
                Console.WriteLine("\t\t email: " + item.row.email + " | " + item.row.merges[0].tag + " = " + item.row.merges[0].val);
            }
    }
コード例 #4
0
ファイル: MailChimp.cs プロジェクト: jachaines/MailChimpv1
 private static string GetIdFieldFromMergeVars(MCMemberInfo info)
 {
     return info.merges.Where(mergevar => mergevar.name == IdField)
                       .Select(mergevar => mergevar.val)
                       .FirstOrDefault();
 }
コード例 #5
0
 /**
  ** listMemberInfo method definitions
  **/
 public MCMemberInfo listMemberInfo(string listId, string email_address)
 {
     DummyMCMemberInfo tmp = this.api.listMemberInfo(this.apikey, listId, email_address);
     XmlRpcStruct s = (XmlRpcStruct)tmp.merges;
     MCMergeVar[] vars = new MCMergeVar[(s).Count];
     MCMemberInfo toret = new MCMemberInfo();
     //copy everything normal over
     toret.email = tmp.email;
     toret.email_type = tmp.email_type;
     toret.status = tmp.status;
     toret.timestamp = tmp.timestamp;
     int i = 0;
     foreach (string tag in s.Keys)
     {
         MCMergeVar v = new MCMergeVar();
         v.tag = tag;
         v.val = (string)s[tag];
         vars[i] = v;
         i++;
     }
     toret.merges = vars;
     return toret;
 }
コード例 #6
0
        public MCBatchResult listBatchUnsubscribe(string id, MCMemberInfo[] batch, bool delete_member, bool send_goodbye, bool send_notify)
        {
            //massage the input
            XmlRpcStruct xBatch = new XmlRpcStruct();
            int i = 0;
            foreach (MCMemberInfo info in batch)
            {
                xBatch.Add(i + "", info.email);
                i++;
            }

            //make the call
            DummyMCBatchResult res = this.api.listBatchUnsubscribe(this.apikey, id, xBatch, delete_member, send_goodbye, send_notify);
            //massage the output
            MCBatchResult toret = new MCBatchResult();
            toret.success_count = res.success_count;
            toret.error_count = res.error_count;
            toret.errors = new MCEmailResult[res.errors.Length];
            i = 0;
            foreach (DummyMCEmailResult err in res.errors)
            {
                MCEmailResult tmp = new MCEmailResult();
                //copy everything normal over
                tmp.code = err.code;
                tmp.message = err.message;
                tmp.row = new MCMemberInfo();
                tmp.row.email = err.email;
                toret.errors[i] = tmp;
                i++;
            }
            return toret;
        }
コード例 #7
0
 public MCBatchResult listBatchUnsubscribe(string id, MCMemberInfo[] batch, bool delete_member, bool send_goodbye)
 {
     return this.listBatchUnsubscribe(id, batch, delete_member, send_goodbye, false);
 }
コード例 #8
0
 public MCBatchResult listBatchUnsubscribe(string id, MCMemberInfo[] batch, bool delete_member)
 {
     return this.listBatchUnsubscribe(id, batch, delete_member, true);
 }
コード例 #9
0
 /**
  ** listBatchUnsubscribe method definitions
  **/
 public MCBatchResult listBatchUnsubscribe(string id, MCMemberInfo[] batch)
 {
     return this.listBatchUnsubscribe(id, batch, false);
 }
コード例 #10
0
        public MCBatchResult listBatchSubscribe(string id, MCMemberInfo[] batch, bool double_optin, bool update_existing, bool replace_interests)
        {
            //massage the input
            XmlRpcStruct xBatch = new XmlRpcStruct();
            int i = 0;
            foreach (MCMemberInfo info in batch)
            {
                XmlRpcStruct mv = new XmlRpcStruct();
                mv.Add("EMAIL", info.email);
                mv.Add("EMAIL_TYPE", info.email_type);
                foreach (MCMergeVar var in info.merges)
                {
                    mv.Add(var.tag, var.val);
                }
                xBatch.Add(i + "", mv);
                i++;
            }

            //make the call
            DummyMCBatchResult res = this.api.listBatchSubscribe(this.apikey, id, xBatch, double_optin, update_existing, replace_interests);

            //massage the output
            MCBatchResult toret = new MCBatchResult();
            toret.success_count = res.success_count;
            toret.error_count = res.error_count;
            toret.errors = new MCEmailResult[res.errors.Length];
            i = 0;
            foreach (DummyMCEmailResult err in res.errors)
            {
                MCEmailResult tmp = new MCEmailResult();
                //copy everything normal over
                tmp.code = err.code;
                tmp.message = err.message;

                XmlRpcStruct s = (XmlRpcStruct)err.row;
                MCMemberInfo info = new MCMemberInfo();
                info.merges = new MCMergeVar[(s).Count];
                int j = 0;
                foreach (string tag in s.Keys)
                {
                    if (tag == "EMAIL")
                    {
                        info.email = (string)s[tag];
                    }
                    if (tag == "EMAIL_TYPE")
                    {
                        info.email_type = (string)s[tag];
                    }
                    info.merges[j] = new MCMergeVar();
                    info.merges[j].tag = tag;
                    info.merges[j].val = (string)s[tag];
                    j++;
                }
                tmp.row = info;
                toret.errors[i] = tmp;
                i++;
            }
            return toret;
        }
コード例 #11
0
 public MCBatchResult listBatchSubscribe(string id, MCMemberInfo[] batch, bool double_optin, bool update_existing)
 {
     return this.listBatchSubscribe(id, batch, double_optin, update_existing, true);
 }
コード例 #12
0
 public MCBatchResult listBatchSubscribe(string id, MCMemberInfo[] batch, bool double_optin)
 {
     return this.listBatchSubscribe(id, batch, double_optin, false);
 }
コード例 #13
0
        public MCBatchResult listBatchSubscribe(string id, MCMemberInfo[] batch, bool double_optin, bool update_existing, bool replace_interests)
        {
            //massage the input
            XmlRpcStruct xBatch = new XmlRpcStruct();
            int          i      = 0;

            foreach (MCMemberInfo info in batch)
            {
                XmlRpcStruct mv = new XmlRpcStruct();
                mv.Add("EMAIL", info.email);
                mv.Add("EMAIL_TYPE", info.email_type);
                foreach (MCMergeVar var in info.merges)
                {
                    mv.Add(var.tag, var.val);
                }
                xBatch.Add(i + "", mv);
                i++;
            }

            //make the call
            DummyMCBatchResult res = this.api.listBatchSubscribe(this.apikey, id, xBatch, double_optin, update_existing, replace_interests);

            //massage the output
            MCBatchResult toret = new MCBatchResult();

            toret.success_count = res.success_count;
            toret.error_count   = res.error_count;
            toret.errors        = new MCEmailResult[res.errors.Length];
            i = 0;
            foreach (DummyMCEmailResult err in res.errors)
            {
                MCEmailResult tmp = new MCEmailResult();
                //copy everything normal over
                tmp.code    = err.code;
                tmp.message = err.message;

                XmlRpcStruct s    = (XmlRpcStruct)err.row;
                MCMemberInfo info = new MCMemberInfo();
                info.merges = new MCMergeVar[(s).Count];
                int j = 0;
                foreach (string tag in s.Keys)
                {
                    if (tag == "EMAIL")
                    {
                        info.email = (string)s[tag];
                    }
                    if (tag == "EMAIL_TYPE")
                    {
                        info.email_type = (string)s[tag];
                    }
                    info.merges[j]     = new MCMergeVar();
                    info.merges[j].tag = tag;
                    info.merges[j].val = (string)s[tag];
                    j++;
                }
                tmp.row         = info;
                toret.errors[i] = tmp;
                i++;
            }
            return(toret);
        }        //listBatchSubscribe