Since December, I had been using the "Facebook SDK for .net" available from nuget and GitHub - however the package is now deprecated as it targets an older version of the Facebook Graph API. Since I run a website that actively uses Facebook data I was forced to either update the source code or build my own. I decided on the latter.
The Project
The goal of the project is to build a 100% covering .net implementation of the Facebook Graph and Video Graph API. Everything in the project, is build using proper software development patterns and build with testability and extensability in mind. This not only ensures that I can provide proper code coverage and automated testing - but also that each component of the infrastructure can be replaced at any given point; but by me but more importantly by others.
Quick C# sample
To quickly get started, the .net assembly contains a GraphAPIFactory which creates instances of standard classes and provides the developer with access to the Graph API, with only one single parameter; the access token.
{{c#}}
var fields = new[]
{
Fields.id,
Fields.name,
Fields.website,
Fields.description,
Fields.about,
};
var leafs = new Dictionary>
{
{ "posts", new [] { Fields.id, Fields.message, Fields.created_time } }
};
var graphApi = GraphAPIFactory.CreateGraphApi("valid facebook token");
var entity = graphApi.Get("pagename", fields, leafs);
Console.WriteLine("Page name: {0}", entity.Name);
Getting started
To get started, visit the project page with information on obtaining the nuget package. The idea is that the project will be open-sourced as soon as I have completed more parts of it. For now - It's out there and will be updated regulaly!
0 comments