Facebook Toolkit 2 coming soon to a Code Share near you!

We are putting the finishing touches to the new and vastly improved Facebook Toolkit 2. Here is a list of some of the new features and some more code to get you ready

We are busily putting the final touches to a revamped Facebook toolkit which will be available shortly. A lot has changed since the initial toolkit was released and with this new version we wanted to address usuability while at the same time updating some of the underlying APIs, plus adding additional functionality. 

 Some of the community members have already started playing with the new toolkit to give some feedback, but we are always looking for more. If you are up for playing with new features like those listed below, please let me know. We are also working on some big changes to the way we approach toolkits as well. If you are coming to Dreamforce, you definitely want to check in at the Developer Lounge to get the scoop! I would also love to see some of the Facebook Apps developers have put together with the new toolkit too. Perhaps I can demo one on stage in one of my sessions?

New Features of the Facebook Toolkit 2

  • Social Components
  • OAuth2 support
  • JSON support
  • Extended Permissions
  • Additional Connections for the User Object

And if you like code, and want to get a sense of what the toolkit will look like check out the following example of a Graph API Wrapper class:

public class FacebookMovies extends FacebookObject {

    

    JSONObject data = new JSONObject();

    public List<MovieInfo> allMovies = new List<MovieInfo>();

    public FacebookMovies(String clientid, String username, String teststub) {

if(teststub != null)

super.setTestStubResponse(teststub);

super.isAuthenticated(clientid);

data = super.doAPICall(username+'/movies'); 

System.debug('TEMP:'+data);

JSONObject.value p = data.getValue('data');

if(p != null){

JSONObject.value[] vals = p.values; 

for(Integer i = 0; i < vals.size(); i++)

{

allMovies.add(new MovieInfo(vals[i].obj));

}

}

    }

    public class MovieInfo {

JSONObject data;

public String id { get { return data.getValue('id').str; } set; }

public String name { get { return data.getValue('name').str; } set; }

public String category { get { return data.getValue('category').str; } set; }

public String created_time {get { return data.getValue('created_time').str;}set;}

public MovieInfo(JSONObject obj) {

data = obj;

}

    }

    

    public static testmethod void test_Movies()

    {

String stub = '{"data":['+

'{"name": "The Lord of the Rings Trilogy (Official Page)","category": "Film","id": "212216417436", "created_time": "2010-08-10T19:51:12+0000"},'+

            '{"name": "The Clockwork Orange","category": "Unknown","id": "110521682295613","created_time": "2010-08-10T19:51:12+0000"}]}';

         

FacebookMovies fbl = new FacebookMovies('136520473033312', '1307240381', stub);

System.assertEquals(fbl.allMovies.size(), 2);    

System.assertEquals(fbl.allMovies.get(1).id, '110521682295613');

System.assertEquals(fbl.allMovies.get(1).name, 'The Clockwork Orange');

System.assertEquals(fbl.allMovies.get(1).category, 'Unknown');

System.assertEquals(fbl.allMovies.get(1).created_time,'2010-08-10T19:51:12+0000');

    }

}

Leave your comments...

Facebook Toolkit 2 coming soon to a Code Share near you!