public void GetUserTimeLine(String id, int count, GetUserTimeLineCompleteHandler handler) { if(m_shuoAPI == null) m_shuoAPI = new ShuoAPI(); m_shuoAPI.GetUserTimeLine(id, count, handler); }
public void GetUserTimeLine(String id, int count, GetUserTimeLineCompleteHandler handler) { if (m_netEngine == null) m_netEngine = new DoubanNetEngine(); if (count > 200) count = 200; RestRequest request = new RestRequest(); request.Method = WebMethod.Get; request.Path = String.Format("shuo/v2/statuses/user_timeline/{0}", id); request.AddParameter("count",count.ToString()); m_netEngine.SendRequest(request, (DoubanSdkResponse response) => { if (response.errCode == DoubanSdkErrCode.SUCCESS) { GetUserTimeLineEventArgs args = new GetUserTimeLineEventArgs(); DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(List<Statuses>)); List<Statuses> list = ser.ReadObject(response.stream) as List<Statuses>; args.statues = list; args.errorCode = DoubanSdkErrCode.SUCCESS; args.specificCode = response.specificCode; handler(args); } else { GetUserTimeLineEventArgs args = new GetUserTimeLineEventArgs(); args.statues = null; args.errorCode = response.errCode; args.specificCode = response.specificCode; handler(args); } }); }