Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Gideros & GameMinion Example — Gideros Forum

Gideros & GameMinion Example

ndossndoss Guru
edited May 2012 in Code snippets
It's not a very exiting video, but here's Gideros calling some of the GameMinion APIs ...



The code is at: https://github.com/KosiDossApps/gideros_restful_apis (UPDATED)

A few notes:

1. Functions are generated from a lua table dynamically. The general format is:
     gm:function(requiredArg1, ..., requiredArgN, optionalArg1, ..., optionalArgN, callbackFunction(response))
The callback function is optional.

2. Only a subset of the GameMinion API is supported at the moment. I've tried to make it easy to add new functions based on the ideas in Spore (https://github.com/SPORE/api-description). API calls are defined in a table that looks something like:
return {
   base_url = "<a href="https://api.gameminion.com"" rel="nofollow">https://api.gameminion.com"</a>,
   name = "GameMinion API",
   version = 0,
   methods = {
 
      -- ------------------------------------------------------------------------------ 
      -- User API
      -- ------------------------------------------------------------------------------
      login = {
         path = "user_sessions/user_login.json",
         required_params = { "login", "password", },
         method = "POST",
      },
 
      registerUser = { 
         path = "users.json",
         required_params = { "firstName", "lastName", "username", "email", "password" },
         method = "POST",
      },
 
      getMyProfile = {
         path = "users/my_profile.json",
         method = "GET",
         authentication = true,
      },
 
      getUserProfile = {
         path = "users/:userid.json",
         required_params = { "userid" },
         method = "GET",
         authentication = true,
      },
     .....
I suggested to Mohamed (@GameMinion) that it'd be nice if they supported a representation like this to make it easier to keep the Gideros API up to date. He was receptive to the idea and said they'd do it.

3. UPDATE @alexzheng suggested a fix for simultaneous url requests -- I've pushed the change to github -- thanks again alexzheng! /UPDATE

4. The code doesn't have much in the way of helpful error catching/error messages.
+1 -1 (+5 / -0 )Share on Facebook

Comments

  • avoavo Member
    awesome as usual @ndoss :)

    It seems to me that for things like this, with logins or api keys etc, that not being able to encrypt lua files will be a big problem? Or is there a way around this?


  • Or is there a way around this?
    The GameMinion REST api has limited capabilities so it's not totally disastrous if it's comprimised.

    Here's how kinvey describes their different types of credentials (from: https://console.kinvey.com/#docs/REST/rest-overview#Handshake):

    There are three types of credentials used in our service.

    Master credentials is essentially the ‘admin account’. It has complete access over all data. It must never be part of the released mobile app, as it can be reverse engineered. The master secret is typically for administrative tasks. Your management console account uses the master credentials to access your data from interfaces such as the data browser. You can use the master credentials to create your own custom admin console or scripts, or to access Kinvey data from business logic layer running in a trusted environment.
    User credentials is what authenticates all communication between the mobile app and Kinvey.
    App credentials is used to bootstrap your application by authenticating the requests that creates the user. Since it has very limited grants, there is no expectation that it must remain uncompromised.

    Likes: GameMinion

    +1 -1 (+1 / -0 )Share on Facebook
  • great!
    You buddy always bring in fresh blood to gideros.
    Thanks!
  • Thanks @alexzheng, I've updated my original post to reflect the fix you came up with!
  • Thanks @ndoss for this amazing work, this kind of stuff that makes all the difference.
    Just so everyone appreciates this, ndoss did this by himself and on his own time, just to make life easier for other GiderOS developers.

    Likes: chipster123

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.