/// <summary> /// Update an address book contact by sending whole modified contact object. /// </summary> public void UpdateWholeAddressBookContact() { var route4Me = new Route4MeManager(ActualApiKey); CreateTestContacts(); // Create contact clone in the memory var contactClone = R4MeUtils.ObjectDeepClone <AddressBookContact>(contact1); // Modify the parameters of the contactClone contactClone.address_group = "Updated"; contactClone.schedule_blacklist = new string[] { "2020-03-14", "2020-03-15" }; contactClone.address_custom_data = new Dictionary <string, string> { { "key1", "value1" }, { "key2", "value2" } }; contactClone.local_time_window_start = R4MeUtils.DDHHMM2Seconds("7:05", out _); contactClone.local_time_window_end = R4MeUtils.DDHHMM2Seconds("7:22", out _); contactClone.AddressCube = 5; contactClone.AddressPieces = 6; contactClone.AddressRevenue = 700; contactClone.AddressWeight = 80; contactClone.AddressPriority = 9; var sched1 = new Schedule("daily", false) { Enabled = true, Mode = "daily", Daily = new ScheduleDaily(1) }; contactClone.schedule = new List <Schedule>() { sched1 }; contact1 = route4Me.UpdateAddressBookContact(contactClone, contact1, out string errorString); PrintExampleContact(contact1, 0, errorString); RemoveTestContacts(); }
/// <summary> /// Update a contact by modifying the specified parameters. /// </summary> /// <param name="contact">Initial address book contact</param> public void UpdateAddressBookContact(AddressBookContact contact = null) { // Create the manager with the api key var route4Me = new Route4MeManager(ActualApiKey); CreateTestContacts(); if (contact != null) { contact1 = contact; } contact1.address_group = "Updated"; contact1.schedule_blacklist = new string[] { "2020-03-14", "2020-03-15" }; contact1.address_custom_data = new Dictionary <string, string> { { "key1", "value1" }, { "key2", "value2" } }; contact1.local_time_window_start = R4MeUtils.DDHHMM2Seconds("7:03", out _); contact1.local_time_window_end = R4MeUtils.DDHHMM2Seconds("7:37", out _); contact1.AddressCube = 5; contact1.AddressPieces = 6; contact1.AddressRevenue = 700; contact1.AddressWeight = 80; contact1.AddressPriority = 9; var updatableProperties = new List <string>() { "address_id", "address_group", "schedule_blacklist", "address_custom_data", "local_time_window_start", "local_time_window_end", "AddressCube", "AddressPieces", "AddressRevenue", "AddressWeight", "AddressPriority", "ConvertBooleansToInteger" }; // Run the query var updatedContact = route4Me.UpdateAddressBookContact( contact1, updatableProperties, out string errorString); PrintExampleContact(updatedContact, 0, errorString); RemoveTestContacts(); }