mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-02-05 06:21:52 +01:00
API Annotations
This commit is contained in:
parent
c9e6a0339e
commit
642848d331
8 changed files with 17 additions and 0 deletions
|
|
@ -46,6 +46,7 @@ public override CommandResource GetResourceById(int id)
|
|||
}
|
||||
|
||||
[RestPostById]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<CommandResource> StartCommand(CommandResource commandResource)
|
||||
{
|
||||
var commandType =
|
||||
|
|
@ -69,6 +70,7 @@ public ActionResult<CommandResource> StartCommand(CommandResource commandResourc
|
|||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<CommandResource> GetStartedCommands()
|
||||
{
|
||||
return _commandQueueManager.All().ToResource();
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ public override TResource GetResourceById(int id)
|
|||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public TResource GetConfig()
|
||||
{
|
||||
var resource = ToResource(_configService);
|
||||
|
|
@ -32,6 +33,7 @@ public TResource GetConfig()
|
|||
}
|
||||
|
||||
[RestPutById]
|
||||
[Produces("application/json")]
|
||||
public virtual ActionResult<TResource> SaveConfig(TResource resource)
|
||||
{
|
||||
var dictionary = resource.GetType()
|
||||
|
|
|
|||
|
|
@ -23,12 +23,14 @@ public override CustomFilterResource GetResourceById(int id)
|
|||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<CustomFilterResource> GetCustomFilters()
|
||||
{
|
||||
return _customFilterService.All().ToResource();
|
||||
}
|
||||
|
||||
[RestPostById]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<CustomFilterResource> AddCustomFilter(CustomFilterResource resource)
|
||||
{
|
||||
var customFilter = _customFilterService.Add(resource.ToModel());
|
||||
|
|
@ -37,6 +39,7 @@ public ActionResult<CustomFilterResource> AddCustomFilter(CustomFilterResource r
|
|||
}
|
||||
|
||||
[RestPutById]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<CustomFilterResource> UpdateCustomFilter(CustomFilterResource resource)
|
||||
{
|
||||
_customFilterService.Update(resource.ToModel());
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ public override HealthResource GetResourceById(int id)
|
|||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<HealthResource> GetHealth()
|
||||
{
|
||||
return _healthCheckService.Results().ToResource();
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ protected HistoryResource MapToResource(NzbDrone.Core.History.History model)
|
|||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public PagingResource<HistoryResource> GetHistory()
|
||||
{
|
||||
var pagingResource = Request.ReadPagingResourceFromRequest<HistoryResource>();
|
||||
|
|
@ -58,12 +59,14 @@ public PagingResource<HistoryResource> GetHistory()
|
|||
}
|
||||
|
||||
[HttpGet("since")]
|
||||
[Produces("application/json")]
|
||||
public List<HistoryResource> GetHistorySince(DateTime date, HistoryEventType? eventType = null)
|
||||
{
|
||||
return _historyService.Since(date, eventType).Select(h => MapToResource(h)).ToList();
|
||||
}
|
||||
|
||||
[HttpGet("indexer")]
|
||||
[Produces("application/json")]
|
||||
public List<HistoryResource> GetIndexerHistory(int indexerId, HistoryEventType? eventType = null)
|
||||
{
|
||||
return _historyService.GetByIndexerId(indexerId, eventType).Select(h => MapToResource(h)).ToList();
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ public override LanguageResource GetResourceById(int id)
|
|||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<LanguageResource> GetAll()
|
||||
{
|
||||
return Language.All.Select(l => new LanguageResource
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ public LocalizationController(ILocalizationService localizationService)
|
|||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public string GetLocalizationDictionary()
|
||||
{
|
||||
return JsonSerializer.Serialize(_localizationService.GetLocalizationDictionary().ToResource(), _serializerSettings);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public override TProviderResource GetResourceById(int id)
|
|||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<TProviderResource> GetAll()
|
||||
{
|
||||
var providerDefinitions = _providerFactory.All().OrderBy(p => p.ImplementationName);
|
||||
|
|
@ -58,6 +59,7 @@ public List<TProviderResource> GetAll()
|
|||
}
|
||||
|
||||
[RestPostById]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<TProviderResource> CreateProvider(TProviderResource providerResource)
|
||||
{
|
||||
var providerDefinition = GetDefinition(providerResource, false);
|
||||
|
|
@ -73,6 +75,7 @@ public ActionResult<TProviderResource> CreateProvider(TProviderResource provider
|
|||
}
|
||||
|
||||
[RestPutById]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<TProviderResource> UpdateProvider(TProviderResource providerResource)
|
||||
{
|
||||
var providerDefinition = GetDefinition(providerResource, false);
|
||||
|
|
@ -110,6 +113,7 @@ public object DeleteProvider(int id)
|
|||
}
|
||||
|
||||
[HttpGet("schema")]
|
||||
[Produces("application/json")]
|
||||
public virtual List<TProviderResource> GetTemplates()
|
||||
{
|
||||
var defaultDefinitions = _providerFactory.GetDefaultDefinitions().OrderBy(p => p.ImplementationName).ToList();
|
||||
|
|
|
|||
Loading…
Reference in a new issue