コード例 #1
0
ファイル: Program.cs プロジェクト: stuthom/apiSamples-CS
        private static void PrintContact(ApiContact contact)
        {
            Console.WriteLine("Email = {0}", contact.Email);
            Console.WriteLine("Id = {0}", contact.Id);
            Console.WriteLine("OptInType = {0}", contact.OptInType);
            Console.WriteLine("EmailType = {0}", contact.EmailType);

            foreach (ApiContactData data in contact.DataFields)
            {
                Console.WriteLine("{0,-20} = {1}", data.Key, data.Value);
            }

            Console.WriteLine();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: stuthom/apiSamples-CS
        private static ApiContact CreateContact()
        {
            ApiContact contact = new ApiContact
            {
                Email = String.Format("email-{0}@example.com", Guid.NewGuid().ToString("N")),
                EmailType = ApiContactEmailTypes.Html,
                OptInType = ApiContactOptInTypes.Double,
                DataFields = new ApiContactData[]
                        {
                            new ApiContactData{Key = "Gender", Value = "M"},
                            new ApiContactData{Key = "FullName", Value = "John Smith"}
                        }
            };
            ApiContact result = _client.CreateContact(contact);

            return result;
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: stuthom/apiSamples-CS
        private static ApiContact CreateContact()
        {
            ApiContact contact = new ApiContact
                {
                    Email = String.Format("email-{0}@example.com", Guid.NewGuid().ToString("N")),
                    EmailType = ApiContactEmailTypes.Html,
                    OptInType = ApiContactOptInTypes.Double,
                    DataFields = new ApiContactData[]
                        {
                            new ApiContactData{Key = "Gender", Value = "M"},
                            new ApiContactData{Key = "FullName", Value = "John Smith"}
                        }
                };

            HttpResponseMessage response = _client.PostAsJsonAsync("/v2/contacts", contact).Result;
            ApiContact result = response.Content.ReadAsAsync<ApiContact>().Result;

            return result;
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: stuthom/apiSamples-CS
        private static ApiContact UpdateEmail(ApiContact contact)
        {
            contact.Email = String.Format("email-{0}@example.com", Guid.NewGuid().ToString("N"));
            ApiContact result = _client.UpdateContact(contact);

            return result;
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: stuthom/apiSamples-CS
        private static ApiContact UpdateEmail(ApiContact contact)
        {
            contact.Email = String.Format("email-{0}@example.com", Guid.NewGuid().ToString("N"));

            String url = String.Format("/v2/contacts/{0}", contact.Id);
            HttpResponseMessage response = _client.PutAsJsonAsync(url, contact).Result;
            ApiContact result = response.Content.ReadAsAsync<ApiContact>().Result;

            return result;
        }