コード例 #1
0
        /// <summary>
        /// Gets the videos from channels the user is following based on the OAuth token provided.
        /// Https://dev.twitch.tv/docs/v5/reference/videos/#get-followed-videos
        /// </summary>
        /// <param name="_pagination">Pagination info <see cref="Helpers.Pagination"/></param>
        /// <param name="_broadcastType">Broadcast type <see cref="Enums.BroadcastType"/></param>
        /// <returns></returns>
        public async Task <dynamic> GetFollowedVideos(Pagination _pagination, BroadcastType _broadcastType = BroadcastType.highlight)
        {
            var request = httpHelperClient.CreateHttpRequest($"kraken/videos/followed", HttpMethod.Get);

            httpHelperClient.AddQueryString(request, _pagination);
            httpHelperClient.AddQueryString(request, "broadcast_type", _broadcastType.ToString());
            return(await httpHelperClient.ExecuteRequest(request));
        }
コード例 #2
0
        public GetChannelVideosRequest(ulong channelId, BroadcastType type, PageOptions paging)
            : base("GET", $"channels/{channelId}/videos")
        {
            Parameters.Add("limit", paging.Limit);
            Parameters.Add("offset", paging.Offset);

            if (type != BroadcastType.All)
            {
                Parameters.Add("broadcast_type", type.ToString().ToLower());
            }
        }
コード例 #3
0
ファイル: TwitchClient.cs プロジェクト: teensee/TwitchDotNet
        /// <summary>
        /// Gets the top videos based on viewcount.
        /// Https://dev.twitch.tv/docs/v5/reference/videos/#get-top-videos
        /// </summary>
        /// <param name="_pagination">Pagination info <see cref="Helpers.Pagination"/></param>
        /// <param name="_game">Game name</param>
        /// <param name="_period">Period range <see cref="Enums.Period"/></param>
        /// <param name="_broadcastType">Broadcast type <see cref="Enums.BroadcastType"/></param>
        /// <returns></returns>
        public async Task <dynamic> GetTopVideos(Pagination _pagination, string _game = default(string), Period _period = Period.week, BroadcastType _broadcastType = BroadcastType.highlight)
        {
            var request = httpHelperClient.CreateHttpRequest($"kraken/videos/top", HttpMethod.Get);

            httpHelperClient.AddQueryString(request, _pagination);
            if (!string.IsNullOrEmpty(_game))
            {
                httpHelperClient.AddQueryString(request, "game", _game);
            }
            httpHelperClient.AddQueryString(request, "period", _period.ToString());
            httpHelperClient.AddQueryString(request, "broadcast_type", _broadcastType.ToString());
            return(await httpHelperClient.ExecuteRequest(request));
        }
コード例 #4
0
ファイル: TwitchClient.cs プロジェクト: teensee/TwitchDotNet
        /// <summary>
        /// Gets a list of VODs (Video on Demand) from a specified channel.
        /// Https://dev.twitch.tv/docs/v5/reference/channels/#get-channel-videos
        /// </summary>
        /// <param name="_channelId">Channel Id</param>
        /// <param name="_pagination">Pagination info <see cref="Helpers.Pagination"/></param>
        /// <param name="_broadcastType">Broadcast type <see cref="Enums.BroadcastType"/></param>
        /// <param name="_languages">Restrict VODs to specific language(s)</param>
        /// <param name="_sort">Sort by <see cref="Enums.SortBy"/></param>
        /// <returns></returns>
        public async Task <dynamic> GetChannelVideos(string _channelId, Pagination _pagination, BroadcastType _broadcastType = BroadcastType.highlight, List <string> _languages = default(List <string>), SortBy _sort = SortBy.time)
        {
            var request = httpHelperClient.CreateHttpRequest($"kraken/channels/{_channelId}/videos", HttpMethod.Get);

            httpHelperClient.AddQueryString(request, _pagination);
            httpHelperClient.AddQueryString(request, "broadcast_type", _broadcastType.ToString());
            if (_languages != default(List <string>) && _languages.Count > 0)
            {
                httpHelperClient.AddQueryString(request, "language", string.Join(",", _languages));
            }
            httpHelperClient.AddQueryString(request, "sort", _sort.ToString());
            return(await httpHelperClient.ExecuteRequest(request));
        }
コード例 #5
0
    // Return the callback appropriate for the input broadcast type
    private static Action GetCallback(BroadcastType bt, IPausable pausable)
    {
        // fancy C# switch expression - shorthand for good ol' switch-case block
        switch (bt)
        {
        case BroadcastType.Pause:
            return(pausable.OnPause);

        case BroadcastType.Resume:
            return(pausable.OnResume);

        default:
            throw new Exception(bt.ToString());
        }
    }