Ejemplo n.º 1
0
        /// <summary>
        /// 读取新鲜事
        /// </summary>
        /// <param name="rrSDK"></param>
        /// <param name="callback"></param>
        public void GetFeed(RenrenSDK rrSDK, APIRequestCompletedHandler callback, string types = "10,30")
        {
            string accessToken = RenrenSDK.RenrenInfo.tokenInfo.access_token;
            string callID      = String.Format("{0}", DateTime.Now.Second);

            List <APIParameter> parameters = new List <APIParameter>()
            {
                new APIParameter("method", Method.GetFeed),
                new APIParameter("access_token", accessToken),
                new APIParameter("call_id", callID),
                new APIParameter("v", "1.0"),

                //new APIParameter("type", "10,20,21,30,32,33,34,40,50,51,52"),//新鲜事的类别,多个类型以逗号分隔,
                new APIParameter("type", types),//新鲜事的类别,多个类型以逗号分隔,

                new APIParameter("format", "JSON")
                //new APIParameter("page", page.ToString())
                //new APIParameter("count", count.ToString())
            };
            string sig = ApiHelper.CalSig(parameters);

            if (string.IsNullOrEmpty(sig))
            {
                return;
            }
            parameters.Add(new APIParameter("sig", sig));
            rrSDK.RequestAPIInterface(new APIRequestCompletedHandler(callback), parameters);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 读取状态
        /// </summary>
        /// <param name="rrSDK"></param>
        /// <param name="callback"></param>
        public void GetStatus(RenrenSDK rrSDK, APIRequestCompletedHandler callback, string status_id, string owner_id = null)
        {
            string accessToken = RenrenSDK.RenrenInfo.tokenInfo.access_token;
            string callID      = String.Format("{0}", DateTime.Now.Second);

            List <APIParameter> parameters = new List <APIParameter>()
            {
                new APIParameter("method", Method.GetStatus),
                new APIParameter("access_token", accessToken),
                new APIParameter("call_id", callID),
                new APIParameter("v", "1.0"),

                new APIParameter("status_id", "status_id"),

                new APIParameter("format", "JSON")
            };

            //状态信息所属用户id,不指定则根据sk判断为当前用户
            if (owner_id != null)
            {
                parameters.Add(new APIParameter("owner_id", owner_id));
            }

            string sig = ApiHelper.CalSig(parameters);

            if (string.IsNullOrEmpty(sig))
            {
                return;
            }
            parameters.Add(new APIParameter("sig", sig));
            rrSDK.RequestAPIInterface(new APIRequestCompletedHandler(callback), parameters);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 发布新状态
        /// </summary>
        /// <param name="rrSDK"></param>
        /// <param name="callback"></param>
        public void SetStatus(RenrenSDK rrSDK, APIRequestCompletedHandler callback, string status)
        {
            string accessToken = RenrenSDK.RenrenInfo.tokenInfo.access_token;
            string callID      = String.Format("{0}", DateTime.Now.Second);

            if (status.Length > 139 * 2)        //状态最长140字
            {
                status = status.Substring(0, 140);
            }

            List <APIParameter> parameters = new List <APIParameter>()
            {
                new APIParameter("method", Method.SetStatus),
                new APIParameter("access_token", accessToken),
                new APIParameter("call_id", callID),
                new APIParameter("v", "1.0"),

                new APIParameter("status", status),

                new APIParameter("format", "JSON")
            };

            string sig = ApiHelper.CalSig(parameters);

            if (string.IsNullOrEmpty(sig))
            {
                return;
            }
            parameters.Add(new APIParameter("sig", sig));
            rrSDK.RequestAPIInterface(new APIRequestCompletedHandler(callback), parameters);
        }
Ejemplo n.º 4
0
 // Constructor
 public RenrenAPI(string appID, string apiKey, string secretKey)
 {
     rrSDK = new RenrenSDK(appID, apiKey, secretKey);
 }
Ejemplo n.º 5
0
 // Constructor
 public RenrenAPI(string appID, string apiKey, string secretKey)
 {
     rrSDK = new RenrenSDK(appID, apiKey, secretKey);
 }