Пример #1
0
        /// <summary>
        /// Fetch all genres for the current top charts.
        /// Route: catalog/{storefront}/genres
        /// https://developer.apple.com/documentation/applemusicapi/get_catalog_top_charts_genres
        /// </summary>
        /// <param name="storefront"></param>
        /// <param name="pageOptions"></param>
        /// <param name="locale"></param>
        /// <returns></returns>
        public async Task <GenreResponse> GetCatalogTopChartsGenres(string storefront, PageOptions pageOptions = null, string locale = null)
        {
            if (string.IsNullOrWhiteSpace(storefront))
            {
                throw new ArgumentNullException(nameof(storefront));
            }

            return(await Get <GenreResponse>($"{BaseRequestUri}/{storefront}/{ResourceType.Genres.GetValue()}", pageOptions : pageOptions, locale : locale)
                   .ConfigureAwait(false));
        }
Пример #2
0
        public async Task <PagedResult <IEvent> > GetManyAsync(string partitionKey, string rowKey,
                                                               DateTime startDate, DateTime endDate, PageOptions pageOptions)
        {
            var start  = CoreHelpers.DateTimeToTableStorageKey(startDate);
            var end    = CoreHelpers.DateTimeToTableStorageKey(endDate);
            var filter = MakeFilter(partitionKey, string.Format(rowKey, start), string.Format(rowKey, end));

            var query             = new TableQuery <EventTableEntity>().Where(filter).Take(pageOptions.PageSize);
            var result            = new PagedResult <IEvent>();
            var continuationToken = DeserializeContinuationToken(pageOptions?.ContinuationToken);

            var queryResults = await _table.ExecuteQuerySegmentedAsync(query, continuationToken);

            result.ContinuationToken = SerializeContinuationToken(queryResults.ContinuationToken);
            result.Data.AddRange(queryResults.Results);

            return(result);
        }
Пример #3
0
 public async Task <VideoCollection> GetChannelVideosAsync(ulong channelId, PageOptions paging, RequestOptions options)
 {
     paging  = PageOptions.CreateOrClone(paging);
     options = RequestOptions.CreateOrClone(options);
     return(await SendAsync <VideoCollection>("GET", $"channels/{channelId}/videos", options).ConfigureAwait(false));
 }
Пример #4
0
 public async Task <ClipCollection> GetFollowedClipsAsync(bool istrending, PageOptions paging, RequestOptions options)
 {
     paging  = PageOptions.CreateOrClone(paging);
     options = RequestOptions.CreateOrClone(options);
     return(await SendAsync <ClipCollection>(new GetFollowedClipsRequest(istrending, paging), options));
 }
Пример #5
0
 public async Task <StreamCollection> FindStreamsAsync(string query, bool?hls, PageOptions paging, RequestOptions options)
 {
     paging  = PageOptions.CreateOrClone(paging);
     options = RequestOptions.CreateOrClone(options);
     return(await SendAsync <StreamCollection>(new FindStreamsRequest(query, hls, paging), options).ConfigureAwait(false));
 }
Пример #6
0
 public async Task <TeamCollection> GetTeamsAsync(PageOptions paging, RequestOptions options)
 {
     paging  = PageOptions.CreateOrClone(paging);
     options = RequestOptions.CreateOrClone(options);
     return(await SendAsync <TeamCollection>(new GetTeamsRequest(paging), options).ConfigureAwait(false));
 }
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="queryable"></param>
        /// <param name="pageOptions"></param>
        /// <returns></returns>
        public static IQueryable <T> OrderAndPaged <T>(this IQueryable <T> queryable, PageOptions pageOptions) where T : class
        {
            if (pageOptions.Orders == null || !pageOptions.Orders.Any())
            {
                return(queryable);
            }

            return(queryable
                   .Order(pageOptions.Orders.ToList())
                   .Skip(pageOptions.Skip)
                   .Take(pageOptions.Take));
        }
