コード例 #1
0
ファイル: TopicClient.cs プロジェクト: qmwu2000/hermes
 public List<TopicView> getTopics()
 {
     var RestConfig = new RestConfig();
     HttpWebRequest request = WebRequest.Create(RestConfig.topics) as HttpWebRequest;
     request.Method = "GET";
     HttpWebResponse response = request.GetResponse() as HttpWebResponse;
     Stream responseStream = response.GetResponseStream();
     string content = new StreamReader(responseStream).ReadToEnd();
     responseStream.Close();
     List<TopicView> topics = (List<TopicView>)JsonConvert.DeserializeObject(content, typeof(List<TopicView>));
     return topics;
 }
コード例 #2
0
ファイル: MetaClient.cs プロジェクト: qmwu2000/hermes
 public Meta getMeta()
 {
     var RestConfig = new RestConfig();
     HttpWebRequest request = WebRequest.Create(RestConfig.meta) as HttpWebRequest;
     request.Method = "GET";
     HttpWebResponse response = request.GetResponse() as HttpWebResponse;
     Stream responseStream = response.GetResponseStream();
     string content = new StreamReader(responseStream).ReadToEnd();
     responseStream.Close();
     Meta meta = (Meta)JsonConvert.DeserializeObject(content, typeof(Meta));
     return meta;
 }
コード例 #3
0
ファイル: TopicClient.cs プロジェクト: qmwu2000/hermes
 public TopicView getTopic(string name)
 {
     var RestConfig = new RestConfig();
     HttpWebRequest request = WebRequest.Create(RestConfig.topics + name) as HttpWebRequest;
     request.Method = "GET";
     HttpWebResponse response = request.GetResponse() as HttpWebResponse;
     Stream responseStream = response.GetResponseStream();
     string content = new StreamReader(responseStream).ReadToEnd();
     responseStream.Close();
     TopicView topic = (TopicView)JsonConvert.DeserializeObject(content, typeof(TopicView));
     return topic;
 }