Skip to content

brunobrandes/fullcontact-api-csharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FullContact Api C#

A C# wrapper for the Full Contact API

Getting Started

Install FullContact.Api.Csharp nuget.
Run the following command in the Package Manager Console.

Solution (.sln) is based in The Onion Architecture

Example

var container = new Container();
 
#region Dependency Injection (DI) using Simple Injector

container.RegisterSingleton<IServiceProvider>(container);
container.Register<IFullContactAppServiceFactory, FullContactAppServiceFactory>();
container.Register<IHttpClientFactory, HttpClientFactory>();

#endregion

///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", 
	"xxxx", Serializer.Json);

/// Call full contact api by http get method 
var person = await fullContactAppService.GetAsync(Lookup.Email, "bart@fullcontact.com");

///Person contains all properties. Sample:
var fullName = person.ContactInfo.FullName;

Using lookup enum to get other's query to call the Person API

public enum Lookup
{
   Phone = 0,
   Email = 1,
   Twitter = 2,
   Domain = 3
}

Contributions

This release only implements the person api. For other, simply create the DataTranferObject and change GetApi method in FullContactAppService.

private Api GetApi(Type type)
{
    switch (type.Name)
    {
        case "Person":
            return Api.Person;
			
	/// Insert new cases

        default:
            throw new NotImplementedException($"Api type {type.Name} not implemented.");
    }
}

License

This software is open source, licensed under the MIT License (MIT). See LICENSE.me for details.

About

A C# wrapper for the FullContact API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages