Exemplo n.º 1
0
        public static async Task <LeaderBoardBaseInfoResponse> GetLeaderBoardBaseInfo(LeaderBoardParam param)
        {
            if (param is null)
            {
                throw new System.ArgumentNullException(nameof(param));
            }

            var client = new RestClient(LEADERBOARD_BASEINFO_POS_URL);
            //client.Timeout = -1;
            var request         = new RestRequest(Method.POST);
            var jsonRequestBody = JsonUtils.ConvertToJSONWithCamelNamingStrat(param);

            PrepRequest(request, jsonRequestBody.Length);
            request.AddParameter("application/json",
                                 jsonRequestBody,
                                 ParameterType.RequestBody);
            IRestResponse response = await client.ExecuteAsync(request).ConfigureAwait(false);

            var result = JsonConvert.DeserializeObject <LeaderBoardBaseInfoResponse>(response.Content);

            result.EncryptedUid = param.EncryptedUid;
            return(result);
        }
Exemplo n.º 2
0
        public static async Task <LeaderboardResponse> GetLeaderBoardPosition(LeaderBoardParam param)
        {
            if (param is null)
            {
                throw new System.ArgumentNullException(nameof(param));
            }

            var client = new RestClient(LEADERBOARD_POS_URL);
            //client.Timeout = -1;
            var request         = new RestRequest(Method.POST);
            var jsonRequestBody = JsonUtils.ConvertToJSONWithCamelNamingStrat(param);

            PrepRequest(request, jsonRequestBody.Length);
            //request.AddHeader("Cookie", "cid=OHOk09os; JSESSIONID=B65A94A6A373AFF75E56878A7CB09924");
            request.AddParameter("application/json",
                                 jsonRequestBody,
                                 ParameterType.RequestBody);
            IRestResponse response = await client.ExecuteAsync(request).ConfigureAwait(false);

            var result = JsonUtils.DeserializeJSONWithCamelNamingStrat <LeaderboardResponse>(response.Content);

            result.EncryptedUid = param.EncryptedUid;
            return(result);
        }