public Stream(string channelUrl, string broadcaster, long?id, string preview, string game, JObject channelO, string name, int?viewers, Twixel twixel) { if (channelUrl != null) { this.channelUrl = new WebUrl(channelUrl); } this.broadcaster = broadcaster; if (id == null) { this.id = -1; } else { this.id = id; } this.preview = new WebUrl(preview); this.game = game; channel = twixel.LoadChannel(channelO); this.name = name; if (viewers == null) { this.viewers = -1; } else { this.viewers = viewers; } }
/// <summary> /// Gets a list of channels this user is following /// </summary> /// <param name="getNext">If this method was called before then this will get the next page of channels</param> /// <returns>A list of channels</returns> public async Task <List <Channel> > RetrieveFollowing(bool getNext) { Uri uri; if (!getNext) { uri = new Uri("https://api.twitch.tv/kraken/users/" + name + "/follows/channels"); } else { if (nextFollowing != null) { uri = nextFollowing.url; } else { uri = new Uri("https://api.twitch.tv/kraken/users/" + name + "/follows/channels"); } } string responseString = await Twixel.GetWebData(uri); if (Twixel.GoodStatusCode(responseString)) { nextFollowing = new WebUrl((string)JObject.Parse(responseString)["_links"]["next"]); List <Channel> followedChannels = new List <Channel>(); foreach (JObject o in (JArray)JObject.Parse(responseString)["follows"]) { followedChannels.Add(twixel.LoadChannel((JObject)o["channel"])); } return(followedChannels); } else { twixel.CreateError(responseString); return(null); } }
public Subscription(string id, string createdAt, JObject channelO, Twixel twixel) { this.id = id; this.createdAt = DateTime.Parse(createdAt); this.channel = twixel.LoadChannel(channelO); }