Home ProjectsThe Computus Engine Searching the Digg API with AS3

Searching the Digg API with AS3

by John

I’ve been messing around with a lot of social API’s recently. Most of the common ones have their own AS3 wrappers although often these are authored by someone else. The diggflashdevkit for the Digg API for example is written by the guys over at Stamen who, as I’m sure you’re aware, have got some game.

It’s a nicely architected framework with cleanly separated model and service classes. Calls to Digg are proxied through the com.digg.services.API class. This contains methods for all the API calls except strangely for SearchStories. It could be I’ve missed something but I gave up looking and wrote a method for it. Just add this function to the API class and call it as you would any other method.

public static function searchStories( query: String ):StoriesResponse
	var request:URLRequest = new URLRequest(getURL('search/stories'));
	var args:URLVariables = new URLVariables()
	args['query'] = query
	if (mediaSize)
		if (!args['size']) args['size'] = mediaSize;
	request.data = args;
	return load(request, new StoriesResponse()) as StoriesResponse;

You may also like

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.