public ITopic Get(string name) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException(nameof(name)); } ITopic topic; if (_topics.TryGetValue(name, out topic)) { return(topic); } var http = this.GetHttpClient(name); var response = http.GetAsync(this.GetRequestUrl(name)); if (response.Result.IsSuccessStatusCode) { var info = MessageUtility.ResolveTopicInfo(response.Result.Content.ReadAsStreamAsync().Result); if (info != null) { return(new Topic(this, name, info, http)); } } return(null); }
public TopicInfo GetInfo(bool refresh = false) { if (refresh || _info == null) { var response = _http.GetAsync(MESSAGE_SEND_URL); if (response.Result.IsSuccessStatusCode) { _info = MessageUtility.ResolveTopicInfo(response.Result.Content.ReadAsStreamAsync().Result); } else { _info = null; } } return(_info); }