예제 #1
0
        /// <summary>
        /// Returns the contacts having the provided email address.
        /// </summary>
        /// <param name="email"></param>
        /// <param name="standardFields"></param>
        /// <param name="customFields"></param>
        /// <returns></returns>
        public List <Contact> GetContactsByEmail(string email, List <StandardFieldName> standardFields, List <string> customFields)
        {
            QueryParameters parameters = new QueryParameters();

            parameters.AddList("standard_field", standardFields);
            parameters.AddList("custom_field", customFields);

            ResponseWrapper response = Get("contacts/email/" + HttpUtility.UrlEncode(email), parameters);

            return(SerializationUtils <ContactCollection> .FromXmlString(response.Body));
        }
예제 #2
0
        internal override QueryParameters GetQueryParameters()
        {
            QueryParameters parameters = CreateQueryParameters(
                this.From, this.To,
                this.MailingIdFilter, this.ContactIdFilter, this.ContactEmailFilter, this.ContactExternalIdFilter,
                this.EmbedFieldBackups);

            parameters.AddList("standard_field", this.StandardFields);
            parameters.AddList("custom_field", this.CustomFields);
            parameters.Add("exclude_deleted_recipients", this.ExcludeDeleted);

            return(parameters);
        }
예제 #3
0
        /// <summary>
        /// Gets a contact by  Maileon ID and checksum
        /// </summary>
        /// <param name="id">the Maileon ID of the contact</param>
        /// <param name="checksum">the checksum of the contact</param>
        /// <param name="standardFields">the standard fields</param>
        /// <param name="customFields">the custom fields</param>
        /// <returns>a contact</returns>
        public Contact GetContact(long id, string checksum, List <StandardFieldName> standardFields, List <string> customFields)
        {
            QueryParameters parameters = new QueryParameters();

            parameters.Add("id", id);
            parameters.Add("checksum", checksum);
            parameters.AddList("standard_field", standardFields);
            parameters.AddList("custom_field", customFields);

            ResponseWrapper response = Get("contacts/contact", parameters);

            return(SerializationUtils <Contact> .FromXmlString(response.Body));
        }
예제 #4
0
        internal override QueryParameters GetQueryParameters()
        {
            QueryParameters parameters = CreateQueryParameters(
                this.From, this.To,
                this.MailingIdFilter, this.ContactIdFilter, this.ContactEmailFilter, this.ContactExternalIdFilter,
                this.EmbedFieldBackups);

            parameters.AddList("standard_field", this.StandardFields);
            parameters.AddList("custom_field", this.CustomFields);
            parameters.AddList("reasons", this.ReasonFilter);
            parameters.Add("old_status", this.OldStatus);
            parameters.Add("new_status", this.NewStatus);
            parameters.Add("exclude_anonymous_blocks", this.ExcludeAnonymous);

            return(parameters);
        }
예제 #5
0
        internal override QueryParameters GetQueryParameters()
        {
            QueryParameters parameters = CreateQueryParameters(
                this.From, this.To,
                this.MailingIdFilter, this.ContactIdFilter, this.ContactEmailFilter, this.ContactExternalIdFilter,
                this.EmbedFieldBackups);

            parameters.AddList("standard_field", this.StandardFields);
            parameters.AddList("custom_field", this.CustomFields);
            parameters.AddList("status_code", this.StatusCodeFilter);
            parameters.Add("type", this.TypeFilter);
            parameters.Add("source", this.SourceFilter);
            parameters.Add("exclude_anonymous_bounces", this.ExcludeAnonymous);

            return(parameters);
        }
예제 #6
0
        /// <summary>
        /// Get the contacts that match a given filter id
        /// </summary>
        /// <param name="contactFilterId">the ID of the contact filter to apply</param>
        /// <param name="standardFields">the standard fields</param>
        /// <param name="customFields">the custom fields</param>
        /// <param name="pageIndex">the page index</param>
        /// <param name="pageSize">the page size</param>
        /// <returns>a page of contacts</returns>
        public Page <Contact> GetContactsByFilterId(long contactFilterId, List <StandardFieldName> standardFields, List <string> customFields, int pageIndex, int pageSize)
        {
            QueryParameters parameters = new QueryParameters();

            parameters.Add("page_index", pageIndex);
            parameters.Add("page_size", pageSize);
            parameters.AddList("standard_field", standardFields);
            parameters.AddList("custom_field", customFields);

            ResponseWrapper response = Get("contacts/filter/" + contactFilterId, parameters);
            Page <Contact>  page     = new Page <Contact>(pageIndex, pageSize, response);

            page.Items = SerializationUtils <ContactCollection> .FromXmlString(response.Body);

            return(page);
        }