Пример #8
0
 public async Task <FollowCollection> GetFollowsAsync(ulong userId, SortMode sort, bool ascending, PageOptions paging, RequestOptions options)
 {
     paging  = PageOptions.CreateOrClone(paging);
     options = RequestOptions.CreateOrClone(options);
     return(await SendAsync <FollowCollection>(new GetFollowsRequest(userId, sort, ascending, paging), options).ConfigureAwait(false));
 }
Пример #9
0
 public async Task <ActionResult <PagedList <ProductDto> > > Get([FromQuery] PageOptions options, string language, CancellationToken token)
 {
     return(await _productService.GetPagedListAsync(options, language, token));
 }
Пример #10
0
 public async Task <ActionResult <PagedList <AdminProductDto> > > GetPagedListForAdmin([FromQuery] PageOptions options, CancellationToken token)
 {
     return(await _productService.GetPagedListForAdminAsync(options, token));
 }
Пример #11
0
        public virtual ActionResult Index(string currentFilter, string searchString, int? page)
        {
            // On commence par charger tout
            // avec un tri par nom
            PageOptions l_pageOptions = new PageOptions();
            l_pageOptions.OrderByArguments = new OrderByArgumentCollection();
            l_pageOptions.OrderByArguments.Add("[Contenu].[Nom]", System.ComponentModel.ListSortDirection.Ascending);

            IEnumerable<TheSaucisseFactory.Media> l_items = TheSaucisseFactory.MediaCollection.PageLoadAll(int.MinValue, int.MaxValue, l_pageOptions);

            // S'il y a une chaine recherchée...
            if (!string.IsNullOrEmpty(searchString))
            {
                // alors, il faut se re-positionner sur la 1ère page
                page = 1;
            }
            else
            {
                // sinon, il suffit de remettre comme chaine l'éventuel filtre courant
                searchString = currentFilter;
            }

            // On sauvegarde le filtre courant
            ViewBag.CurrentFilter = searchString;

            // Et on limitte le résultat à ce filtre
            if (!string.IsNullOrEmpty(searchString))
            {
                l_items = l_items.Where(entity => entity.Nom.ToLower().Contains(searchString.ToLower()));
            }

            int pageSize = int.Parse(WebConfigurationManager.AppSettings["ListMaxSize"]);
            int pageNumber = (page ?? 1);

            return View("Media/Index", l_items.ToPagedList(pageNumber, pageSize));
        }
Пример #12
0
 // Users
 ///// <summary> Block this user, requires `user_blocks_edit` </summary>
 //public Task BlockAsync(RequestOptions options = null)
 //    => UserHelper.BlockAsync(Client, Client.CurrentUser.Id, Id, options);
 ///// <summary> Unblock this user, requires `user_blocks_edit` </summary>
 //public Task UnblockAsync(RequestOptions options = null)
 //    => UserHelper.UnblockAsync(Client, Id, options);
 /// <summary> Get all users currently blocked by this user, requires `user_blocks_read` </summary>
 public Task <IReadOnlyCollection <RestBlockedUser> > GetBlocksAsync(PageOptions paging = null, RequestOptions options = null)
 => UserHelper.GetBlocksAsync(Client, Id, paging, options);
Пример #13
0
 /// <summary> Get streams this user is following, requires `user_read` </summary>
 public Task <IReadOnlyCollection <RestStream> > GetFollowedStreamsAsync(StreamType type = StreamType.Live, PageOptions paging = null, RequestOptions options = null)
 => ClientHelper.GetFollowedStreamsAsync(Client, type, paging, options);
Пример #14
0
 // Follows
 /// <summary> Get all channel follows for this user </summary>
 public Task <IReadOnlyCollection <RestChannelFollow> > GetFollowsAsync(SortMode sort = SortMode.CreatedAt, bool ascending = false, PageOptions paging = null, RequestOptions options = null)
 => UserHelper.GetFollowsAsync(Client, Id, sort, ascending, paging, options);
