public void Query <T>(CustomQuery query, Action <IRestResponse <List <T> > > callback = null) where T : new()
        {
            string      uri     = string.Format("{0}{1}{2}", URI_TABLES, _name, query);
            ZumoRequest request = new ZumoRequest(_client, uri, Method.GET);

            Debug.Log("Query Request: " + uri + " Query:" + query);
            _client.ExecuteAsync <List <T> > (request, callback);
        }
        public IEnumerator Query <T> (CustomQuery query, Action <IRestResponse <T[]> > callback = null) where T : new()
        {
            string      url     = string.Format("{0}/{1}{2}{3}", _client.AppUrl, URI_TABLES, _name, query);
            ZumoRequest request = new ZumoRequest(_client, url, Method.GET);

            Debug.Log("Query Request: " + url + " Query:" + query);
            yield return(request.request.Send());

            request.ParseJsonArray <T> (callback);
        }
        public void Query <T>(CustomQuery query, Action <IRestResponse <T> > callback = null) where T : INestedResults, new()
        {
            string queryResults = query.ToString();
            string q            = queryResults.Length > 0 ? "&" : "?";

            queryResults += string.Format("{0}$inlinecount=allpages", q);
            string      uri     = string.Format("{0}{1}{2}", URI_TABLES, _name, queryResults);
            ZumoRequest request = new ZumoRequest(_client, uri, Method.GET);

            Debug.Log("Query Request: " + uri + " Query with inlinecount:" + queryResults);
            _client.ExecuteAsync <T> (request, callback);
        }
        /*
         *      public IEnumerator Query<T,N> (CustomQuery query, Action<IRestResponse<N>> callback = null) where N : INestedResults<T> where T : new()
         * {
         *              string queryString = query.ToString ();
         *              string q = queryString.Length > 0 ? "&" : "?";
         *              queryString += string.Format ("{0}$inlinecount=allpages", q);
         *              string url = string.Format ("{0}/{1}{2}{3}", _client.AppUrl, URI_TABLES, _name, queryString);
         *              Debug.Log ("Query Request: " + url + " Paginated Query:" + query);
         *              ZumoRequest request = new ZumoRequest (_client, url, Method.GET);
         *              yield return request.request.Send ();
         *              request.TryParseJsonNestedArray<T,N> ("results", callback);
         *      }
         */
        public IEnumerator Query <T>(CustomQuery query, Action <IRestResponse <NestedResults <T> > > callback = null) where T : new()
        {
            string queryString = query.ToString();
            string q           = queryString.Length > 0 ? "&" : "?";

            queryString += string.Format("{0}$inlinecount=allpages", q);
            string url = string.Format("{0}/{1}{2}{3}", _client.AppUrl, URI_TABLES, _name, queryString);

            Debug.Log("Query Request: " + url + " Paginated Query:" + query);
            ZumoRequest request = new ZumoRequest(_client, url, Method.GET);

            yield return(request.request.Send());

            request.ParseJsonNestedArray <T, NestedResults <T> >("results", callback);
        }
 private void Query(CustomQuery query)
 {
     _table.Query<Highscore>(query, OnReadCompleted);
 }
 private void GetPageHighscores()
 {
     CustomQuery query = new CustomQuery ("", "score desc", _noPageResults, _skip, "id,username,score");
     _table.Query<NestedResults<Highscore>>(query, OnReadNestedResultsCompleted);
 }
 public void GetUsernameHighscore()
 {
     Highscore score = GetScore ();
     string filter = string.Format("username eq '{0}'", score.username);
     string orderBy = "score desc";
     CustomQuery query = new CustomQuery(filter,orderBy);
     Query(query);
 }
 public void GetTopHighscores()
 {
     DateTime today = DateTime.Today;
     string day = today.ToString("s");
     string filter = string.Format("createdAt gt '{0}Z'", day);
     Debug.Log ("filter:" + filter);
     string orderBy = "score desc";
     CustomQuery query = new CustomQuery(filter,orderBy,10);
     Query(query);
 }
예제 #9
0
 public void Load()
 {
     string filter = string.Format("userId eq '{0}'", _client.User.user.userId);
     Debug.Log("Load data for UserId: " + _client.User.user.userId );
     CustomQuery query = new CustomQuery(filter);
     _table.Query<Inventory>(query, OnLoadCompleted);
 }