jellyfin-server/MediaBrowser.Api/NewsService.cs

47 lines
1.6 KiB
C#
Raw Normal View History

2016-10-24 00:09:43 +00:00
using MediaBrowser.Model.News;
2014-01-18 21:52:01 +00:00
using MediaBrowser.Model.Querying;
2016-10-25 19:02:04 +00:00
using MediaBrowser.Model.Services;
2014-01-18 21:52:01 +00:00
namespace MediaBrowser.Api
{
2014-03-23 20:07:02 +00:00
[Route("/News/Product", "GET", Summary = "Gets the latest product news.")]
2014-01-18 21:52:01 +00:00
public class GetProductNews : IReturn<QueryResult<NewsItem>>
{
/// <summary>
/// Skips over a given number of items within the results. Use for paging.
/// </summary>
/// <value>The start index.</value>
[ApiMember(Name = "StartIndex", Description = "Optional. The record index to start at. All items with a lower index will be dropped from the results.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? StartIndex { get; set; }
/// <summary>
/// The maximum number of items to return
/// </summary>
/// <value>The limit.</value>
[ApiMember(Name = "Limit", Description = "Optional. The maximum number of records to return", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? Limit { get; set; }
}
2014-03-23 20:07:02 +00:00
2014-01-18 21:52:01 +00:00
public class NewsService : BaseApiService
{
private readonly INewsService _newsService;
public NewsService(INewsService newsService)
{
_newsService = newsService;
}
public object Get(GetProductNews request)
{
var result = _newsService.GetProductNews(new NewsQuery
{
2014-03-23 20:07:02 +00:00
StartIndex = request.StartIndex,
Limit = request.Limit
2014-01-18 21:52:01 +00:00
2014-01-19 04:25:01 +00:00
});
2014-01-18 21:52:01 +00:00
2018-09-12 17:26:21 +00:00
return ToOptimizedResult(result);
2014-01-18 21:52:01 +00:00
}
}
}