Hopefully I've got everything down. I was hoping some people could test this out for me.
http://www.experimentalflash.com/resources/Game_Files/AS3_API.zip
http://pastebin.com/raw.php?i=2qZnTN9a - Improved version with Game Sessions
I'm *pretty* sure everything works...Not completely, though. Please test for me =P
Format :
Every function will require the GameID and your PrivateKey for every call.
>Authorize User
-Function name: authUser
-Parameters:
-gameID:int
-privKey:String
-userName:String
-userToken:String
-callBack:Function
-Return Type: Boolean
-Use
-Authorizes a user by getting their User Name, and User Token. Requires a function with one
Boolean parameter
>Adding Trophies
-Function name: addTrophyAchieved
-Parameters:
-gameID:int
-privKey:String
-userName:String
-userToken:String
-trophyID:int
-Return Type: Void
-Use
-Adds a trophy to a specific User, using the trophy's ID.
>Getting Trophy Data
-Function name: getTrophyData
-Parameters:
-gameID:int
-privKey:String
-userName:String
-userToken:String
-type:* (String or int)
-callBack:Function
-Return Type: Array
-Use
-Gets trophy data from a user a user by getting their User Name, and User Token. Type can
be ("all", "true", "false", or int). "all" will return all trophies for the game. "true" will return
only the trophies that have been chieved by that user. "false" will return only trophies not
achieved by that user. An int will return data from a trophy with that ID. Requires a function
passed in with one Array parameter.
The Array being passed back will be in this format:
secondNum is the number of the trophy, starting at 0. Getting data from your third trophy
would require a secondNum of 2
>The ID of the trophy
Array["id"][secondNum]
>The Title of the trophy
Array["title"][secondNum]
>The Description of the trophy
Array["description"][secondNum]
>The Difficulty of the trophy
Array["difficulty"][secondNum]
>The URL of the trophy image
Array["image_url"][secondNum]
>Whether the trophy was achieved, and if so, the date it was
Array["achieved"][secondNum]
>Getting Highscore Data
-Function name: getHighscores
-Parameters:
-gameID:int
-privKey:String
-callBack:Function
-userName:String (optional)
-userToken:String (optional)
-ilmit:int (optional)
-Return Type: None right now
-Use
-Doesn't work completely as of yet. But it will return data gotten from the site. Will require a function with one Array parameter.
>Setting Highscore Data
-Function name: setHighscore
-Parameters:
-gameID:int
-privKey:String
-score:String
-sort:int
-userName:String
-userToken:String (optional)
-extraData:String (optional)
-Return Type: Void
-Use
-Score may not have spaces or special characters apart from those that would interfere with
URL caching. userToken is required if the userName is not a guest.
>Setting Game Data
-Function name: setKeyData
-Parameters:
-gameID:int
-privKey:String
-key:String
-gameData:String
-userName:String (optional)
-userToken:String (optional)
-Return Type: Void
-Use
-Stores game data for later retreival. userName and userToken are left blank if this data
should be stored for the game, rather than a user.
>Getting Game Data
-Function name: getKeyData
-Parameters:
-gameID:int
-privKey:String
-key:String
-callBack:Function
-userName:String (optional)
-userToken:String (optional)
-Return Type: String
-Use
-Retieves game data previously stored. userName and userToken are left blank if this data
should be retrieved for the game, rather than a user. Requires a function with a String
parameter.
>Removing Game Data
-Function name: removeKeyData
-Parameters:
-gameID:int
-privKey:String
-key:String
-userName:String (optional)
-userToken:String (optional)
-Return Type: String
-Use
-Removes game data previously stored. userName and userToken are left blank if this data
should be removed for the game, rather than a user.
>Getting Game Data Keys
-Function name: getAllKeys
-Parameters:
-gameID:int
-privKey:String
-callback:Function
-userName:String (optional)
-userToken:String (optional)
-Return Type: Array
-Use
-Retrives all game data KEYS previously stored. userName and userToken are left blank if this
data should be retrieved for all the game's keys. Requires a function with one Array
parameter.
> Open a Session
Function: sessionOpen
Parameters:
gameID : int
privKey : String
key : String,
callBack : Function
userName : String
userToken : String
No return type.
Use: Passes a boolean true or false to the callback function passed in.
> Ping a Session
Function: sessionPing
Parameters:
same as sessionOpen() - works the same as sessionOpen too.
> Close a Session
Function: sessionClose
Parameters:
same as sessionOpen() - works the same as sessionOpen too.
Last edited on August 31, 2010 - 04:06 PM by Ashley


