public static Task <string> GetOnAirProgramsDataAsync(
            NiconicoVitaContext context, Nullable <CommunityType> type, SortDirection sortDirection, SortType sortType, Range range)
        {
            range.CheckMaximumLength(149, "range");

            var sb = new StringBuilder(NiconicoUrls.LiveVideoOnAirListUrl);

            sb.Append('&');
            sb.Append(range.ToFromLimitString());
            if (sortDirection == SortDirection.Descending)
            {
                sb.Append("&order=");
                sb.Append(sortDirection.ToChar());
            }
            if (type.HasValue)
            {
                sb.Append("&pt=");
                sb.Append(type.Value.ToCommunityTypeString());
            }
            if (sortType != SortType.StartTime)
            {
                sb.Append("&sort=");
                sb.Append(sortType.ToSortTypeString());
            }

            return(context.GetClient().GetStringWithoutHttpRequestExceptionAsync(sb.ToString()));
        }
示例#2
0
        public static Task <string> GetVideoDataAsync(NiconicoVitaContext context, string requestId)
        {
            if (!NiconicoRegex.IsLiveId(requestId))
            {
                throw new ArgumentException();
            }

            return(context.GetClient().GetStringWithoutHttpRequestExceptionAsync(NiconicoUrls.VideoUrl + requestId));
        }
示例#3
0
        public static Task <string> GetVideosDataAsync(NiconicoVitaContext context, IReadOnlyList <string> requestIds)
        {
            foreach (var requestId in requestIds)
            {
                if (!NiconicoRegex.IsLiveId(requestId))
                {
                    throw new ArgumentException();
                }
            }

            return(context.GetClient().GetStringWithoutHttpRequestExceptionAsync(NiconicoUrls.VideosUrl + string.Join(",", requestIds)));
        }
        public static Task <string> GetOnAirProgramsDataAsync(
            NiconicoVitaContext context, CommunityType type, Range range)
        {
            range.CheckMaximumLength(149, "range");

            var sb = new StringBuilder(NiconicoUrls.LiveVideoComingSoonListUrl);

            sb.Append('&');
            sb.Append(range.ToFromLimitString());
            sb.Append("&pt=");
            sb.Append(type.ToCommunityTypeString());
            return(context.GetClient().GetStringWithoutHttpRequestExceptionAsync(sb.ToString()));
        }
示例#5
0
 public static Task <string> GetSearchProgramsDataAsync(NiconicoVitaContext context, SearchProgramsRequest request)
 {
     return(context.GetClient().GetStringWithoutHttpRequestExceptionAsync(request.ToRequestString()));
 }