コード例 #1
0
 public IEXResponse ParseResponse(string response)
 {
     try
     {
         IEXResponse resp = (IEXResponse)Activator.CreateInstance(this.GetResponseType());
         resp.Deserialize(response);
         return(resp);
     } catch (Exception ex)
     {
         Console.WriteLine(ex);
         return(null);
     }
 }
コード例 #2
0
        public IEXResponse DoRequest(IEXRequest request)
        {
            Uri uri = getUri(request.GetEndpoint());

            using (HttpClient client = getClient(uri))
            {
                Console.WriteLine(uri.ToString());
                HttpResponseMessage response = client.GetAsync(uri).GetAwaiter().GetResult();
                if (response.IsSuccessStatusCode)
                {
                    Console.WriteLine(response.Content.ReadAsStringAsync().GetAwaiter().GetResult());
                    IEXResponse iexresponse = request.ParseReqponse();
                    return(iexresponse);
                }
                else
                {
                    Console.WriteLine(response.ToString());
                    return(null);
                }
            }
        }