Пример #15
0
 public Task <IActionResult> GetPage([FromQuery] PageOptions pageOptions) =>
 this.getCarPageCommand.Value.ExecuteAsync(pageOptions);
Пример #16
0
 public async Task <CommunityCollection> GetCommunityTimeoutsAsync(string communityId, PageOptions paging, RequestOptions options)        // Paging is unused
 {
     paging  = PageOptions.CreateOrClone(paging);
     options = RequestOptions.CreateOrClone(options);
     return(await SendAsync <CommunityCollection>("GET", $"communities/{communityId}/timeouts", options).ConfigureAwait(false));
 }
 public Task <IActionResult> GetPage(
     [FromServices] IGetCurrencyPageCommand command,
     string all,
     [FromQuery] PageOptions pageOptions,
     CancellationToken cancellationToken) => command.ExecuteAsync(all, pageOptions, cancellationToken);
Пример #18
0
 public async Task <StreamCollection> GetFollowedStreamsAsync(StreamType type, PageOptions paging, RequestOptions options)
 {
     paging  = PageOptions.CreateOrClone(paging);
     options = RequestOptions.CreateOrClone(options);
     return(await SendAsync <StreamCollection>(new GetFollowedStreamsRequest(type, paging), options).ConfigureAwait(false));
 }
Пример #19
0
 /// <summary> Get all users subscribed to this channel </summary>
 public Task <IReadOnlyCollection <RestUserSubscription> > GetSubscribersAsync(bool ascending = false, PageOptions paging = null, RequestOptions options = null)
 => ChannelHelper.GetSubscribersAsync(Client, Id, ascending, paging, options);
Пример #20
0
 public async Task <SubscriptionCollection> GetChannelSubscribersAsync(ulong channelId, bool ascending, PageOptions paging, RequestOptions options)
 {
     paging  = PageOptions.CreateOrClone(paging);
     options = RequestOptions.CreateOrClone(options);
     return(await SendAsync <SubscriptionCollection>(new GetSubscribersRequest(channelId, ascending, paging), options).ConfigureAwait(false));
 }
Пример #21
0
 // Videos
 /// <summary>  </summary>
 public Task <IReadOnlyCollection <RestVideo> > GetVideosAsync(PageOptions paging = null, RequestOptions options = null)    // Add parameters at some point
 => ChannelHelper.GetVideosAsync(Client, Id, paging, options);
Пример #22
0
 public async Task <BlockCollection> GetUserBlocksAsync(ulong userId, PageOptions paging, RequestOptions options)  // Paging is unused
 {
     options = RequestOptions.CreateOrClone(options);
     return(await SendAsync <BlockCollection>("GET", $"users/{userId}/blocks", options).ConfigureAwait(false));
 }
Пример #23
0
 /// <summary>  </summary>
 public Task <IReadOnlyCollection <RestClip> > GetClipsAsync(bool istrending = false, PageOptions paging = null, RequestOptions options = null)
 => ClientHelper.GetFollowedClipsAsync(Client, Id, istrending, paging, options);
Пример #24
0
 public async Task <VideoCollection> GetFollowedVideosAsync(string broadcastType, string language, string sort, PageOptions paging, RequestOptions options)
 {
     paging  = PageOptions.CreateOrClone(paging);
     options = RequestOptions.CreateOrClone(options);
     return(await SendAsync <VideoCollection>(new GetFollowedVideosRequest(broadcastType, language, sort, paging), options).ConfigureAwait(false));
 }
Пример #25
0
 public IActionResult AllLibs([FromRoute] long id, [FromQuery] PageOptions options)
 {
     return(Json(_symmgr.LangManager.GetFirstLibs(id, options)));
 }
