Exemplo n.º 1
0
        private static void Output(FullContactPerson fullContactPerson)
        {
            Console.WriteLine("\nLikelihood: {0}", fullContactPerson.Likelihood);
            //if (result.ContactInfo != null)
            {
                Console.WriteLine("\nContact info:");
                Console.WriteLine("\t" + fullContactPerson.ContactInfo.GivenName);
                Console.WriteLine("\t" + fullContactPerson.ContactInfo.FamilyName);
                Console.WriteLine("\t" + fullContactPerson.ContactInfo.FullName);

                if (fullContactPerson.ContactInfo.Websites.Count != 0)
                {
                    Console.WriteLine("\n\tWebsites:");
                    foreach (Websites site in fullContactPerson.ContactInfo.Websites)
                    {
                        Console.WriteLine("\t" + site.Url);
                    }
                }
            }
            if (fullContactPerson.SocialProfiles.Count != 0)
            {
                Console.WriteLine("\nSocial Profiles:");

                foreach (SocialProfiles socialProfile in fullContactPerson.SocialProfiles)
                {
                    Console.WriteLine($"\t{socialProfile.Type}, {socialProfile.TypeId}, {socialProfile.TypeName}");
                    Console.WriteLine("\t" + socialProfile.Url);
                    Console.WriteLine();
                }
            }
        }
Exemplo n.º 2
0
        static async Task MainAsync(string[] args)
        {
            int    i      = 0;
            string choice = "y";

            while (choice[0] == 'y')
            {
                Console.Write("Enter E-mail: ");



                string         email  = Console.ReadLine();
                FullContactApi search = new FullContactApi();

                Task <FullContactPerson> task = search.LookupPersonByEmailAsync(email);
                Console.Write("Loading email");
                CursorTopLoad = Console.CursorTop + 1;

                Timer timer = new Timer(50);
                timer.Elapsed += async(sender, e) => await WriteLoadingSpinner();

                timer.Start();
                timerOn = true;


                FullContactPerson p = await task;
                timer.Stop();
                timerOn = false;
                Console.WriteLine("\nMail Loaded!");
                search.printLatestPersonInfo();

                Console.WriteLine("Want to check another mail (y/n)");
                choice = Console.ReadLine();
                //          Console.Clear();
            }
        }
Exemplo n.º 3
0
        public async Task <FullContactPerson> LookupPersonByEmailAsync(string email)
        {
            FullContactPerson p = new FullContactPerson();

            try
            {
                ///Get container full contact app service factory
                var fullContactAppServiceFactory = container.GetInstance <IFullContactAppServiceFactory>();

                ///Create full contact app service
                var fullContactAppService = fullContactAppServiceFactory.Create <Person>("https://api.fullcontact.com/v2", "dae0fac8e1ede966", Serializer.Json);

                /// Call full contact api by get
                person = await fullContactAppService.GetAsync(Lookup.Email, email);

                //        person.Status
                //person.ContactInfo.WebSites

                p.familyName  = person.ContactInfo.FamilyName;
                p.givenName   = person.ContactInfo.GivenName;
                p.fullName    = person.ContactInfo.FullName;
                p.middleNames = person.ContactInfo.MiddleNames;

                p.likelihood = person.Likelihood;

                p.age = person.Demographics.locationDeduced.Age;
                if (person.Demographics.locationDeduced.City != null)
                {
                    p.city = person.Demographics.locationDeduced.City.Name;
                }

                p.continent = person.Demographics.locationDeduced.Continent.Name;
                if (person.Demographics.locationDeduced.Country != null)
                {
                    p.country = person.Demographics.locationDeduced.Country.Name;
                }

                if (person.Demographics.locationDeduced.county != null)
                {
                    p.county = person.Demographics.locationDeduced.county.Name;
                }

                p.deducedLocation = person.Demographics.locationDeduced.DeducedLocation;

                p.gender             = person.Demographics.locationDeduced.Gender.ToString();
                p.locationLikelihood = person.Demographics.locationDeduced.Likelihood;

                if (person.Demographics.locationDeduced.State != null)
                {
                    p.State = person.Demographics.locationDeduced.State.Name;
                }

                p.NormalizedLocation = person.Demographics.locationDeduced.NormalizedLocation;


                latestResult = fullContactAppService.ResponseSerializer.Serialize(person).Result;

                return(p);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("Unexpected error: " + ex.Message);
            }

            //   container.RegisterSingleton<IServiceProvider>(container);
            //    FullContactPerson person = new FullContactPerson();
            //    await Task.Delay(5000);

            return(null);
        }