public bool IsStreamUp(TwitchStream streamInfo) { if (streamInfo.Data.Length == 0) { return(false); } return(true); }
/// <summary> /// Get the stream information JSON from the Twitch API /// </summary> /// <returns>TwitchStream object with the stream's information in a StreamData array and a Pagination object</returns> public async Task <TwitchStream> GetStreamInfoAsync() { TwitchStream streamInfo = null; string url = $"{TwitchApiUrl}streams?user_login=dellor"; // Should I not hardcode Mak's username? apiKey = await GetAuthTokenAsync(); twitchClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey); var response = await twitchClient.GetAsync(url); if (response.IsSuccessStatusCode) { var streamJSON = await response.Content.ReadAsStringAsync(); streamInfo = JsonConvert.DeserializeObject <TwitchStream>(streamJSON); RevokeAuthTokenAsync(apiKey); return(streamInfo); } RevokeAuthTokenAsync(apiKey); return(streamInfo); }