Exemple #1
0
        public void FetchTagTest()
        {
            var request = new TagFetchRequest();

            var client   = new Client(_apiKey, _secretKey);
            var response = client.FetchTag(request);

            Assert.NotNull(response);
            Assert.Greater(response.RequestId, 0);
            Assert.NotNull(response.ResponseParams);
            Assert.Greater(response.ResponseParams.Amount, 0);
        }
        /// <summary>
        /// fetch_tag
        /// </summary>
        /// <param name="request">set tag request parameter</param>
        /// <returns></returns>
        public TagFetchResponse FetchTag(TagFetchRequest request)
        {
            var postStr = request.GeneratePostData(Apikey, SecretKey);

            var response = PostData(request.ServiceUrl, postStr);

            if (response == null)
            {
                return(null);
            }

            TagFetchResponse result = null;

            try
            {
                result = JsonConvert.DeserializeObject <TagFetchResponse>(response);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("FetchTag Error Response Deserialize Fail, May not valid json:" + ex.Message + " " + response);
            }
            return(result);
        }