|
|
@ -59,9 +59,9 @@ namespace Prowlarr.Api.V1
|
|
|
|
|
|
|
|
|
|
|
|
[RestPostById]
|
|
|
|
[RestPostById]
|
|
|
|
[Produces("application/json")]
|
|
|
|
[Produces("application/json")]
|
|
|
|
public ActionResult<TProviderResource> CreateProvider(TProviderResource providerResource)
|
|
|
|
public ActionResult<TProviderResource> CreateProvider([FromBody] TProviderResource providerResource, [FromQuery] bool forceSave = false)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var providerDefinition = GetDefinition(providerResource, true, false, false);
|
|
|
|
var providerDefinition = GetDefinition(providerResource, true, !forceSave, false);
|
|
|
|
|
|
|
|
|
|
|
|
if (providerDefinition.Enable)
|
|
|
|
if (providerDefinition.Enable)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -77,7 +77,7 @@ namespace Prowlarr.Api.V1
|
|
|
|
[Produces("application/json")]
|
|
|
|
[Produces("application/json")]
|
|
|
|
public ActionResult<TProviderResource> UpdateProvider([FromBody] TProviderResource providerResource, [FromQuery] bool forceSave = false)
|
|
|
|
public ActionResult<TProviderResource> UpdateProvider([FromBody] TProviderResource providerResource, [FromQuery] bool forceSave = false)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var providerDefinition = GetDefinition(providerResource, true, false, false);
|
|
|
|
var providerDefinition = GetDefinition(providerResource, true, !forceSave, false);
|
|
|
|
|
|
|
|
|
|
|
|
// Only test existing definitions if it is enabled and forceSave isn't set.
|
|
|
|
// Only test existing definitions if it is enabled and forceSave isn't set.
|
|
|
|
if (providerDefinition.Enable && !forceSave)
|
|
|
|
if (providerDefinition.Enable && !forceSave)
|
|
|
@ -195,7 +195,7 @@ namespace Prowlarr.Api.V1
|
|
|
|
|
|
|
|
|
|
|
|
protected void VerifyValidationResult(ValidationResult validationResult, bool includeWarnings)
|
|
|
|
protected void VerifyValidationResult(ValidationResult validationResult, bool includeWarnings)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var result = new NzbDroneValidationResult(validationResult.Errors);
|
|
|
|
var result = validationResult as NzbDroneValidationResult ?? new NzbDroneValidationResult(validationResult.Errors);
|
|
|
|
|
|
|
|
|
|
|
|
if (includeWarnings && (!result.IsValid || result.HasWarnings))
|
|
|
|
if (includeWarnings && (!result.IsValid || result.HasWarnings))
|
|
|
|
{
|
|
|
|
{
|
|
|
|