/// <summary> /// Add or updates a list of contacts in Bronto /// </summary> /// <param name="contact">The contacts to add or update</param> /// <returns>The result of the add or update operation <seealso cref="BrontoResult"/></returns> public BrontoResult AddOrUpdateIncremental(IEnumerable <contactObject> contacts) { using (BrontoSoapPortTypeClient client = BrontoSoapClient.Create(Timeout)) { foreach (contactObject contact in contacts) { var address = new stringValue { value = contact.email }; var emailAddressArray = new[] { address }; var filter = new contactFilter { email = emailAddressArray }; var options = new readContacts() { includeLists = true, includeListsSpecified = true }; var readResults = Read(filter, options); var existingContact = readResults.FirstOrDefault(); if (existingContact != null) { contact.listIds = contact.listIds.Concat(existingContact.listIds).ToArray(); } } writeResult response = client.addOrUpdateContacts(session.SessionHeader, contacts.ToArray()); return(BrontoResult.Create(response)); } }
public BrontoResult Add(IEnumerable <deliveryObject> deliveries) { using (BrontoSoapPortTypeClient client = BrontoSoapClient.Create(Timeout)) { writeResult response = client.addDeliveries(session.SessionHeader, deliveries.ToArray()); return(BrontoResult.Create(response)); } }
public BrontoResult Delete(IEnumerable <mailListObject> mailLists) { using (BrontoSoapPortTypeClient client = BrontoSoapClient.Create(Timeout)) { writeResult response = client.deleteLists(session.SessionHeader, mailLists.ToArray()); return(BrontoResult.Create(response)); } }
/// <summary> /// Updates a list of contacts in Bronto /// </summary> /// <param name="contacts">the list of contacts to update</param> /// <returns>The result of the add operation <seealso cref="BrontoResult"/></returns> public BrontoResult Update(IEnumerable <contactObject> contacts) { using (BrontoSoapPortTypeClient client = BrontoSoapClient.Create(Timeout)) { writeResult response = client.updateContacts(session.SessionHeader, contacts.ToArray()); return(BrontoResult.Create(response)); } }
public async Task <BrontoResult> DeleteAsync(IEnumerable <mailListObject> mailLists) { using (BrontoSoapPortTypeClient client = BrontoSoapClient.Create(Timeout)) { deleteListsResponse response = await client.deleteListsAsync(session.SessionHeader, mailLists.ToArray()); return(BrontoResult.Create(response.@return)); } }
/// <summary> /// Add or updates a list of contact in Bronto /// </summary> /// <param name="contact">The contacts to add or update</param> /// <returns>The result of the add or update operation <seealso cref="BrontoResult"/></returns> public async Task <BrontoResult> AddOrUpdateAsync(IEnumerable <contactObject> contacts) { using (BrontoSoapPortTypeClient client = BrontoSoapClient.Create(Timeout)) { addOrUpdateContactsResponse response = await client.addOrUpdateContactsAsync(session.SessionHeader, contacts.ToArray()); return(BrontoResult.Create(response.@return)); } }
/// <summary> /// Adds a list of contacts to a mailing list /// </summary> /// <param name="list">the list to add</param> /// <param name="contacts">the list of contacts to add</param> /// <returns>The result of the addToList operation <seealso cref="BrontoResult"/></returns> public BrontoResult AddToList(mailListObject list, contactObject[] contacts) { using (BrontoSoapPortTypeClient client = BrontoSoapClient.Create(Timeout)) { addToList addToList = new addToList() { list = list, contacts = contacts }; writeResult response = client.addToList(session.SessionHeader, addToList); return(BrontoResult.Create(response)); } }
/// <summary> /// Creates a BrontoResult class from a writeresult /// </summary> /// <param name="result">the writeResult from a web service call</param> /// <returns>A BrontoResult class</returns> internal static BrontoResult Create(writeResult result) { BrontoResult br = new BrontoResult(); if (result.errors != null && result.errors.Length > 0) { br.ErrorIndicies = result.errors.Cast <int>(); br.HasErrors = true; } br.Items = new List <BrontoResultItem>(); foreach (resultItem itm in result.results) { br.Items.Add(new BrontoResultItem() { Id = itm.id, IsNew = itm.isNew, IsError = itm.isError, ErrorCode = itm.errorCode, ErrorString = itm.errorString }); } return(br); }