Esempio n. 1
0
        private static void ErrorTest()
        {
            var client = new Client("*****@*****.**", "Dynam1cs!");
             ApiAddressBook ab = new ApiAddressBook();
            ab.Name = "API_Addressbook5";
            var result = client.PostAddressBooks(ab);
            if (result.Success)
            {
                Console.WriteLine(String.Format("Created AddressBook {0}", result.Data.Id.ToString()));

                ApiContact c = new ApiContact();
                c.Email = "*****@*****.**";
                ApiContact c1 = new ApiContact();
                c1.Email = "*****@*****.**";
                ApiContact c2 = new ApiContact();
                c2.Email = "*****@*****.**";

                List<ApiContact> contacts = new List<ApiContact>();
                contacts.Add(c);
                contacts.Add(c1);
                contacts.Add(c2);

                string filestring = "Email,FirstName,FullName,Gender,LastName,Postcode" + Environment.NewLine;
                filestring = filestring + "[email protected],John,John Smith,M,Smith,CR0 0XT" + Environment.NewLine;
                filestring = filestring + "[email protected],John,John Smith,M,Smith,CR0 0XT" + Environment.NewLine;
                filestring = filestring + "[email protected],John,John Smith,M,Smith,CR0 0XT" + Environment.NewLine;

                byte[] b = System.Text.Encoding.UTF8.GetBytes(filestring);
                ApiFileMedia afm = new ApiFileMedia();
                afm.Data = b;
                afm.FileName = "contacts.csv";

                var importresult = client.PostAddressBookContactsImportAsync(result.Data.Id, afm);
            }
                else
            {
                Console.WriteLine(result.Message);
            }
            Console.Read();
            //var result = client.DeleteAddressBook(838);
            //result = client.DeleteAddressBookContact(838, 838);
            //result = client.DeleteAddressBookContacts(838);
            //result = client.DeleteCampaignAttachment(838, 838);
            //result = client.GetAddressBookById(838);
            //result = client.GetAddressBookCampaigns(838);
            //result = client.GetAddressBookContacts(838);
            //result = client.GetCampaignActivities(838);
            //result = client.GetContactsImportByImportId(Guid.Empty);
            //result = client.GetContactsImportReport(Guid.Empty);
            //result = client.GetContactsImportReportFaults(Guid.Empty);
            //result = client.GetContactsTransactionalDataImportByImportId(Guid.Empty);
            //result = client.GetContactTransactionalDataByCollectionName("test", 300);
        }
Esempio n. 2
0
		/// <summary>
		/// Updates a contact.
		/// </summary>
		public ServiceResult<ApiContact> UpdateContact(int id, ApiContact apiContact)
		{
			return UpdateContactAsync(id, apiContact).Result;
		}
Esempio n. 3
0
		/// <summary>
		/// Updates a contact.
		/// </summary>
		public async Task<ServiceResult<ApiContact>> UpdateContactAsync(int id, ApiContact apiContact)
		{
			var request = new Request(baseAddress, "contacts/{id}", 
			new Dictionary<string, object>
			{
				{ "id", id },
			});
			return await PutAsync<ApiContact>(request, apiContact);
		}
Esempio n. 4
0
		/// <summary>
		/// Unsubscribes contact from account.
		/// </summary>
		public ServiceResult<ApiContactSuppression> PostContactsUnsubscribe(ApiContact apiContact)
		{
			return PostContactsUnsubscribeAsync(apiContact).Result;
		}
Esempio n. 5
0
		/// <summary>
		/// Unsubscribes contact from account.
		/// </summary>
		public async Task<ServiceResult<ApiContactSuppression>> PostContactsUnsubscribeAsync(ApiContact apiContact)
		{
			var request = new Request(baseAddress, "contacts/unsubscribe");
			return await PostAsync<ApiContactSuppression, ApiContact>(request, apiContact);
		}
Esempio n. 6
0
		/// <summary>
		/// Creates a contact.
		/// </summary>
		public async Task<ServiceResult<ApiContact>> PostContactsAsync(ApiContact apiContact)
		{
			var request = new Request(baseAddress, "contacts");
			return await PostAsync<ApiContact>(request, apiContact);
		}
Esempio n. 7
0
		/// <summary>
		/// Creates a contact.
		/// </summary>
		public ServiceResult<ApiContact> PostContacts(ApiContact apiContact)
		{
			return PostContactsAsync(apiContact).Result;
		}
Esempio n. 8
0
		/// <summary>
		/// Unsubscribes contact from a given address book.
		/// </summary>
		public async Task<ServiceResult<ApiContactSuppression>> PostAddressBookContactsUnsubscribeAsync(int addressBookId, ApiContact apiContact)
		{
			var request = new Request(baseAddress, "address-books/{addressBookId}/contacts/unsubscribe", 
			new Dictionary<string, object>
			{
				{ "addressBookId", addressBookId },
			});
			return await PostAsync<ApiContactSuppression, ApiContact>(request, apiContact);
		}
Esempio n. 9
0
		/// <summary>
		/// Unsubscribes contact from a given address book.
		/// </summary>
		public ServiceResult<ApiContactSuppression> PostAddressBookContactsUnsubscribe(int addressBookId, ApiContact apiContact)
		{
			return PostAddressBookContactsUnsubscribeAsync(addressBookId, apiContact).Result;
		}
Esempio n. 10
0
		/// <summary>
		/// Adds a contact to a given address book.
		/// </summary>
		public ServiceResult<ApiContact> PostAddressBookContacts(int addressBookId, ApiContact apiContact)
		{
			return PostAddressBookContactsAsync(addressBookId, apiContact).Result;
		}