Exemplo n.º 1
0
        public void mSet(object o, String key, Action <object, OKCloudException> handler)
        {
            OKUser u = GetUser();

            if (u == null)
            {
                throw new Exception("You need a user to perform cloud set.");
            }

            string objRep = "";

            objRep += JSONObjectExt.encode(o);

            Dictionary <string, string> reqParams = new Dictionary <string, string>();

            reqParams.Add("user_id", u.OKUserID.ToString());
            reqParams.Add("field_key", key);
            reqParams.Add("field_value", objRep);

            OKCloudAsyncRequest req = new OKCloudAsyncRequest("developer_data", "POST", reqParams);

            req.performWithCompletionHandler((string response, OKCloudException e) => {
                handler(o, e);
            });
        }
Exemplo n.º 2
0
        public void mGet(String key, Action<JSONObject, OKCloudException> handler)
        {
            OKUser u = GetUser();
            if (u == null)
                throw new Exception("You need a user to perform cloud get.");

            Dictionary<string, string> reqParams = new Dictionary<string, string>();
            reqParams.Add("user_id", u.OKUserID.ToString());

            string path = string.Format("developer_data/{0}", key);
            OKCloudAsyncRequest req = new OKCloudAsyncRequest(path, "GET", reqParams);
            req.performWithCompletionHandler((string response, OKCloudException e) => {
                JSONObject jsonObj = JSONObjectExt.decode(response);
                handler(jsonObj.GetField(key), e);
            });
        }
Exemplo n.º 3
0
        public void mSet(object o, String key, Action<object, OKCloudException> handler)
        {
            OKUser u = GetUser();
            if (u == null)
                throw new Exception("You need a user to perform cloud set.");

            string objRep = "";
            objRep += JSONObjectExt.encode(o);

            Dictionary<string, string> reqParams = new Dictionary<string, string>();
            reqParams.Add("user_id", u.OKUserID.ToString());
            reqParams.Add("field_key", key);
            reqParams.Add("field_value", objRep);

            OKCloudAsyncRequest req = new OKCloudAsyncRequest("developer_data", "POST", reqParams);
            req.performWithCompletionHandler((string response, OKCloudException e) => {
                handler(o, e);
            });
        }
Exemplo n.º 4
0
        public void mGet(String key, Action <JSONObject, OKCloudException> handler)
        {
            OKUser u = GetUser();

            if (u == null)
            {
                throw new Exception("You need a user to perform cloud get.");
            }

            Dictionary <string, string> reqParams = new Dictionary <string, string>();

            reqParams.Add("user_id", u.OKUserID.ToString());

            string path             = string.Format("developer_data/{0}", key);
            OKCloudAsyncRequest req = new OKCloudAsyncRequest(path, "GET", reqParams);

            req.performWithCompletionHandler((string response, OKCloudException e) => {
                JSONObject jsonObj = JSONObjectExt.decode(response);
                handler(jsonObj.GetField(key), e);
            });
        }