* Fixed: Add back LanguageProfiles endpoints and deprecate * fixup! Fixed: Add back LanguageProfiles endpoints and deprecatepull/5239/head
parent
c9b483bdf7
commit
aaaf18aec3
@ -0,0 +1,81 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using NzbDrone.Core.Languages;
|
||||||
|
using Sonarr.Http;
|
||||||
|
using Sonarr.Http.REST;
|
||||||
|
using Sonarr.Http.REST.Attributes;
|
||||||
|
|
||||||
|
namespace Sonarr.Api.V3.Profiles.Languages
|
||||||
|
{
|
||||||
|
[V3ApiController]
|
||||||
|
[Obsolete("Deprecated")]
|
||||||
|
public class LanguageProfileController : RestController<LanguageProfileResource>
|
||||||
|
{
|
||||||
|
[RestPostById]
|
||||||
|
[Produces("application/json")]
|
||||||
|
[Consumes("application/json")]
|
||||||
|
public ActionResult<LanguageProfileResource> Create(LanguageProfileResource resource)
|
||||||
|
{
|
||||||
|
return Accepted(resource);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RestDeleteById]
|
||||||
|
public void DeleteProfile(int id)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[RestPutById]
|
||||||
|
[Produces("application/json")]
|
||||||
|
[Consumes("application/json")]
|
||||||
|
public ActionResult<LanguageProfileResource> Update(LanguageProfileResource resource)
|
||||||
|
{
|
||||||
|
return Accepted(resource);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RestGetById]
|
||||||
|
[Produces("application/json")]
|
||||||
|
protected override LanguageProfileResource GetResourceById(int id)
|
||||||
|
{
|
||||||
|
return new LanguageProfileResource
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Name = "Deprecated",
|
||||||
|
UpgradeAllowed = true,
|
||||||
|
Cutoff = Language.English,
|
||||||
|
Languages = new List<LanguageProfileItemResource>
|
||||||
|
{
|
||||||
|
new LanguageProfileItemResource
|
||||||
|
{
|
||||||
|
Language = Language.English,
|
||||||
|
Allowed = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Produces("application/json")]
|
||||||
|
public ActionResult<List<LanguageProfileResource>> GetAll()
|
||||||
|
{
|
||||||
|
return new List<LanguageProfileResource>
|
||||||
|
{
|
||||||
|
new LanguageProfileResource
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Name = "Deprecated",
|
||||||
|
UpgradeAllowed = true,
|
||||||
|
Cutoff = Language.English,
|
||||||
|
Languages = new List<LanguageProfileItemResource>
|
||||||
|
{
|
||||||
|
new LanguageProfileItemResource
|
||||||
|
{
|
||||||
|
Language = Language.English,
|
||||||
|
Allowed = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Sonarr.Http.REST;
|
||||||
|
|
||||||
|
namespace Sonarr.Api.V3.Profiles.Languages
|
||||||
|
{
|
||||||
|
public class LanguageProfileResource : RestResource
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public bool UpgradeAllowed { get; set; }
|
||||||
|
public NzbDrone.Core.Languages.Language Cutoff { get; set; }
|
||||||
|
public List<LanguageProfileItemResource> Languages { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class LanguageProfileItemResource : RestResource
|
||||||
|
{
|
||||||
|
public NzbDrone.Core.Languages.Language Language { get; set; }
|
||||||
|
public bool Allowed { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using NzbDrone.Core.Languages;
|
||||||
|
using Sonarr.Http;
|
||||||
|
using Sonarr.Http.REST;
|
||||||
|
|
||||||
|
namespace Sonarr.Api.V3.Profiles.Languages
|
||||||
|
{
|
||||||
|
[V3ApiController("languageprofile/schema")]
|
||||||
|
[Obsolete("Deprecated")]
|
||||||
|
public class LanguageProfileSchemaController : RestController<LanguageProfileResource>
|
||||||
|
{
|
||||||
|
[HttpGet]
|
||||||
|
[Produces("application/json")]
|
||||||
|
public LanguageProfileResource GetSchema()
|
||||||
|
{
|
||||||
|
return new LanguageProfileResource
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Name = "Deprecated",
|
||||||
|
UpgradeAllowed = true,
|
||||||
|
Cutoff = Language.English,
|
||||||
|
Languages = new List<LanguageProfileItemResource>
|
||||||
|
{
|
||||||
|
new LanguageProfileItemResource
|
||||||
|
{
|
||||||
|
Language = Language.English,
|
||||||
|
Allowed = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override LanguageProfileResource GetResourceById(int id)
|
||||||
|
{
|
||||||
|
throw new global::System.NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue