Code Monkey home page Code Monkey logo

fullcontact-api-csharp's Introduction

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, "[email protected]");

///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.

fullcontact-api-csharp's People

Contributors

brunobrandes avatar

Watchers

Bilgehan Zeki ÖZAYTAÇ avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.