sonarr-repo-only/NzbDrone.Api/Upcoming/UpcomingModule.cs

35 lines
982 B
C#
Raw Normal View History

2013-02-20 07:45:52 +00:00
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using AutoMapper;
using FluentValidation;
using Nancy;
using NzbDrone.Api.Extentions;
using NzbDrone.Api.Series;
using NzbDrone.Common;
using NzbDrone.Core.Jobs;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Tv;
namespace NzbDrone.Api.Upcoming
{
public class UpcomingModule : NzbDroneApiModule
{
private readonly UpcomingEpisodesProvider _upcomingEpisodesProvider;
public UpcomingModule(UpcomingEpisodesProvider upcomingEpisodesProvider)
: base("/Upcoming")
{
_upcomingEpisodesProvider = upcomingEpisodesProvider;
Get["/"] = x => Upcoming();
}
private Response Upcoming()
{
var upcoming = _upcomingEpisodesProvider.UpcomingEpisodes();
return Mapper.Map<List<Episode>, List<UpcomingResource>>(upcoming).AsResponse();
}
}
}