public TwitchList<Video> GetFollowedVideos(PagingInfo pagingInfo = null)
 {
     var request = GetRequest("videos/followed", Method.GET);
     TwitchHelper.AddPaging(request, pagingInfo);
     var response = restClient.Execute<TwitchList<Video>>(request);
     return response.Data;
 }
 public TwitchList<Follower> GetFollowers(string channel, PagingInfo pagingInfo = null)
 {
     var request = GetRequest("channels/{channel}/follows", Method.GET);
     request.AddUrlSegment("channel", channel);
     TwitchHelper.AddPaging(request, pagingInfo);
     var response = restClient.Execute<TwitchList<Follower>>(request);
     return response.Data;
 }
 public TwitchList<FollowedChannel> GetFollowedChannels(string user, PagingInfo pagingInfo = null, SortDirection sortDirection = SortDirection.desc, SortType sortType = SortType.created_at)
 {
     var request = GetRequest("users/{user}/follows/channels", Method.GET);
     request.AddUrlSegment("user", user);
     TwitchHelper.AddPaging(request, pagingInfo);
     request.AddParameter("direction", sortDirection);
     request.AddParameter("sortby", sortType);
     var response = restClient.Execute<TwitchList<FollowedChannel>>(request);
     return response.Data;
 }
Esempio n. 4
0
        private void UpdateSubscribers()
        {
            PagingInfo p = new PagingInfo();
            p.PageSize = 100;

            _subscribers.Clear();
            TwitchList<Subscription> temp = new TwitchList<Subscription>();

            //Twitch only allows requests for 100 subscribers at a time. 
            //Need to keep incrementing pages until you got all the subs.
            do
            {
                temp = twitchClient.GetSubscribers(pagingInfo: p);
                _subscribers.AddRange(temp.List.Select(t => t.User.DisplayName.ToLower()));
                p.Page++;
            }
            while (temp.Total > _subscribers.Count);
        }
 public TwitchList<TopGame> GetTopGames(PagingInfo pagingInfo = null)
 {
     var request = GetRequest("games/top", Method.GET);
     TwitchHelper.AddPaging(request, pagingInfo);
     var response = restClient.Execute<TwitchList<TopGame>>(request);
     return response.Data;
 }
 public TwitchList<Video> GetChannelVideos(string channel, bool broadcasts = false, bool hls = false, PagingInfo pagingInfo = null)
 {
     var request = GetRequest("channels/{channel}/videos", Method.GET);
     request.AddUrlSegment("channel", channel);
     request.AddParameter("broadcasts", broadcasts);
     request.AddParameter("hls", hls);
     TwitchHelper.AddPaging(request, pagingInfo);
     var response = restClient.Execute<TwitchList<Video>>(request);
     return response.Data;
 }
 public TwitchList<Video> GetTopVideos(string game = null, PeriodType period = PeriodType.week, PagingInfo pagingInfo = null)
 {
     var request = GetRequest("videos/top", Method.GET);
     request.AddSafeParameter("game", game);
     request.AddParameter("period", period);
     TwitchHelper.AddPaging(request, pagingInfo);
     var response = restClient.Execute<TwitchList<Video>>(request);
     return response.Data;
 }
 public TwitchList<Team> GetTeams(PagingInfo pagingInfo = null)
 {
     var request = GetRequest("teams", Method.GET);
     TwitchHelper.AddPaging(request, pagingInfo);
     var response = restClient.Execute<TwitchList<Team>>(request);
     return response.Data;
 }
 public TwitchList<Featured> GetFeaturedStreams(PagingInfo pagingInfo = null)
 {
     var request = GetRequest("streams/featured", Method.GET);
     TwitchHelper.AddPaging(request, pagingInfo);
     var response = restClient.Execute<TwitchList<Featured>>(request);
     return response.Data;
 }
 public TwitchList<Stream> GetStreams(string game = null, string channel = null, string clientId = null, PagingInfo pagingInfo = null)
 {
     var request = GetRequest("streams", Method.GET);
     request.AddSafeParameter("game", game);
     request.AddSafeParameter("channel", channel);
     TwitchHelper.AddPaging(request, pagingInfo);
     request.AddSafeParameter("client_id", clientId);
     var response = restClient.Execute<TwitchList<Stream>>(request);
     return response.Data;
 }
 public TwitchList<Game> SearchGames(string query, bool live = false, PagingInfo pagingInfo = null)
 {
     var request = GetRequest("search/games", Method.GET);
     request.AddParameter("query", query);
     request.AddParameter("type", "suggest");                // currently no other types than "suggest"
     request.AddParameter("live", live);                     // if live = true, only returns games that are live on at least one channel.
     TwitchHelper.AddPaging(request, pagingInfo);
     var response = restClient.Execute<TwitchList<Game>>(request);
     return response.Data;
 }
 public TwitchList<Stream> SearchStreams(string query, bool hls, PagingInfo pagingInfo = null)
 {
     var request = GetRequest("search/streams", Method.GET);
     request.AddParameter("query", query);
     request.AddParameter("hls", hls);
     TwitchHelper.AddPaging(request, pagingInfo);
     var response = restClient.Execute<TwitchList<Stream>>(request);
     return response.Data;
 }
 public TwitchList<Channel> SearchChannels(string query, PagingInfo pagingInfo = null)
 {
     var request = GetRequest("search/channels", Method.GET);
     request.AddParameter("query", query);
     TwitchHelper.AddPaging(request, pagingInfo);
     var response = restClient.Execute<TwitchList<Channel>>(request);
     return response.Data;
 }
Esempio n. 14
0
 public static void AddPaging(IRestRequest request, PagingInfo pagingInfo)
 {
     if (pagingInfo == null) return;
     request.AddParameter("limit", pagingInfo.PageSize);
     request.AddParameter("offset", pagingInfo.Page - 1);
 }
 public TwitchList<Subscription> GetSubscribers(PagingInfo pagingInfo = null, SortDirection sortDirection = SortDirection.asc)
 {
     var request = GetRequest("channels/{channel}/subscriptions", Method.GET);
     request.AddUrlSegment("channel", username);
     TwitchHelper.AddPaging(request, pagingInfo);
     request.AddParameter("direction", sortDirection);
     var response = restClient.Execute<TwitchList<Subscription>>(request);
     return response.Data;
 }