public async Task <YoutubeCall <YoutubeActivity> > GetChannelActivity(string id) { YoutubeCall <YoutubeActivity> activity = new YoutubeCall <YoutubeActivity>(); string url = GenerateUrl(ACTIIVTY, "&channelId=" + id, true); Console.WriteLine("ChannelActivity: " + url); var uri = new Uri(url); var response = await _client.GetAsync(uri).ConfigureAwait(false); if (response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); activity = JsonConvert.DeserializeObject <YoutubeCall <YoutubeActivity> >(content); } else { activity.code = response.StatusCode; } return(await Task.FromResult(activity)); }
public async Task <YoutubeCall <YoutubeChannel> > GetChannels(string search) { YoutubeCall <YoutubeChannel> activity = new YoutubeCall <YoutubeChannel>(); string url = GenerateUrl(SEARCH, "&q=" + search + "&type=channel", false); Console.WriteLine("Channel: " + url); var uri = new Uri(url); var response = await _client.GetAsync(uri).ConfigureAwait(false); if (response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); activity = JsonConvert.DeserializeObject <YoutubeCall <YoutubeChannel> >(content); } else { activity.code = response.StatusCode; } return(await Task.FromResult(activity)); }
public ChannelActivityEvent(string channelId, YoutubeCall <YoutubeActivity> results) { ChannelId = channelId; Result = results; }