Ejemplo n.º 1
0
        /// <summary>
        /// Gets the list of token information for the account
        /// </summary>
        /// <param name="key">Accuont API Key</param>
        /// <returns></returns>
        public TokenInfo GetTokenInfo(string key)
        {
            TokenInfo tokenInfo = new TokenInfo();
            var client = new HttpClient();
            var request = new HttpRequestMessage()
            {
                RequestUri = new Uri(_tokenInfo + "?access_token=" + key),
                Method = HttpMethod.Get
            };

            request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("text/plain"));

            var task = client.SendAsync(request).ContinueWith((taskwithmsg) =>
            {
                var response = taskwithmsg.Result;
                var jsonTask = response.Content.ReadAsStringAsync();
                tokenInfo = JsonConvert.DeserializeObject<TokenInfo>(jsonTask.Result);
            });
            task.Wait();

            return tokenInfo;
        }
Ejemplo n.º 2
0
        public bool ValidateAPIKey()
        {
            _accountInformation = API.Instance.GetAccount(APIKey);
            _tokenInformation = API.Instance.GetTokenInfo(APIKey);

            return true;
        }