Example #1
0
        /// <summary>Sendtemplate will Send a new transactional message through Mandrill using a template</summary>
        /// <param name="key">the users api key</param>
        /// <param name="TemplateName">A string value of the name of the template</param>
        /// <param name="templateContent">An array of template content</param>
        /// <param name="message">A message struct of the other info to send (same as messagesend w/out the html)</param>
        /// <returns>A struct of type RecipientReturn</returns>
        public List <RecipientReturn> sendtemplate(string TemplateName, List <object> templateContent, object message)
        {
            var request = new MandrillRestRequest
            {
                Method   = RestSharp.Method.POST,
                Resource = string.Format("{0}/send-template.xml", messages)
            };

            request.AddBody(new { key = _ApiKey, template_name = TemplateName, template_content = templateContent, message = message });
            return(Execute <List <RecipientReturn> >(request));
        }
Example #2
0
        /// <summary>Get the list of all webhooks defined on the account</summary>
        /// <param name="key">the users api key</param>
        /// <returns>A struct of the webhook information</returns>
        public WebhookInfo Webhookslist()
        {
            var request = new MandrillRestRequest
            {
                Method   = RestSharp.Method.POST,
                Resource = string.Format("{0}/list.json", webhooks)
            };

            request.AddBody(new { key = _ApiKey });
            return(Execute <WebhookInfo>(request));
        }
Example #3
0
        /// <summary>Return the 100 most clicked URLs that match the search query given</summary>
        /// <param name="key">the users api key</param>
        /// <param name="q">a search query</param>
        /// <returns>the 100 most clicked URLs and their stats</returns>
        public List <URLStats> UrlSearch(string q)
        {
            var request = new MandrillRestRequest
            {
                Method   = RestSharp.Method.POST,
                Resource = string.Format("{0}/search.json", url)
            };

            request.AddBody(new { key = _ApiKey, q = q });

            return(Execute <List <URLStats> >(request));
        }
Example #4
0
        /// <summary>"time-series" Return the recent history (hourly stats for the last 30 days) for a sender</summary>
        /// <param name="key">the users api key</param>
        /// <param name="address">The email address of the sender</param>
        /// <returns>the array of history information</returns>
        public List <TimeSeries> SenderTimeSeries(string Address)
        {
            var request = new MandrillRestRequest
            {
                Method   = RestSharp.Method.POST,
                Resource = string.Format("{0}/time-series.json", sender)
            };

            request.AddBody(new { key = _ApiKey, address = Address });

            return(Execute <List <TimeSeries> >(request));
        }
Example #5
0
        /// <summary>Info returns more detailed information about a single sender,
        /// including aggregates of recent stats</summary>
        /// <param name="key">the user api key</param>
        /// <param name="address">The email address of the sender</param>
        /// <returns>a struct of the detailed information about the sender</returns>
        public List <SenderData> SenderInfo(string Address)
        {
            var request = new MandrillRestRequest
            {
                Method   = RestSharp.Method.POST,
                Resource = string.Format("{0}/info.json", sender)
            };

            request.AddBody(new { key = _ApiKey, address = Address });

            return(Execute <List <SenderData> >(request));
        }
Example #6
0
        /// <summar>Delete a template</summar></summary>
        /// <param name="key">the users api key</param>
        /// <param name="name">the name of an existing template</param>
        /// <returns>the information saved about the deleted template</returns>
        public TemplateInfo Templatedelete(string name)
        {
            var request = new MandrillRestRequest
            {
                Method   = RestSharp.Method.POST,
                Resource = string.Format("{0}/delete.json", templates)
            };

            request.AddBody(new { key = _ApiKey, name = name });

            return(Execute <TemplateInfo>(request));
        }
Example #7
0
        /// <summary>Deletes an email rejection. There is no limit to how many rejections
        /// you can remove from your blacklist, but keep in mind that each deletion
        /// has an affect on your reputation.</summary>
        /// <param name="key">the users api key</param>
        /// <param name="Email">an email address</param>
        /// <returns>a status object containing the address and whether the deletion succeeded.</returns>
        public List <DeletedSuccesses> delete(string Email)
        {
            var request = new MandrillRestRequest
            {
                Method   = RestSharp.Method.POST,
                Resource = string.Format("{0}/delete.xml", tags)
            };

            request.AddBody(new { key = _ApiKey, email = Email });

            return(Execute <List <DeletedSuccesses> >(request));
        }
Example #8
0
        /// <summary>Retrieves your email rejection blacklist. You can provide an email
        /// address to limit the results. Returns up to 1000 results</summary>
        /// <param name="key">the users api key</param>
        /// <param name="Email">an optional email address to search by</param>
        /// <returns>the information for each rejection blacklist entry</returns>
        public List <BlackList> list(string Email)
        {
            var request = new MandrillRestRequest
            {
                Method   = RestSharp.Method.POST,
                Resource = string.Format("{0}/list.xml", tags)
            };

            request.AddBody(new { key = _ApiKey, email = Email });

            return(Execute <List <BlackList> >(request));
        }