예제 #7
0
        /// <summary>
        /// Creates query parameters with the given variables
        /// </summary>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        /// <param name="mailingIdFilter"></param>
        /// <param name="contactIdFilter"></param>
        /// <param name="contactEmailFilter"></param>
        /// <param name="contactExternalIdFilter"></param>
        /// <param name="embedFieldBackups"></param>
        /// <returns></returns>
        internal static QueryParameters CreateQueryParameters(
            Timestamp fromDate, Timestamp toDate, List <long> mailingIdFilter,
            List <long> contactIdFilter, List <string> contactEmailFilter,
            List <string> contactExternalIdFilter, bool embedFieldBackups)
        {
            QueryParameters parameters = new QueryParameters();

            parameters.Add("from_date", fromDate);
            parameters.Add("to_date", toDate);
            parameters.AddList("mailing_id", mailingIdFilter);
            parameters.AddList("ids", contactIdFilter);
            parameters.AddList("emails", contactEmailFilter);
            parameters.AddList("eids", contactExternalIdFilter);
            parameters.Add("embed_field_backups", embedFieldBackups);

            return(parameters);
        }
예제 #8
0
        internal override QueryParameters GetQueryParameters()
        {
            QueryParameters parameters = CreateQueryParameters(
                this.From, this.To,
                this.MailingIdFilter, this.ContactIdFilter, this.ContactEmailFilter, this.ContactExternalIdFilter,
                this.EmbedFieldBackups);

            parameters.Add("format", this.FormatFilter);
            parameters.AddList("social_network", this.SocialNetworkFilter);
            parameters.AddList("device_type", this.DeviceTypeFilter);
            parameters.Add("embed_email_client_infos", this.EmbedEmailClientInfos);
            parameters.AddList("standard_field", this.StandardFields);
            parameters.AddList("custom_field", this.CustomFields);
            parameters.Add("exclude_anonymous_opens", this.ExcludeAnonymous);

            return(parameters);
        }
예제 #9
0
        /// <summary>
        /// Returns a page of blocked contacts. Blocked contacts are contacts with available permission but that are blocked for sendouts because of blacklist matches or similar reasons such as bounce policy.
        /// </summary>
        /// <param name="standardFields">the standard fields</param>
        /// <param name="customFields">the custom fields</param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns>a page of blocked contacts</returns>
        public Page <BlockedContact> GetBlockedContacts(List <StandardFieldName> standardFields, List <string> customFields, int pageIndex, int pageSize)
        {
            ValidatePaginationParameters(pageIndex, pageSize);

            QueryParameters parameters = new QueryParameters();

            parameters.Add("page_index", pageIndex);
            parameters.Add("page_size", pageSize);
            parameters.AddList("standard_field", standardFields);
            parameters.AddList("custom_field", customFields);

            ResponseWrapper       response = Get("contacts/blocked", parameters);
            Page <BlockedContact> page     = new Page <BlockedContact>(pageIndex, pageSize, response);

            page.Items = SerializationUtils <BlockedContactCollection> .FromXmlString(response.Body);

            return(page);
        }
예제 #10
0
        /**
         * Valid states are
         * 'draft','failed','queued','checks','blacklist','preparing','sending','paused','done','canceled','archiving','archived','released' <br />
         * <br />
         * @see MailingFields
         *
         * @param states
         * @param fields
         * @param pageIndex
         * @param pageSize
         * @return
         * @throws MaileonException
         */
        public Page <Mailing> GetMailingsByStates(List <MailingState> states, List <FieldType> fields, Order?order, FieldType?orderBy, int pageIndex, int pageSize)
        {
            ValidatePaginationParameters(pageIndex, pageSize);

            QueryParameters parameters = new QueryParameters();

            parameters.Add("page_index", pageIndex);
            parameters.Add("page_size", pageSize);
            parameters.AddList("fields", fields);
            parameters.AddList("states", states);
            parameters = AddOrdering(parameters, order, orderBy);

            ResponseWrapper response = Get("mailings/filter/states", parameters);

            Page <Mailing> page = new Page <Mailing>(pageIndex, pageSize, response);

            page.Items = SerializationUtils <MailingCollection> .FromXmlString(response.Body);

            return(page);
        }
예제 #11
0
        /// <summary>
        /// Returns a page of mailings in the account that match the given schedule time
        /// </summary>
        /// <param name="scheduleTime"></param>
        /// <param name="beforeSchedulingTime"></param>
        /// <param name="fields"></param>
        /// <param name="order"></param>
        /// <param name="orderBy"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public Page <Mailing> GetMailingsBySchedulingTime(Timestamp scheduleTime, bool beforeSchedulingTime, List <FieldType> fields, Order?order, FieldType?orderBy, int pageIndex, int pageSize)
        {
            ValidatePaginationParameters(pageIndex, pageSize);

            QueryParameters parameters = new QueryParameters();

            parameters.Add("page_index", pageIndex);
            parameters.Add("page_size", pageSize);
            parameters.Add("scheduleTime", scheduleTime.ToString());
            parameters.Add("beforeSchedulingTime", beforeSchedulingTime);
            parameters.AddList("fields", fields);
            parameters = AddOrdering(parameters, order, orderBy);

            ResponseWrapper response = Get("mailings/filter/scheduletime", parameters);

            Page <Mailing> page = new Page <Mailing>(pageIndex, pageSize, response);

            page.Items = SerializationUtils <MailingCollection> .FromXmlString(response.Body);

            return(page);
        }