Ejemplo n.º 1
0
        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()));
        }