public static void Run()
        {
            const string Username = "";
            const string Password = "";
            const bool Sandbox = true;

            NextCallerPlatformClient client = new NextCallerPlatformClient(Username, Password, Sandbox);

            const string AccountId = "TestUser1";

            try
            {
                PlatformAccountToPost user = new PlatformAccountToPost
                {
                    Id = "NewTestUser1",
                    CompanyName = "new_platform_company1_name",
                    Email = "*****@*****.**",
                    FirstName = "new_platform_user1_fname",
                    LastName = "new_platform_user1_lname"
                };

                client.UpdatePlatformAccount(user, AccountId);

            }
            catch (FormatException formatException)
            {

                HttpWebRequest request = formatException.Request;
                HttpWebResponse response = formatException.Response;

                HttpStatusCode code = response.StatusCode;
                Console.WriteLine("Status code: {0}", code);

                string reasonPhrase = response.StatusDescription;
                Console.WriteLine("Reason Phrase: {0}", reasonPhrase);

                string responseContent = formatException.Content;
                Console.WriteLine("Content : {0}", responseContent);

            }
            catch (BadRequestException badRequestException)
            {

                HttpWebRequest request = badRequestException.Request;
                HttpWebResponse response = badRequestException.Response;

                Error parsedError = badRequestException.Error;

                string errorCode = parsedError.Code;
                string message = parsedError.Message;
                string type = parsedError.Type;

                Dictionary<string, string[]> description = parsedError.Description;

                Console.WriteLine(parsedError.ToString());

            }
        }
