Summary

All of the actions available through the API are available through our main classes: User, Session, DataStore, Score, and HighScoreTable. Each class provides static classes to retrieve their data in either asynchronous (Begin/End pairs as well as a simple callback version) and a synchronous version.
  • NOTE : The core library (Tier 1) does not store most information; every call requires you to pass in your GameID (from Game Jolt's website) and your private key (also from Game Jolt's website.) Tier 1 is basically a proxy; Tier 2 will provide these mechanisms.

Available Services

Below is a list of the services available in the GameJoltServices library along with a description of what the service provides.

News Service
The news service provides a very simple mechanism for storing game news. Simple items like a new patch is available, or DLC, Kickstarter URL, etc. All of the news items are stored as a base-64 string in a single data store item, so it is able to handle a large amount of items, but it is more intended for a few items.

The service can be accessed via GameJoltServices.NewsService and requires an instance of GameJoltServices.ServicesManager:
var newsService = new GameJoltServices.NewsService(myServicesManager);
var newsItems = newsService.GetNews(); // Synchronous
newsService.GetNews((storedNewsItems) =>
{
	this.NewsItems = storedNewsItems;
	itemsAreLoading = false;
}); // asynchronous call w/ callback

Game Save Service
The game save service allows simple access to game saves that are synced between local and cloud storage. When a game save is created it can be uploaded to the cloud and when any cloud save is requested it is cached locally (if the date stamps are valid, the local copy will be used in place of the cloud copy.)

The service can be accessed via GameJoltServices.GameSaveService:
// GameJoltServices.Helper.GetDefaultCacheFolder() returns a path to the directory of the default
// cache folder depending on the system (My Documents\My Games\[GameName]\ on PC and
// [Public Downloads folder]/[GameName] on Android
var gameSaveService = new GameJoltServices.GameSaveService(GameJoltServices.Helper.GetDefaultCacheFolder("GJS Example"), myServicesManager);

// Returns instances with their Location, Name, and DateSaved values filled in.
var saves = gameSaveService.GetSaves(loggedInUser);

if(saves.Count > 0)
{
    if(gameSaveService.DownloadSave(saves[0]))
    {
        // We have successfully downloaded the game and cached it. We can now access the data
        using(var stream = saves[0].OpenDescriptionStream())
        {
            using(var reader = new BinaryReader(stream))
            {
                // read description data
            }
        }

        using(var stream = saves[0].OpenDataStream())
        {
            using(var reader = new BinaryReader(stream))
            {
                // read save data here
            }
        }
    }
}

Examples

  • Documentation is still being developed and will be uploaded shortly. In the meantime, below are a couple examples; the entire library follows this basic layout.

Retrieving a user by username
// Asynchronous version
var asyncResult = User.BeginGetByUsername(YourGameID, YourPrivateKey, "Programmer16");
while(!asyncResult.IsCompleted)
{
    // sleep here
}
var userInfo = User.EndGetByUsername(asyncResult);

// Synchronous version
var userInfo = User.GetByUsername(YourGameID, YourPrivateKey, "Programmer16");

Last edited Feb 18, 2013 at 5:51 PM by Programmer16, version 5

Comments

No comments yet.