Пример #26
0
        /// <summary>
        /// Fetch one or more charts from the Apple Music Catalog.
        /// Route: catalog/{storefront}/charts
        /// https://developer.apple.com/documentation/applemusicapi/get_catalog_charts
        /// </summary>
        /// <param name="storefront"></param>
        /// <param name="types"></param>
        /// <param name="chart"></param>
        /// <param name="genre"></param>
        /// <param name="pageOptions"></param>
        /// <param name="locale"></param>
        /// <returns></returns>
        public async Task <ChartResponse> GetCatalogCharts(string storefront, IReadOnlyCollection <CatalogChartType> types = null, string chart = null, string genre = null, PageOptions pageOptions = null, string locale = null)
        {
            if (string.IsNullOrWhiteSpace(storefront))
            {
                throw new ArgumentNullException(nameof(storefront));
            }

            var queryString = new Dictionary <string, string>();

            if (types != null && types.Any())
            {
                queryString.Add("types", string.Join(",", types.Select(x => x.GetValue())));
            }

            if (!string.IsNullOrWhiteSpace(chart))
            {
                queryString.Add("chart", chart);
            }

            if (!string.IsNullOrWhiteSpace(genre))
            {
                queryString.Add("genre", genre);
            }

            return(await Get <ChartResponse>($"{BaseRequestUri}/{storefront}/charts", queryString, pageOptions, locale));
        }
Пример #27
0
 public async Task <ChannelCollection> FindChannelsAsync(string query, PageOptions paging, RequestOptions options)
 {
     paging  = PageOptions.CreateOrClone(paging);
     options = RequestOptions.CreateOrClone(options);
     return(await SendAsync <ChannelCollection>(new FindChannelsRequest(query, paging), options).ConfigureAwait(false));
 }
Пример #28
0
        /// <summary>
        /// Fetch the search term results for a hint.
        /// Route: catalog/{storefront}/search/hints
        /// https://developer.apple.com/documentation/applemusicapi/get_catalog_search_hints
        /// </summary>
        /// <param name="storefront"></param>
        /// <param name="term"></param>
        /// <param name="types"></param>
        /// <param name="pageOptions"></param>
        /// <param name="locale"></param>
        /// <returns></returns>
        public async Task <SearchHintsResponse> GetCatalogSearchHints(string storefront, string term = null, IReadOnlyCollection <ResourceType> types = null, PageOptions pageOptions = null, string locale = null)
        {
            if (string.IsNullOrWhiteSpace(storefront))
            {
                throw new ArgumentNullException(nameof(storefront));
            }

            var queryString = new Dictionary <string, string>();

            if (!string.IsNullOrWhiteSpace(term))
            {
                queryString.Add("term", term.Replace(' ', '+'));
            }

            if (types != null && types.Any())
            {
                queryString.Add("types", string.Join(",", types.Select(x => x.GetValue())));
            }

            return(await Get <SearchHintsResponse>($"{BaseRequestUri}/{storefront}/search/hints", queryString, pageOptions, locale)
                   .ConfigureAwait(false));
        }
Пример #29
0
 public async Task <CommunityCollection> GetTopCommunitiesAsync(PageOptions paging, RequestOptions options)       // Paging is unused
 {
     options = RequestOptions.CreateOrClone(options);
     return(await SendAsync <CommunityCollection>("GET", "communities/top", options).ConfigureAwait(false));
 }
Пример #30
0
 public async Task <PagedResult <IEvent> > GetManyByUserAsync(Guid userId, DateTime startDate, DateTime endDate,
                                                              PageOptions pageOptions)
 {
     return(await GetManyAsync($"UserId={userId}", "Date={{0}}", startDate, endDate, pageOptions));
 }
Пример #31
0
        public async Task <ConvertFile> ConvertAsync(List <InputBase> inputs, ConvertFile output, GlobalOptions globalOptions, PageOptions pageOptions, CancellationToken cancellationToken = default)
        {
            var parameters = new WKHtmltopdfParameters
            {
                Task          = Enums.WKHtmltopdfTask.Convert,
                InputFiles    = inputs.ToArray(),
                OutputFile    = output,
                GlobalOptions = globalOptions,
                PageOptions   = pageOptions
            };

            await ExecuteAsync(parameters, cancellationToken);

            return(parameters.OutputFile);
        }