コード例 #2
0
        public static void Run()
        {
            const string Username = "";
            const string Password = "";
            const bool Sandbox = true;

            NextCallerPlatformClient client = new NextCallerPlatformClient(Username, Password, Sandbox);

            const string Phone = "1234567890";
            const string AccountId = "TestUser1";

            try
            {
                FraudLevel fraudLevel = client.GetFraudLevel(Phone, AccountId);

                //fraudLevel.FraudRisk = "low";
                //fraudLevel.Spoofed = "no";

            }
            catch (FormatException formatException)
            {

                HttpWebRequest request = formatException.Request;
                HttpWebResponse response = formatException.Response;

                HttpStatusCode code = response.StatusCode;
                Console.WriteLine("Status code: {0}", code);

                string reasonPhrase = response.StatusDescription;
                Console.WriteLine("Reason Phrase: {0}", reasonPhrase);

                string responseContent = formatException.Content;
                Console.WriteLine("Content : {0}", responseContent);

            }
            catch (BadRequestException badRequestException)
            {

                HttpWebRequest request = badRequestException.Request;
                HttpWebResponse response = badRequestException.Response;

                Error parsedError = badRequestException.Error;

                string errorCode = parsedError.Code;
                string message = parsedError.Message;
                string type = parsedError.Type;

                Dictionary<string, string[]> description = parsedError.Description;

                Console.WriteLine(parsedError.ToString());

            }
        }
        public static void Run()
        {
            const string Username = "";
            const string Password = "";
            const bool Sandbox = true;

            NextCallerPlatformClient client = new NextCallerPlatformClient(Username, Password, Sandbox);

            const string ProfileId = "profileId";
            const string AccountId = "TestUser1";

            try
            {
                ProfileToPost profile = new ProfileToPost
                {
                    Email = "*****@*****.**",
                    FirstName = "Clark",
                    LastName = "Kent",
                    PrimaryAddress = new Address
                    {
                        Line1 = "223 Kryptonite Ave.",
                        Line2 = "",
                        City = "Smallville",
                        State = "KS",
                        ZipCode = "66002"
                    },
                    SecondaryAddress = new Address
                    {
                        Line1 = "223 Kryptonite Ave.",
                        Line2 = "",
                        City = "Smallville",
                        State = "KS",
                        ZipCode = "66002"
                    },
                };

                client.UpdateByProfileId(ProfileId, profile, AccountId);

            }
            catch (FormatException formatException)
            {

                HttpWebRequest request = formatException.Request;
                HttpWebResponse response = formatException.Response;

                HttpStatusCode code = response.StatusCode;
                Console.WriteLine("Status code: {0}", code);

                string reasonPhrase = response.StatusDescription;
                Console.WriteLine("Reason Phrase: {0}", reasonPhrase);

                string responseContent = formatException.Content;
                Console.WriteLine("Content : {0}", responseContent);

            }
            catch (BadRequestException badRequestException)
            {

                HttpWebRequest request = badRequestException.Request;
                HttpWebResponse response = badRequestException.Response;

                Error parsedError = badRequestException.Error;

                string errorCode = parsedError.Code;
                string message = parsedError.Message;
                string type = parsedError.Type;

                Dictionary<string, string[]> description = parsedError.Description;

                Console.WriteLine(parsedError.ToString());

            }
        }
        public static void Run()
        {
            const string Username = "";
            const string Password = "";
            const int page = 1;
            const bool Sandbox = true;

            NextCallerPlatformClient client = new NextCallerPlatformClient(Username, Password, Sandbox);

            try
            {
                PlatformStatistics stats = client.GetPlatformStatistics(page);

                //stats.PlatformUsers = new []
                //{
                //	new PlatformUser
                //	{
                //		CreatedTime = "2014­04­16T13:42:00",
                //		NumberOfOperations = 24,
                //		ResourceUri = "/api/v2/platform_users/pl2_un1/",
                //		Username = "******",
                //		TotalCalls = new Dictionary<string, int>
                //		{
                //			{ "201403", 7 },
                //			{ "201404", 7 },
                //			{ "201405", 7 }
                //		},
                //		SuccessfulCalls = new Dictionary<string, int>
                //		{
                //			{ "201403", 7 },
                //			{ "201404", 7 },
                //			{ "201405", 7 }
                //		},
                //		BillableCalls = new Dictionary<string, int>
                //		{
                //			{ "201403", 7 },
                //			{ "201404", 7 },
                //			{ "201405", 7 }
                //		}
                //	}
                //};

                //stats.SuccessfulPlatformCalls = new Dictionary<string, int>
                //{
                //	{ "201403", 7 },
                //	{ "201404", 7 },
                //	{ "201405", 7 }
                //};

                //stats.TotalPlatformCalls = new Dictionary<string, int>
                //{
                //	{ "201403", 7 },
                //	{ "201404", 7 },
                //	{ "201405", 7 }
                //};

                //stats.BillablePlatformCalls = new Dictionary<string, int>
                //{
                //	{ "201403", 7 },
                //	{ "201404", 7 },
                //	{ "201405", 7 }
                //};

            }
            catch (FormatException formatException)
            {

                HttpWebRequest request = formatException.Request;
                HttpWebResponse response = formatException.Response;

                HttpStatusCode code = response.StatusCode;
                Console.WriteLine("Status code: {0}", code);

                string reasonPhrase = response.StatusDescription;
                Console.WriteLine("Reason Phrase: {0}", reasonPhrase);

                string responseContent = formatException.Content;
                Console.WriteLine("Content : {0}", responseContent);

            }
            catch (BadRequestException badRequestException)
            {

                HttpWebRequest request = badRequestException.Request;
                HttpWebResponse response = badRequestException.Response;

                Error parsedError = badRequestException.Error;

                string errorCode = parsedError.Code;
                string message = parsedError.Message;
                string type = parsedError.Type;

                Dictionary<string, string[]> description = parsedError.Description;

                Console.WriteLine(parsedError.ToString());

            }
        }
