public void GetCatalogShots(ShotCatalog shotCatalog, int pageIndex=0, int perPage=0) { string requestUrl = base.MegerRequestCatalogUrl(shotCatalog, pageIndex, perPage); DataRequestHelper requestHelper = new DataRequestHelper(); requestHelper.ExcuteAsyncRequest(requestUrl, Method.GET, base._postArgumentList); requestHelper.AsyncResponseComplated += (responseData, ex) => { if (!string.IsNullOrEmpty(responseData.ToString())) { if (!base.IsRateLimitedRequest(responseData.ToString())) { try { CatalogShots catalogShots = JsonConvert.DeserializeObject<CatalogShots>(responseData.ToString()); if (AsyncCatalogShotsComplated != null) AsyncCatalogShotsComplated(catalogShots, null); } catch (Exception se) { if (AsyncCatalogShotsComplated != null) AsyncCatalogShotsComplated("Json format error.try later", se); } } else { if (AsyncCatalogShotsComplated != null) AsyncCatalogShotsComplated("Rate limited for a minute.", new Exception()); } } }; }
public void GetUserMostRecentShots(string username,int pageIndex,int prePage) { string requestUrl = GetRequestUrl("players/" + username + "/shots", pageIndex, prePage); DataRequestHelper requestHelper = new DataRequestHelper(); requestHelper.ExcuteAsyncRequest(requestUrl, Method.GET, _postArgumentList); requestHelper.AsyncResponseComplated += (responseData, ex) => { if (!string.IsNullOrEmpty(responseData.ToString())) { if (!base.IsRateLimitedRequest(responseData.ToString())) { try { UserRecentShot recentShots = JsonConvert.DeserializeObject<UserRecentShot>(responseData.ToString()); if (AsyncUserProfileComplated != null) AsyncUserProfileComplated(recentShots, null); } catch (Exception se) { if (AsyncUserProfileComplated != null) AsyncUserProfileComplated("Json format error.try later", new EventArgs()); } } else { if (AsyncUserProfileComplated != null) AsyncUserProfileComplated("Rate limited for a minute.", new EventArgs()); } } }; }
public void GetShotCommentById(int shotId,int pageIndex=0,int prePage=0) { if (shotId == 0) return; string requestUrl = GetRequestUrl("shots/" + shotId.ToString() + "/comments",pageIndex,prePage); DataRequestHelper dataRequestHelper = new DataRequestHelper(); dataRequestHelper.ExcuteAsyncRequest(requestUrl, Method.GET, base._postArgumentList); dataRequestHelper.AsyncResponseComplated += (responseData, ex) => { if (!string.IsNullOrEmpty(responseData.ToString())) { if (!base.IsRateLimitedRequest(responseData.ToString())) { try { ShotComment commentDetailCol = JsonConvert.DeserializeObject<ShotComment>(responseData.ToString()); if (AsyncRequestComplated != null) AsyncRequestComplated(commentDetailCol, null); } catch (Exception se) { if (AsyncRequestComplated != null) AsyncRequestComplated("Json format error.try later", se); } } else { if (AsyncRequestComplated != null) AsyncRequestComplated("Rate limited for a minute.", new Exception()); } } }; }
public void GetUserProfileByUserName(string username) { string requestUrl = GetRequestUrl("players/" + username + "/"); DataRequestHelper dataRequestHelper = new DataRequestHelper(); dataRequestHelper.ExcuteAsyncRequest(requestUrl, Method.GET, _postArgumentList); dataRequestHelper.AsyncResponseComplated += (responseData, ex) => { if (!string.IsNullOrEmpty(responseData.ToString())) { if (!base.IsRateLimitedRequest(responseData.ToString())) { Player playerDetail = JsonConvert.DeserializeObject<Player>(responseData.ToString()); if (playerDetail != null) { if (!string.IsNullOrEmpty(playerDetail.Message)) playerDetail.IsFindUser = false; else playerDetail.IsFindUser = true; } if (AsyncUserProfileComplated != null) AsyncUserProfileComplated(playerDetail, null); } else { if (AsyncUserProfileComplated != null) AsyncUserProfileComplated("Rate limited for a minute.", new EventArgs()); } } }; }
public void GetShotDetailById(int shotId) { string requestUrl = GetRequestUrl("shots/" + shotId); DataRequestHelper requestHelper = new DataRequestHelper(); requestHelper.ExcuteAsyncRequest(requestUrl, Method.GET, base._postArgumentList); requestHelper.AsyncResponseComplated += (responseData, ex) => { if (!string.IsNullOrEmpty(responseData.ToString())) { if (!base.IsRateLimitedRequest(responseData.ToString())) { Shot shotDetail = JsonConvert.DeserializeObject<Shot>(responseData.ToString()); if (AsyncRequestComplated != null) AsyncRequestComplated(shotDetail, null); } else { if (AsyncRequestComplated != null) AsyncRequestComplated("Rate limited for a minute.", new Exception()); } } }; }