@@ -93,7 +93,7 @@ class GJClient {
9393 public function dataSet (key : String , value : String , forUser : Bool ): Bool {
9494 var success : Bool = false ;
9595 var keySet = new GJRequest ().urlFromType (DATA_SET (key , value , forUser ));
96- keySet .onComplete = res -> success = true ;
96+ keySet .onSuccess = res -> success = true ;
9797 keySet .onError = e -> trace (e );
9898 keySet .execute ();
9999 return success ;
@@ -226,6 +226,21 @@ class GJClient {
226226 return promise .future ;
227227 }
228228
229+ /**
230+ * Returns a list of the trophies registered in your game.
231+ * @param achieved You can set this to true or false whether if you want to fetch only the achieved ones or only the unachieved ones.
232+ * @param trophy_id Set this parameter if you just wanna fetch a single trophy.
233+ * @return A `Future` instance of the Trophies list load.
234+ */
235+ public function getTrophyList (? achieved : Bool , ? trophy_id : Int ): Future <Array <Trophy >> {
236+ var promise = new Promise <Array <Trophy >>();
237+ var trophiesReq = new GJRequest ().urlFromType (TROPHIES_FETCH (achieved , trophy_id ));
238+ trophiesReq .onSuccess = req -> promise .complete (req .trophies );
239+ trophiesReq .onError = e -> promise .error (e );
240+ trophiesReq .executeAsync ();
241+ return promise .future ;
242+ }
243+
229244 /**
230245 * Adds a new Score to a certain Score Table in your game, and returns the final Score data. \
231246 * You can also set callbacks for whatever you need using `onSuccess` and/or `onError`.
0 commit comments