2012-11-02 07:35:49 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Web;
|
2013-01-03 01:09:13 +00:00
|
|
|
|
using Autofac;
|
2012-11-02 07:35:49 +00:00
|
|
|
|
using Funq;
|
2012-11-03 18:23:47 +00:00
|
|
|
|
using NzbDrone.Api.QualityProfiles;
|
2013-01-02 02:06:55 +00:00
|
|
|
|
using NzbDrone.Api.QualityType;
|
2012-11-02 07:35:49 +00:00
|
|
|
|
using ServiceStack.WebHost.Endpoints;
|
2013-01-02 02:06:55 +00:00
|
|
|
|
using QualityProfileService = NzbDrone.Api.QualityProfiles.QualityProfileService;
|
2012-11-02 07:35:49 +00:00
|
|
|
|
|
2012-11-03 18:23:47 +00:00
|
|
|
|
namespace NzbDrone.Api
|
2012-11-02 07:35:49 +00:00
|
|
|
|
{
|
|
|
|
|
public class AppHost : AppHostBase
|
|
|
|
|
{
|
2013-01-03 01:09:13 +00:00
|
|
|
|
private IContainer _container;
|
2012-11-03 18:23:47 +00:00
|
|
|
|
|
2013-01-03 01:09:13 +00:00
|
|
|
|
public AppHost(IContainer container) //Tell ServiceStack the name and where to find your web services
|
2012-11-03 18:23:47 +00:00
|
|
|
|
: base("NzbDrone API", typeof(QualityProfileService).Assembly)
|
|
|
|
|
{
|
2013-01-03 01:09:13 +00:00
|
|
|
|
_container = container;
|
2012-11-03 18:23:47 +00:00
|
|
|
|
}
|
2012-11-02 07:35:49 +00:00
|
|
|
|
|
|
|
|
|
public override void Configure(Container container)
|
|
|
|
|
{
|
2013-01-03 01:09:13 +00:00
|
|
|
|
container.Adapter = new AutofacIocAdapter(_container);
|
2012-11-02 07:35:49 +00:00
|
|
|
|
SetConfig(new EndpointHostConfig { ServiceStackHandlerFactoryPath = "api" });
|
|
|
|
|
|
|
|
|
|
Routes
|
2012-11-04 01:39:29 +00:00
|
|
|
|
.Add<QualityProfileModel>("/qualityprofiles")
|
2013-01-02 02:06:55 +00:00
|
|
|
|
.Add<QualityProfileModel>("/qualityprofiles/{Id}")
|
|
|
|
|
.Add<QualityTypeModel>("/qualitytypes")
|
|
|
|
|
.Add<QualityTypeModel>("/qualitytypes/{Id}");
|
2012-11-04 01:39:29 +00:00
|
|
|
|
|
|
|
|
|
Bootstrapper.Initialize();
|
2012-11-02 07:35:49 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|