static void Main(string[] args)
        {
            var apiKey = ExampleUtils.GetApiKey(args);
            var client = new Client(apiKey);
            var query = new PhoneQuery(PhoneNumber);
            Response<IPhone> response;
            try
            {
                response = client.FindPhones(query);
            }
            catch (FindException)
            {
                System.Console.Out.WriteLine("ReversePhone lookup for {0} failed!", PhoneNumber);
                throw;
            }

            if ((response != null) && (response.IsSuccess))
            {
                var results = response.Results;
                System.Console.Out.WriteLine("ReversePhone lookup for {0} was successful, returning {1} root phone objects.{2}{2}",
                    PhoneNumber, results.Count, System.Environment.NewLine);

                foreach (var phone in results)
                {
                    ExampleUtils.DumpPhone(phone, 2);
                    System.Console.Out.WriteLine();
                }
            }

            #if DEBUG
            System.Console.Out.WriteLine("Press the ENTER key to quit...");
            System.Console.In.ReadLine();
            #endif
        }
        static void Main(string[] args)
        {
            var apiKey = ExampleUtils.GetApiKey(args);
            var client = new Client(apiKey);
            var query = new LocationQuery(StreetLine1, StreetLine2, City, StateCode, PostalCode);
            Response<ILocation> response;
            try
            {
                response = client.FindLocations(query);
            }
            catch (FindException)
            {
                System.Console.Out.WriteLine("ReverseAddress lookup for {0}; {1}; {2}; {3}; {4} failed!", StreetLine1, StreetLine2, City, StateCode, PostalCode);
                throw;
            }

            if ((response != null) && (response.IsSuccess))
            {
                var results = response.Results;
                System.Console.Out.WriteLine("ReverseAddress lookup for {0}; {1}; {2}; {3}; {4} was successful, returning {5} root location objects.{6}{6}",
                    StreetLine1, StreetLine2, City, StateCode, PostalCode, results.Count, System.Environment.NewLine);

                foreach (var location in results)
                {
                    ExampleUtils.DumpLocation(location, 2);
                    System.Console.Out.WriteLine();
                }
            }

            #if DEBUG
            System.Console.Out.WriteLine("Press the ENTER key to quit...");
            System.Console.In.ReadLine();
            #endif
        }
 protected EntityProxy(EntityId entityId, Client client, ResponseDictionary responseDictionary)
 {
     _entityId = entityId;
     _client = client;
     _responseDictionary = responseDictionary;
     this.IsLoaded = false;
 }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Result);

            TextView name = FindViewById<TextView>(Resource.Id.NameLabel);
            TextView where = FindViewById<TextView>(Resource.Id.WhereLabel);

            try
            {

                string phoneNumber = Intent.GetStringExtra("PhoneNumber") ?? "";
                if (string.IsNullOrWhiteSpace(phoneNumber))
                {
                    base.Finish();
                }

                var apiKey = Resources.GetString(Resource.String.ApiKey);
                var client = new Client(apiKey);
                var phoneQuery = new PhoneQuery(phoneNumber);
                var response = client.FindPhones(phoneQuery);
                var phone = response.Results.FirstOrDefault();
                if (phone == null)
                {
                    name.Text = response.ResponseMessages.First().Text;
                }
                else
                {
                    name.Text = phone.PersonAssociations.FirstOrDefault().Person.BestName;
                    where.Text = phone.BestLocation.City + " " + phone.BestLocation.PostalCode;
                }

                MainActivity.transitionToast.Cancel();

            }
            catch (Exception exc)
            {
                Toast.MakeText(this, exc.Message, ToastLength.Long).Show();
                name.Text = exc.Message;
            }

            Button button = FindViewById<Button>(Resource.Id.ConfirmButton);

            button.Click += delegate
            {
                Toast.MakeText(this, "You are now signed in.", ToastLength.Long).Show();
            };
        }
        public Response<ILocation> SearchProApi(string streetAddress, string city, string state, string postalCode)
        {
            Response<ILocation> response;

            var apiKey = ConfigurationManager.AppSettings["api_key"];
            var client = new Client(apiKey);
            var query = new LocationQuery(streetAddress, null, city, state, postalCode);
            try
            {
                response = client.FindLocations(query);
            }
            catch (FindException)
            {
                throw new Exception(String.Format("ReverseAddress lookup for {0} {1} {2} {3} failed!", streetAddress, city, state, postalCode));
            }

            return response;
        }
        public Response<IPhone> SearchProApi(string phoneNumber)
        {
            Response<IPhone> response;

            var apiKey = ConfigurationManager.AppSettings["api_key"];
            var client = new Client(apiKey);
            var query = new PhoneQuery(phoneNumber);
            try
            {
                response = client.FindPhones(query);
            }
            catch (FindException)
            {
                throw new Exception(string.Format("ReversePhone lookup for {0} failed!", phoneNumber));
            }

            return response;
        }
        static void Main(string[] args)
        {
            var apiKey = ExampleUtils.GetApiKey(args);
            var client = new Client(apiKey);
            var query = new PersonQuery
                {
                    FirstName = FirstName,
                    MiddleName = MiddleName,
                    LastName = LastName,
                    City = City,
                    StateCode = StateCode,
                    PostalCode = PostalCode,
                };

            Response<IPerson> response = null;
            try
            {
                response = client.FindPeople(query);

            }
            catch (FindException)
            {
                System.Console.Out.WriteLine("FindPerson lookup for {0}; {1}; {2}; {3}; {4}; {5} failed!", FirstName, MiddleName, LastName, City, StateCode, PostalCode);
            }

            if ((response != null) && (response.IsSuccess))
            {
                var results = response.Results;

                Console.Out.WriteLine( "FindPerson lookup for {0}; {1}; {2}; {3}; {4}; {5} was successful, returning {6} root people objects{7}",
                               FirstName, MiddleName, LastName, City, StateCode, PostalCode, results.Count, System.Environment.NewLine);

                foreach ( var person in results ) {
                    ExampleUtils.DumpPerson( person, 2 );
                    System.Console.Out.WriteLine();
                }
            }

            #if DEBUG
            System.Console.Out.WriteLine("Press the ENTER key to quit...");
            System.Console.In.ReadLine();
            #endif
        }
        static void Main(string[] args)
        {
            var apiKey = ExampleUtils.GetApiKey(args);
            var client = new Client(apiKey);
            var query = new BusinessQuery
            {
                Name = Name,
                City = City,
                StateCode = StateCode,
                PostalCode = PostalCode,
            };

            Response<IBusiness> response = null;
            try
            {
                response = client.FindBusinesses(query);

            }
            catch (FindException)
            {
                Console.Out.WriteLine("FindBusiness lookup for {0}; {1}; {2}; {3} failed!", Name, City, StateCode, PostalCode);
            }

            if ((response != null) && (response.IsSuccess))
            {
                var results = response.Results;
                Console.Out.WriteLine(
                    "FindBusiness lookup for {0}; {1}; {2}; {3} was successful, returning {4} root business objects{5}{5}",
                    Name, City, StateCode, PostalCode, results.Count, System.Environment.NewLine);

                foreach (var business in results)
                {
                    ExampleUtils.DumpBusiness(business, 2);
                    Console.Out.WriteLine();
                }
            }

            #if DEBUG
            System.Console.Out.WriteLine("Press the ENTER key to quit...");
            System.Console.In.ReadLine();
            #endif
        }
		public BusinessProxy(EntityId entityId, Client client, ResponseDictionary responseDictionary)
			: base(entityId, client, responseDictionary)
		{

		}
 public ResponseDictionary(Client client)
 {
     _client = client;
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            // Perform any additional setup after loading the view, typically from a nib.

            ConfirmButton.TouchUpInside += (object sender, EventArgs e) => {

                var alert = this.CreateSimpleAlert("Success!", "Your gift recipient was successfully identified.");
                PresentViewController(alert, true, null);
            };

            GoBackButton.TouchUpInside += (object sender, EventArgs e) => {

                NavigationController.PopViewController(true);
            };

            if (!String.IsNullOrWhiteSpace(WhereText)) {
                var apiKey = "<YOUR API KEY HERE>";
                var client = new Client(apiKey);
                var commaParts = WhereText.Split(new [] {','});
                var name = commaParts[0];
                var cityState = commaParts[1];
                var whereParts = cityState.Split(new [] {' '});
                var city = whereParts[0];
                var state = whereParts[1];

                var query = new ProApiLibrary.Api.Queries.PersonQuery(name, city, state, null);
                var response = client.FindPeople(query);
                var results = response.Results;
                var resultCount = (results == null) ? 0 : results.Count;
                if (resultCount <= 0)
                {
                    var alert = CreateSimpleAlert ("No results", "No results were returned from the WhitePages Pro API");
                    PresentViewController (alert, true, null);
                }
                else
                {
                    var best = results [0];
                    var bestName = best.BestName;
                    this.NameLabel.Text = bestName;

                    var location = best.BestLocation;
                    if (location != null)
                    {
                        this.AddressLabel.Text = location.StandardAddressLine1;
                        this.CityLabel.Text = location.City + " " + location.PostalCode;
                    }

                    if (best.PhoneAssociations.Count > 0)
                    {
                        var bestPhone = best.PhoneAssociations [0];
                        if (bestPhone != null)
                        {
                            this.PhoneLabel.Text = bestPhone.Phone.PhoneNumber;
                        }
                    }
                }
            } else {
                this.NavigationController.PopViewController(true);
            }
        }
        public Response<IPerson> SearchProApi(LineItem model)
        {
            var apiKey = ConfigurationManager.AppSettings["api_key"];
            var client = new Client(apiKey);
            var query = new PersonQuery(model.FirstName, null, model.LastName, model.City, model.State, model.PostalCode);
            query.UseHistorical = true;
            query.StreetLine1 = model.StreetAddress1;
            query.StreetLine2 = model.StreetAddress2;
            Response<IPerson> response;
            try
            {
                response = client.FindPeople(query);
            }
            catch (FindException)
            {
                throw new Exception(String.Format("FindPerson lookup for {0} {1} failed!", model.FirstName, model.LastName));
            }

            return response;
        }
 static ResponseDictionary GetDictionary(Client client)
 {
     var dict = new ResponseDictionary(client);
     dict.Add(_person);
     dict.Add(_business);
     dict.Add(_phone);
     dict.Add(_location);
     return dict;
 }
 public static PhoneProxy GetPhoneProxy(Client client)
 {
     return new PhoneProxy(PhoneId, client, GetDictionary(client));
 }
 public static PersonProxy GetPersonProxy(Client client)
 {
     return new PersonProxy(PersonId, client, GetDictionary(client));
 }
 public static LocationProxy GetLocationProxy(Client client)
 {
     return new LocationProxy(LocationId, client, GetDictionary(client));
 }
 public PhoneProxy(EntityId entityId, Client client, ResponseDictionary responseDictionary)
     : base(entityId, client, responseDictionary)
 {
 }
 public static BusinessProxy GetBusinessProxy(Client client)
 {
     return new BusinessProxy(BusinessId, client, GetDictionary(client));
 }