コード例 #5
0
        public static void Run()
        {
            const string Username = "";
            const string Password = "";
            const bool Sandbox = true;

            NextCallerPlatformClient client = new NextCallerPlatformClient(Username, Password, Sandbox);

            const string Email = "*****@*****.**";
            const string AccountId = "TestUser1";

            try
            {
                IList<Profile> profiles = client.GetByEmail(Email, AccountId);

                Profile profile = profiles.First();

                //profile.Id = "97d949a413f4ea8b85e9586e1f2d9a";
                //profile.FirstName = "Jerry";
                //profile.LastName = "Seinfeld";
                //profile.Name = "Jerry K Seingeld";
                //profile.Language = "English";

                //Phone phone = profile.Phones.First();
                //phone.Number = "2125558383";
                //phone.ResourceUri = "/v2/records/2125558383/";

                //profile.Carrier = "Verizon Wireless";
                //profile.LineType = "LAN";

                //Address address = profile.Addresses.First();
                //address.City = "New York";
                //address.State = "NY";
                //address.Country = "USA";
                //address.Line1 = "129 West 81st Street";
                //address.Line2 = "Apt 5a";
                //address.ZipCode = "10024";
                //address.ExtendedZip = "";

                //profile.Email = "*****@*****.**";
                //profile.LinkedEmails = new[]
                //{
                //	"*****@*****.**", "*****@*****.**", "*****@*****.**"
                //};
                //profile.SocialLinks = new[]
                //{
                //	new Dictionary<string, object>()
                //	{
                //		{ "type", "twitter" },
                //		{ "url", "http://www.twitter.com/example" },
                //		{ "followers", 323 }
                //	}
                //};
                //profile.Relatives = new []
                //{
                //	new Relative
                //	{
                //		Id = "a4bf8cff1bfd61d8611d396997bb29",
                //		Name = "Clark Kent",
                //		ResourceUri = "/v2/users/90c6a00c6391421d3a764716927cd8/"
                //	}
                //};
                //profile.DateOfBirth = "05/15/1970";
                //profile.Gender = "Male";
                //profile.Age = "45-54";
                //profile.HouseholdIncome = "50k-75k";
                //profile.HomeOwnerStatus = "Rent";
                //profile.LengthOfResidence = "12 Years";
                //profile.Occupation = "Entertainer";
                //profile.Education = "Completed College";
                //profile.ResourceUri = "/v2/users/97d949a413f4ea8b85e9586e1f2d9a/";

            }
            catch (FormatException formatException)
            {

                HttpWebRequest request = formatException.Request;
                HttpWebResponse response = formatException.Response;

                HttpStatusCode code = response.StatusCode;
                Console.WriteLine("Status code: {0}", code);

                string reasonPhrase = response.StatusDescription;
                Console.WriteLine("Reason Phrase: {0}", reasonPhrase);

                string responseContent = formatException.Content;
                Console.WriteLine("Content : {0}", responseContent);

            }
            catch (BadRequestException badRequestException)
            {

                HttpWebRequest request = badRequestException.Request;
                HttpWebResponse response = badRequestException.Response;

                Error parsedError = badRequestException.Error;

                string errorCode = parsedError.Code;
                string message = parsedError.Message;
                string type = parsedError.Type;

                Dictionary<string, string[]> description = parsedError.Description;
                //

                Console.WriteLine(parsedError.ToString());

            }
        }
コード例 #6
0
        public static void Run()
        {
            const string Username = "";
            const string Password = "";
            const bool Sandbox = true;

            NextCallerPlatformClient client = new NextCallerPlatformClient(Username, Password, Sandbox);

            const string AccountId = "TestUser1";

            try
            {
                AnalyzeCallData callData = new AnalyzeCallData
                {
                    Ani = "12125551212",
                    Dnis = "18005551212",
                    Headers = new Dictionary<string, object>
                    {
                        { "from", "\"John Smith\" <sip:[email protected]>" },
                        { "via", new List<string> { "SIP/2.0//UDP 1.1.1.1:5060;branch=z9hG4bK3fe1.9a945462b4c1880c5f6fdc0214a205ca.1"} }
                    },
                    Meta = new Dictionary<string, string>
                    {
                        { "caller_id", "12125551212" },
                        { "charge_number", "12125551212" },
                        { "ani2", "0" },
                        { "private", "true" }
                    }
                };

                FraudLevel fraudLevel = client.AnalyzeCall(callData, AccountId);
            }
            catch (FormatException formatException)
            {

                HttpWebRequest request = formatException.Request;
                HttpWebResponse response = formatException.Response;

                HttpStatusCode code = response.StatusCode;
                Console.WriteLine("Status code: {0}", code);

                string reasonPhrase = response.StatusDescription;
                Console.WriteLine("Reason Phrase: {0}", reasonPhrase);

                string responseContent = formatException.Content;
                Console.WriteLine("Content : {0}", responseContent);

            }
            catch (BadRequestException badRequestException)
            {

                HttpWebRequest request = badRequestException.Request;
                HttpWebResponse response = badRequestException.Response;

                Error parsedError = badRequestException.Error;

                string errorCode = parsedError.Code;
                string message = parsedError.Message;
                string type = parsedError.Type;

                Dictionary<string, string[]> description = parsedError.Description;

                Console.WriteLine(parsedError.ToString());

            }
        }