Haxe bindings for GameJolt API.
You can install it through Haxelib
haxelib install hxgamejolt-apiOr through Git, if you want the latest updates
haxelib git hxgamejolt-api https://github.com/MAJigsaw77/hxgamejolt-api.gitWarning
Any function that returns GameJoltHttp takes some time before it finishes
e.g. authUser() or openSession(), so avoid writing any followup after it
without it being passed onto an onSucceed function or a
timer delayed function such as haxe.Timer() (or something similar)
import hxgamejolt.GameJolt;
GameJolt.init('game id', 'private key');
// Basic API
GameJolt.authUser('user name', 'user token', {
onSucceed: function():Void
{
// your code
},
onFail: function(message:String):Void
{
trace(message);
}
}).requestData();
GameJolt.fetchUser('user name', [], {
onSucceed: function():Void
{
// your code
},
onFail: function(message:String):Void
{
trace(message);
}
}).requestData();
// Batch Requests
final addTrophyResponse:GameJoltEmptyCallback = {
onSucceed: function():Void
{
// your code
},
onFail: function(message:String):Void
{
trace(message);
}
};
final addTrophyRequest0:GameJoltHttp = GameJolt.addTrophy('user name', 'user token', 0, addTrophyResponse);
final addTrophyRequest1:GameJoltHttp = GameJolt.addTrophy('user name', 'user token', 0, addTrophyResponse);
final addTrophyRequest2:GameJoltHttp = GameJolt.addTrophy('user name', 'user token', 0, addTrophyResponse);
GameJolt.batchRequest([addTrophyRequest0, addTrophyRequest1, addTrophyRequest2], {
onSucceed: function():Void
{
// your code
},
onFail: function(msg:String):Void
{
trace(message);
}
});hxgamejolt-api is made available under the MIT License. Check LICENSE for more information.