Example #9
0
        /// <summary>Search the content of recently sent messages and optionally narrow by date range, tags and senders</summary>
        /// <param name="key">the users api key</param>
        /// <param name="query">the search items to find matching messages to</param>
        /// <param name="date_from">start date</param>
        /// <param name="date_to">end date</param>
        /// <param name="tags">array of string containing tag names</param>
        /// <param name="senders">array of senders addresses</param>
        /// <param name="limit">maximum number of results to return</param>
        /// <returns>A struct of type RecipientReturn</returns>
        public List <SearchReturn> search(string query, string date_from, string date_to, List <string> tags, List <string> senders, int limit)
        {
            var request = new MandrillRestRequest
            {
                Method   = RestSharp.Method.POST,
                Resource = string.Format("{0}/search.xml", messages)
            };

            request.AddBody(new { key = _ApiKey, query = query, date_from = date_from, tags = tags, senders = senders, limit = limit });

            return(Execute <List <SearchReturn> >(request));
        }
Example #10
0
        /// <summary>Send will send a new transactional message through Mandrill</summary>
        /// <param name="key">the users api key</param>
        /// <param name="T">The message data</param>
        /// <returns>A struct of type RecipientReturn</returns>
        public List <RecipientReturn> send(object T)
        {
            var request = new MandrillRestRequest
            {
                Method   = RestSharp.Method.POST,
                Resource = string.Format("{0}/search.json", messages)
            };

            request.AddBody(new { key = _ApiKey, message = T });

            return(Execute <List <RecipientReturn> >(request));
        }
Example #11
0
        /// <summary>Update an existing webhook</summary>
        /// <param name="key">the users api key</param>
        /// <param name="id">the unique identifier of a webhook belonging to this account</param>
        /// <param name="url">the URL to POST batches of events</param>
        /// <param name="T">an optional list of events that will be posted to the webhook</param>
        /// <returns>the information for the updated webhook</returns>
        public WebhookInfo Webhooksupdate(int id, string url, List <object> T)
        {
            var request = new MandrillRestRequest
            {
                Method   = RestSharp.Method.POST,
                Resource = string.Format("{0}/update.json", webhooks)
            };

            request.AddBody(new { key = _ApiKey, id = id, url = url, events = T });

            return(Execute <WebhookInfo>(request));
        }
Example #12
0
        /// <summary>Add a new webhook</summary>
        /// <param name="key">the users api key</param>
        /// <param name="url">the URL to POST batches of events</param>
        /// <param name="T">an optional list of events that will be posted to the webhook</param>
        /// <returns>the information saved about the new webhook</returns>
        public WebhookInfo Webhooksadd(string url, List <object> T)
        {
            var request = new MandrillRestRequest
            {
                Method   = RestSharp.Method.POST,
                Resource = string.Format("{0}/add.json", webhooks)
            };

            request.AddBody(new { key = _ApiKey, message = T });

            return(Execute <WebhookInfo>(request));
        }
Example #13
0
        /// <summaryReturn the recent history (hourly stats for the last 30 days) for a tag</summary>
        /// <param name="key">the users api key</param>
        /// <returns>struct of the detailed information about the tag</returns>
        public List <TimeSeries> AllTimeSeries()
        {
            var request = new MandrillRestRequest
            {
                Method   = RestSharp.Method.POST,
                Resource = string.Format("{0}/all-time-series.json", tags)
            };

            request.AddBody(new { key = _ApiKey });

            return(Execute <List <TimeSeries> >(request));
        }
Example #14
0
        /// <summaryReturn all of the user-defined tag information</summary>
        /// <param name="key">the users api key</param>
        /// <param name="tag"> an existing tag name</param>
        /// <returns>struct of the detailed information about the tag</returns>
        public List <DetailedTags> info(string tag)
        {
            var request = new MandrillRestRequest
            {
                Method   = RestSharp.Method.POST,
                Resource = string.Format("{0}/info.json", tags)
            };

            request.AddBody(new { key = _ApiKey, tag = tag });

            return(Execute <List <DetailedTags> >(request));
        }
Example #15
0
        /// <summaryReturn all of the user-defined tag information</summary>
        /// <param name="key">the users api key</param>
        /// <returns>Return the 100 most clicked URLs that match the search query given</returns>
        public List <Tags> list()
        {
            var request = new MandrillRestRequest
            {
                Method   = RestSharp.Method.POST,
                Resource = string.Format("{0}/list.json", tags)
            };

            request.AddBody(new { key = _ApiKey });

            return(Execute <List <Tags> >(request));
        }