mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-18 21:55:12 -04:00
Add some API attributes
This commit is contained in:
@@ -48,6 +48,7 @@ namespace Prowlarr.Api.V1.Commands
|
||||
}
|
||||
|
||||
[RestPostById]
|
||||
[Consumes("application/json")]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<CommandResource> StartCommand(CommandResource commandResource)
|
||||
{
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace Prowlarr.Api.V1.Config
|
||||
}
|
||||
|
||||
[RestPutById]
|
||||
[Consumes("application/json")]
|
||||
[Produces("application/json")]
|
||||
public virtual ActionResult<TResource> SaveConfig(TResource resource)
|
||||
{
|
||||
|
||||
@@ -87,6 +87,7 @@ namespace Prowlarr.Api.V1.Config
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public HostConfigResource GetHostConfig()
|
||||
{
|
||||
var resource = HostConfigResourceMapper.ToResource(_configFileProvider, _configService);
|
||||
@@ -103,6 +104,8 @@ namespace Prowlarr.Api.V1.Config
|
||||
}
|
||||
|
||||
[RestPutById]
|
||||
[Consumes("application/json")]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<HostConfigResource> SaveHostConfig(HostConfigResource resource)
|
||||
{
|
||||
var dictionary = resource.GetType()
|
||||
|
||||
@@ -19,6 +19,8 @@ namespace Prowlarr.Api.V1.Config
|
||||
}
|
||||
|
||||
[RestPutById]
|
||||
[Consumes("application/json")]
|
||||
[Produces("application/json")]
|
||||
public override ActionResult<UiConfigResource> SaveConfig(UiConfigResource resource)
|
||||
{
|
||||
var dictionary = resource.GetType()
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace Prowlarr.Api.V1.CustomFilters
|
||||
}
|
||||
|
||||
[RestPostById]
|
||||
[Consumes("application/json")]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<CustomFilterResource> AddCustomFilter(CustomFilterResource resource)
|
||||
{
|
||||
@@ -39,6 +40,7 @@ namespace Prowlarr.Api.V1.CustomFilters
|
||||
}
|
||||
|
||||
[RestPutById]
|
||||
[Consumes("application/json")]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<CustomFilterResource> UpdateCustomFilter(CustomFilterResource resource)
|
||||
{
|
||||
|
||||
@@ -18,12 +18,14 @@ namespace Prowlarr.Api.V1.FileSystem
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public IActionResult GetContents(string path, bool includeFiles = false, bool allowFoldersWithoutTrailingSlashes = false)
|
||||
{
|
||||
return Ok(_fileSystemLookupService.LookupContents(path, includeFiles, allowFoldersWithoutTrailingSlashes));
|
||||
}
|
||||
|
||||
[HttpGet("type")]
|
||||
[Produces("application/json")]
|
||||
public object GetEntityType(string path)
|
||||
{
|
||||
if (_diskProvider.FileExists(path))
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace Prowlarr.Api.V1.Health
|
||||
_healthCheckService = healthCheckService;
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public override HealthResource GetResourceById(int id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace NzbDrone.Api.V1.Indexers
|
||||
public class IndexerDefaultCategoriesController : Controller
|
||||
{
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public IndexerCategory[] GetAll()
|
||||
{
|
||||
return NewznabStandardCategory.ParentCats;
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace Prowlarr.Api.V1.Indexers
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
[Consumes("application/json")]
|
||||
public IActionResult SaveAll(IndexerEditorResource resource)
|
||||
{
|
||||
var indexersToUpdate = _indexerFactory.AllProviders(false).Select(x => (IndexerDefinition)x.Definition).Where(d => resource.IndexerIds.Contains(d.Id));
|
||||
@@ -71,6 +72,7 @@ namespace Prowlarr.Api.V1.Indexers
|
||||
}
|
||||
|
||||
[HttpDelete]
|
||||
[Consumes("application/json")]
|
||||
public object DeleteIndexers([FromBody] IndexerEditorResource resource)
|
||||
{
|
||||
_indexerFactory.Delete(resource.IndexerIds);
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace Prowlarr.Api.V1.Indexers
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public IndexerStatsResource GetAll(DateTime? startDate, DateTime? endDate)
|
||||
{
|
||||
var statsStartDate = startDate ?? DateTime.MinValue;
|
||||
|
||||
@@ -23,12 +23,14 @@ namespace Prowlarr.Api.V1.Indexers
|
||||
_indexerStatusService = indexerStatusService;
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public override IndexerStatusResource GetResourceById(int id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<IndexerStatusResource> GetAll()
|
||||
{
|
||||
return _indexerStatusService.GetBlockedProviders().ToResource();
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Prowlarr.Api.V1.Logs
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public PagingResource<LogResource> GetLogs()
|
||||
{
|
||||
var pagingResource = Request.ReadPagingResourceFromRequest<LogResource>();
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace Prowlarr.Api.V1.Logs
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<LogFileResource> GetLogFilesResponse()
|
||||
{
|
||||
var result = new List<LogFileResource>();
|
||||
@@ -51,6 +52,8 @@ namespace Prowlarr.Api.V1.Logs
|
||||
}
|
||||
|
||||
[HttpGet(@"{filename:regex([[-.a-zA-Z0-9]]+?\.txt)}")]
|
||||
[Produces("text/plain")]
|
||||
[ProducesResponseType(typeof(IActionResult), 200)]
|
||||
public IActionResult GetLogFileResponse(string filename)
|
||||
{
|
||||
LogManager.Flush();
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace Prowlarr.Api.V1.Profiles.App
|
||||
}
|
||||
|
||||
[RestPostById]
|
||||
[Consumes("application/json")]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<AppProfileResource> Create(AppProfileResource resource)
|
||||
{
|
||||
@@ -37,6 +38,7 @@ namespace Prowlarr.Api.V1.Profiles.App
|
||||
}
|
||||
|
||||
[RestPutById]
|
||||
[Consumes("application/json")]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<AppProfileResource> Update(AppProfileResource resource)
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace Prowlarr.Api.V1.Profiles.App
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public AppProfileResource GetSchema()
|
||||
{
|
||||
var qualityProfile = _profileService.GetDefaultProfile(string.Empty);
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace Prowlarr.Api.V1
|
||||
}
|
||||
|
||||
[RestPostById]
|
||||
[Consumes("application/json")]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<TProviderResource> CreateProvider([FromBody] TProviderResource providerResource, [FromQuery] bool forceSave = false)
|
||||
{
|
||||
@@ -74,6 +75,7 @@ namespace Prowlarr.Api.V1
|
||||
}
|
||||
|
||||
[RestPutById]
|
||||
[Consumes("application/json")]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<TProviderResource> UpdateProvider([FromBody] TProviderResource providerResource, [FromQuery] bool forceSave = false)
|
||||
{
|
||||
@@ -135,6 +137,7 @@ namespace Prowlarr.Api.V1
|
||||
|
||||
[SkipValidation(true, false)]
|
||||
[HttpPost("test")]
|
||||
[Consumes("application/json")]
|
||||
public object Test([FromBody] TProviderResource providerResource)
|
||||
{
|
||||
var providerDefinition = GetDefinition(providerResource, true, true, true);
|
||||
@@ -168,6 +171,8 @@ namespace Prowlarr.Api.V1
|
||||
|
||||
[SkipValidation]
|
||||
[HttpPost("action/{name}")]
|
||||
[Consumes("application/json")]
|
||||
[Produces("application/json")]
|
||||
public IActionResult RequestAction(string name, [FromBody] TProviderResource resource)
|
||||
{
|
||||
var providerDefinition = GetDefinition(resource, false, false, false);
|
||||
|
||||
@@ -45,12 +45,15 @@ namespace Prowlarr.Api.V1.Search
|
||||
_remoteReleaseCache = cacheManager.GetCache<ReleaseInfo>(GetType(), "remoteReleases");
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public override ReleaseResource GetResourceById(int id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Consumes("application/json")]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<ReleaseResource> GrabRelease(ReleaseResource release)
|
||||
{
|
||||
ValidateResource(release);
|
||||
@@ -82,6 +85,8 @@ namespace Prowlarr.Api.V1.Search
|
||||
}
|
||||
|
||||
[HttpPost("bulk")]
|
||||
[Consumes("application/json")]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<ReleaseResource> GrabReleases(List<ReleaseResource> releases)
|
||||
{
|
||||
var source = Request.GetSource();
|
||||
@@ -114,6 +119,7 @@ namespace Prowlarr.Api.V1.Search
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public Task<List<ReleaseResource>> GetAll([FromQuery] SearchResource payload)
|
||||
{
|
||||
return GetSearchReleases(payload);
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace Prowlarr.Api.V1.System.Backup
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<BackupResource> GetBackupFiles()
|
||||
{
|
||||
var backups = _backupService.GetBackups();
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace Prowlarr.Api.V1.System
|
||||
}
|
||||
|
||||
[HttpGet("status")]
|
||||
[Produces("application/json")]
|
||||
public SystemResource GetStatus()
|
||||
{
|
||||
return new SystemResource
|
||||
@@ -93,6 +94,7 @@ namespace Prowlarr.Api.V1.System
|
||||
}
|
||||
|
||||
[HttpGet("routes")]
|
||||
[Produces("application/json")]
|
||||
public IActionResult GetRoutes()
|
||||
{
|
||||
using (var sw = new StringWriter())
|
||||
@@ -104,6 +106,7 @@ namespace Prowlarr.Api.V1.System
|
||||
}
|
||||
|
||||
[HttpGet("routes/duplicate")]
|
||||
[Produces("application/json")]
|
||||
public object DuplicateRoutes()
|
||||
{
|
||||
return _detector.GetDuplicateEndpoints(_endpointData);
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace Prowlarr.Api.V1.System.Tasks
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<TaskResource> GetAll()
|
||||
{
|
||||
return _taskManager.GetAll()
|
||||
|
||||
@@ -28,18 +28,23 @@ namespace Prowlarr.Api.V1.Tags
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<TagResource> GetAll()
|
||||
{
|
||||
return _tagService.All().ToResource();
|
||||
}
|
||||
|
||||
[RestPostById]
|
||||
[Consumes("application/json")]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<TagResource> Create(TagResource resource)
|
||||
{
|
||||
return Created(_tagService.Add(resource.ToModel()).Id);
|
||||
}
|
||||
|
||||
[RestPutById]
|
||||
[Consumes("application/json")]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<TagResource> Update(TagResource resource)
|
||||
{
|
||||
_tagService.Update(resource.ToModel());
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace Prowlarr.Api.V1.Tags
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<TagDetailsResource> GetAll()
|
||||
{
|
||||
return _tagService.Details().ToResource();
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace Prowlarr.Api.V1.Update
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<UpdateResource> GetRecentUpdates()
|
||||
{
|
||||
var resources = _recentUpdateProvider.GetRecentUpdatePackages()
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace Prowlarr.Http.REST
|
||||
}
|
||||
|
||||
[RestGetById]
|
||||
[Produces("application/json")]
|
||||
public abstract TResource GetResourceById(int id);
|
||||
|
||||
public override void OnActionExecuting(ActionExecutingContext context)
|
||||
|
||||
Reference in New Issue
Block a user