Exemple #1
0
        /// <summary>
        /// Authenticate a user, returning a ParseInstance with the user details.
        /// </summary>
        /// <param name="username">
        /// A <see cref="System.String"/>
        /// </param>
        /// <param name="password">
        /// A <see cref="System.String"/>
        /// </param>
        /// <returns>
        /// A <see cref="ParseInstance"/>
        /// </returns>
        public static ParseInstance Authenticate(string username, string password)
        {
            var instance = new ParseInstance(users);

            instance.isDone = false;
            var queryString = WWW.EscapeURL("username="******"&" + WWW.EscapeURL("password="******"/login" + "?" + queryString);

            /*
             * var r = Parse.Request ("GET", "/login" + "?" + queryString);
             * r.Send (delegate(HTTP.Request request) {
             *      instance.code = request.response.status;
             *      try {
             *              instance.json = (Hashtable)JSON.JsonDecode (request.response.Bytes);
             *
             *              if (instance.json.ContainsKey ("error")) {
             *                      instance.error = (string)instance.json["error"];
             *              } else {
             *                      Parse.SessionToken = instance.Get<string> ("sessionToken");
             *              }
             *      } catch (System.Exception e) {
             *              instance.error = e.ToString ();
             *      }
             *      if (instance.error != null)
             *              Debug.LogWarning (instance.error);
             *      instance.isDone = true;
             * });
             */
            return(instance);
        }
Exemple #2
0
        /// <summary>
        /// Return a ParseInstance by objectId.
        /// </summary>
        /// <param name="objectId">
        /// A <see cref="System.String"/>
        /// </param>
        /// <returns>
        /// A <see cref="ParseInstance"/>
        /// </returns>
        public ParseInstance Get(string objectId)
        {
            var instance = new ParseInstance(this);

            instance.isDone = false;

            /*
             * var r = Parse.Request ("GET", string.Format ("{0}/{1}", root, objectId));
             * r.Send (delegate(HTTP.Request request) {
             *      instance.code = request.response.status;
             *      instance.uri = request.uri.ToString ();
             *      try {
             *              instance.json = (Hashtable)JSON.JsonDecode (request.response.Bytes);
             *              if (instance.json.ContainsKey ("error")) {
             *                      instance.error = (string)instance.json["error"];
             *              }
             *      } catch (System.Exception e) {
             *              instance.error = e.ToString ();
             *      }
             *      if (instance.error != null)
             *              Debug.LogWarning (instance.error);
             *      instance.isDone = true;
             * });
             */
            return(instance);
        }
Exemple #3
0
        /// <summary>
        /// Create a new ParseInstance for this ParseClass.
        /// </summary>
        /// <returns>
        /// A <see cref="ParseInstance"/>
        /// </returns>
        public ParseInstance New()
        {
            var instance = new ParseInstance(this);

            return(instance);
        }