mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-11-24 08:42:19 +02:00
New: API Docs
This commit is contained in:
parent
269e72a219
commit
18f77a967b
3
.gitignore
vendored
3
.gitignore
vendored
@ -160,3 +160,6 @@ Thumbs.db
|
||||
|
||||
src/.idea/
|
||||
/distribution/windows/setup/output/*
|
||||
|
||||
# API doc generation
|
||||
.config/
|
||||
|
@ -6,6 +6,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Owin" Version="6.0.5" />
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="1.7.4" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.3.2" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.0" />
|
||||
<PackageReference Include="DryIoc.dll" Version="4.8.6" />
|
||||
|
@ -9,6 +9,7 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using NLog.Extensions.Logging;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Instrumentation;
|
||||
@ -91,6 +92,73 @@ public void ConfigureServices(IServiceCollection services)
|
||||
})
|
||||
.AddControllersAsServices();
|
||||
|
||||
services.AddSwaggerGen(c =>
|
||||
{
|
||||
c.SwaggerDoc("v3", new OpenApiInfo
|
||||
{
|
||||
Version = "3.0.0",
|
||||
Title = "Sonarr",
|
||||
Description = "Sonarr API docs",
|
||||
License = new OpenApiLicense
|
||||
{
|
||||
Name = "GPL-3.0",
|
||||
Url = new Uri("https://github.com/Sonarr/Sonarr/blob/develop/LICENSE")
|
||||
}
|
||||
});
|
||||
|
||||
var apiKeyHeader = new OpenApiSecurityScheme
|
||||
{
|
||||
Name = "X-Api-Key",
|
||||
Type = SecuritySchemeType.ApiKey,
|
||||
Scheme = "apiKey",
|
||||
Description = "Apikey passed as header",
|
||||
In = ParameterLocation.Header,
|
||||
Reference = new OpenApiReference
|
||||
{
|
||||
Type = ReferenceType.SecurityScheme,
|
||||
Id = "X-Api-Key"
|
||||
},
|
||||
};
|
||||
|
||||
c.AddSecurityDefinition("X-Api-Key", apiKeyHeader);
|
||||
|
||||
c.AddSecurityRequirement(new OpenApiSecurityRequirement
|
||||
{
|
||||
{ apiKeyHeader, new string[] { } }
|
||||
});
|
||||
|
||||
var apikeyQuery = new OpenApiSecurityScheme
|
||||
{
|
||||
Name = "apikey",
|
||||
Type = SecuritySchemeType.ApiKey,
|
||||
Scheme = "apiKey",
|
||||
Description = "Apikey passed as header",
|
||||
In = ParameterLocation.Query,
|
||||
Reference = new OpenApiReference
|
||||
{
|
||||
Type = ReferenceType.SecurityScheme,
|
||||
Id = "apikey"
|
||||
},
|
||||
};
|
||||
|
||||
c.AddServer(new OpenApiServer
|
||||
{
|
||||
Url = "{protocol}://{hostpath}",
|
||||
Variables = new Dictionary<string, OpenApiServerVariable>
|
||||
{
|
||||
{ "protocol", new OpenApiServerVariable { Default = "http", Enum = new List<string> { "http", "https" } } },
|
||||
{ "hostpath", new OpenApiServerVariable { Default = "localhost:8989" } }
|
||||
}
|
||||
});
|
||||
|
||||
c.AddSecurityDefinition("apikey", apikeyQuery);
|
||||
|
||||
c.AddSecurityRequirement(new OpenApiSecurityRequirement
|
||||
{
|
||||
{ apikeyQuery, new string[] { } }
|
||||
});
|
||||
});
|
||||
|
||||
services
|
||||
.AddSignalR()
|
||||
.AddJsonProtocol(options =>
|
||||
@ -184,6 +252,15 @@ public void Configure(IApplicationBuilder app,
|
||||
|
||||
app.UseWebSockets();
|
||||
|
||||
// Enable middleware to serve generated Swagger as a JSON endpoint.
|
||||
if (BuildInfo.IsDebug)
|
||||
{
|
||||
app.UseSwagger(c =>
|
||||
{
|
||||
c.RouteTemplate = "docs/{documentName}/openapi.json";
|
||||
});
|
||||
}
|
||||
|
||||
app.UseEndpoints(x =>
|
||||
{
|
||||
x.MapHub<MessageHub>("/signalr/messages").RequireAuthorization("SignalR");
|
||||
|
@ -22,6 +22,7 @@ public BlocklistController(IBlocklistService blocklistService,
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public PagingResource<BlocklistResource> GetBlocklist()
|
||||
{
|
||||
var pagingResource = Request.ReadPagingResourceFromRequest<BlocklistResource>();
|
||||
@ -37,6 +38,7 @@ public void DeleteBlocklist(int id)
|
||||
}
|
||||
|
||||
[HttpDelete("bulk")]
|
||||
[Produces("application/json")]
|
||||
public object Remove([FromBody] BlocklistBulkResource resource)
|
||||
{
|
||||
_blocklistService.Delete(resource.Ids);
|
||||
|
@ -22,6 +22,7 @@ public CalendarController(IBroadcastSignalRMessage signalR,
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<EpisodeResource> GetCalendar(DateTime? start, DateTime? end, bool unmonitored = false, bool includeSeries = false, bool includeEpisodeFile = false, bool includeEpisodeImages = false)
|
||||
{
|
||||
var startUse = start ?? DateTime.Today;
|
||||
|
@ -49,6 +49,8 @@ protected override CommandResource GetResourceById(int id)
|
||||
}
|
||||
|
||||
[RestPostById]
|
||||
[Consumes("application/json")]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<CommandResource> StartCommand(CommandResource commandResource)
|
||||
{
|
||||
var commandType =
|
||||
@ -74,6 +76,7 @@ public ActionResult<CommandResource> StartCommand(CommandResource commandResourc
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<CommandResource> GetStartedCommands()
|
||||
{
|
||||
return _commandQueueManager.All()
|
||||
|
@ -23,6 +23,7 @@ protected override TResource GetResourceById(int id)
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public TResource GetConfig()
|
||||
{
|
||||
var resource = ToResource(_configService);
|
||||
@ -32,6 +33,7 @@ public TResource GetConfig()
|
||||
}
|
||||
|
||||
[RestPutById]
|
||||
[Consumes("application/json")]
|
||||
public virtual ActionResult<TResource> SaveConfig(TResource resource)
|
||||
{
|
||||
var dictionary = resource.GetType()
|
||||
|
@ -23,12 +23,14 @@ protected override CustomFilterResource GetResourceById(int id)
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<CustomFilterResource> GetCustomFilters()
|
||||
{
|
||||
return _customFilterService.All().ToResource();
|
||||
}
|
||||
|
||||
[RestPostById]
|
||||
[Consumes("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]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<CustomFilterResource> UpdateCustomFilter(CustomFilterResource resource)
|
||||
{
|
||||
_customFilterService.Update(resource.ToModel());
|
||||
|
@ -48,6 +48,7 @@ protected override CustomFormatResource GetResourceById(int id)
|
||||
}
|
||||
|
||||
[RestPostById]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<CustomFormatResource> Create(CustomFormatResource customFormatResource)
|
||||
{
|
||||
var model = customFormatResource.ToModel(_specifications);
|
||||
@ -55,6 +56,7 @@ public ActionResult<CustomFormatResource> Create(CustomFormatResource customForm
|
||||
}
|
||||
|
||||
[RestPutById]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<CustomFormatResource> Update(CustomFormatResource resource)
|
||||
{
|
||||
var model = resource.ToModel(_specifications);
|
||||
@ -64,6 +66,7 @@ public ActionResult<CustomFormatResource> Update(CustomFormatResource resource)
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<CustomFormatResource> GetAll()
|
||||
{
|
||||
return _formatService.All().ToResource();
|
||||
|
@ -16,6 +16,7 @@ public DiskSpaceController(IDiskSpaceService diskSpaceService)
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<DiskSpaceResource> GetFreeSpace()
|
||||
{
|
||||
return _diskSpaceService.GetFreeSpace().ConvertAll(DiskSpaceResourceMapper.MapToResource);
|
||||
|
@ -58,6 +58,7 @@ protected override EpisodeFileResource GetResourceById(int id)
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<EpisodeFileResource> GetEpisodeFiles(int? seriesId, [FromQuery] List<int> episodeFileIds)
|
||||
{
|
||||
if (!seriesId.HasValue && !episodeFileIds.Any())
|
||||
@ -101,6 +102,7 @@ public List<EpisodeFileResource> GetEpisodeFiles(int? seriesId, [FromQuery] List
|
||||
}
|
||||
|
||||
[RestPutById]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<EpisodeFileResource> SetQuality(EpisodeFileResource episodeFileResource)
|
||||
{
|
||||
var episodeFile = _mediaFileService.Get(episodeFileResource.Id);
|
||||
@ -121,6 +123,7 @@ public ActionResult<EpisodeFileResource> SetQuality(EpisodeFileResource episodeF
|
||||
}
|
||||
|
||||
[HttpPut("editor")]
|
||||
[Consumes("application/json")]
|
||||
public object SetQuality([FromBody] EpisodeFileListResource resource)
|
||||
{
|
||||
var episodeFiles = _mediaFileService.GetFiles(resource.EpisodeFileIds);
|
||||
@ -171,6 +174,7 @@ public void DeleteEpisodeFile(int id)
|
||||
}
|
||||
|
||||
[HttpDelete("bulk")]
|
||||
[Consumes("application/json")]
|
||||
public object DeleteEpisodeFiles([FromBody] EpisodeFileListResource resource)
|
||||
{
|
||||
var episodeFiles = _mediaFileService.GetFiles(resource.EpisodeFileIds);
|
||||
@ -185,6 +189,7 @@ public object DeleteEpisodeFiles([FromBody] EpisodeFileListResource resource)
|
||||
}
|
||||
|
||||
[HttpPut("bulk")]
|
||||
[Consumes("application/json")]
|
||||
public object SetPropertiesBulk([FromBody] List<EpisodeFileResource> resources)
|
||||
{
|
||||
var episodeFiles = _mediaFileService.GetFiles(resources.Select(r => r.Id));
|
||||
|
@ -23,6 +23,7 @@ public EpisodeController(ISeriesService seriesService,
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<EpisodeResource> GetEpisodes(int? seriesId, int? seasonNumber, [FromQuery]List<int> episodeIds, int? episodeFileId, bool includeImages = false)
|
||||
{
|
||||
if (seriesId.HasValue)
|
||||
@ -47,6 +48,7 @@ public List<EpisodeResource> GetEpisodes(int? seriesId, int? seasonNumber, [From
|
||||
}
|
||||
|
||||
[HttpPut("{id}")]
|
||||
[Consumes("application/json")]
|
||||
public IActionResult SetEpisodeMonitored([FromBody] EpisodeResource resource, [FromRoute] int id)
|
||||
{
|
||||
_episodeService.SetEpisodeMonitored(id, resource.Monitored);
|
||||
@ -57,6 +59,7 @@ public IActionResult SetEpisodeMonitored([FromBody] EpisodeResource resource, [F
|
||||
}
|
||||
|
||||
[HttpPut("monitor")]
|
||||
[Consumes("application/json")]
|
||||
public IActionResult SetEpisodesMonitored([FromBody] EpisodesMonitoredResource resource)
|
||||
{
|
||||
var includeImages = Request.GetBooleanQueryParameter("includeImages", false);
|
||||
|
@ -16,6 +16,7 @@ public RenameEpisodeController(IRenameEpisodeFileService renameEpisodeFileServic
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<RenameEpisodeResource> GetEpisodes(int seriesId, int? seasonNumber)
|
||||
{
|
||||
if (seasonNumber.HasValue)
|
||||
|
@ -26,12 +26,14 @@ public FileSystemController(IFileSystemLookupService fileSystemLookupService,
|
||||
}
|
||||
|
||||
[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))
|
||||
@ -44,6 +46,7 @@ public object GetEntityType(string path)
|
||||
}
|
||||
|
||||
[HttpGet("mediafiles")]
|
||||
[Produces("application/json")]
|
||||
public object GetMediaFiles(string path)
|
||||
{
|
||||
if (!_diskProvider.FolderExists(path))
|
||||
|
@ -28,6 +28,7 @@ protected override HealthResource GetResourceById(int id)
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<HealthResource> GetHealth()
|
||||
{
|
||||
return _healthCheckService.Results().ToResource();
|
||||
|
@ -57,6 +57,7 @@ protected HistoryResource MapToResource(EpisodeHistory model, bool includeSeries
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public PagingResource<HistoryResource> GetHistory(bool includeSeries, bool includeEpisode)
|
||||
{
|
||||
var pagingResource = Request.ReadPagingResourceFromRequest<HistoryResource>();
|
||||
@ -88,12 +89,14 @@ public PagingResource<HistoryResource> GetHistory(bool includeSeries, bool inclu
|
||||
}
|
||||
|
||||
[HttpGet("since")]
|
||||
[Produces("application/json")]
|
||||
public List<HistoryResource> GetHistorySince(DateTime date, EpisodeHistoryEventType? eventType = null, bool includeSeries = false, bool includeEpisode = false)
|
||||
{
|
||||
return _historyService.Since(date, eventType).Select(h => MapToResource(h, includeSeries, includeEpisode)).ToList();
|
||||
}
|
||||
|
||||
[HttpGet("series")]
|
||||
[Produces("application/json")]
|
||||
public List<HistoryResource> GetSeriesHistory(int seriesId, int? seasonNumber, EpisodeHistoryEventType? eventType = null, bool includeSeries = false, bool includeEpisode = false)
|
||||
{
|
||||
if (seasonNumber.HasValue)
|
||||
|
@ -29,12 +29,14 @@ protected override ImportListExclusionResource GetResourceById(int id)
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<ImportListExclusionResource> GetImportListExclusions()
|
||||
{
|
||||
return _importListExclusionService.All().ToResource();
|
||||
}
|
||||
|
||||
[RestPostById]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<ImportListExclusionResource> AddImportListExclusion(ImportListExclusionResource resource)
|
||||
{
|
||||
var importListExclusion = _importListExclusionService.Add(resource.ToModel());
|
||||
@ -43,6 +45,7 @@ public ActionResult<ImportListExclusionResource> AddImportListExclusion(ImportLi
|
||||
}
|
||||
|
||||
[RestPutById]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<ImportListExclusionResource> UpdateImportListExclusion(ImportListExclusionResource resource)
|
||||
{
|
||||
_importListExclusionService.Update(resource.ToModel());
|
||||
|
@ -67,6 +67,7 @@ public ReleaseController(IFetchAndParseRss rssFetcherAndParser,
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Consumes("application/json")]
|
||||
public object DownloadRelease(ReleaseResource release)
|
||||
{
|
||||
var remoteEpisode = _remoteEpisodeCache.Find(GetCacheKey(release));
|
||||
@ -138,6 +139,7 @@ public object DownloadRelease(ReleaseResource release)
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<ReleaseResource> GetReleases(int? seriesId, int? episodeId, int? seasonNumber)
|
||||
{
|
||||
if (episodeId.HasValue)
|
||||
|
@ -44,6 +44,7 @@ public ReleasePushController(IMakeDownloadDecision downloadDecisionMaker,
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<List<ReleaseResource>> Create(ReleaseResource release)
|
||||
{
|
||||
_logger.Info("Release pushed: {0} - {1}", release.Title, release.DownloadUrl);
|
||||
|
@ -17,6 +17,7 @@ public LogController(ILogService logService)
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public PagingResource<LogResource> GetLogs()
|
||||
{
|
||||
var pagingResource = Request.ReadPagingResourceFromRequest<LogResource>();
|
||||
|
@ -26,6 +26,7 @@ public LogFileControllerBase(IDiskProvider diskProvider,
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<LogFileResource> GetLogFilesResponse()
|
||||
{
|
||||
var result = new List<LogFileResource>();
|
||||
@ -51,6 +52,7 @@ public List<LogFileResource> GetLogFilesResponse()
|
||||
}
|
||||
|
||||
[HttpGet(@"{filename:regex([[-.a-zA-Z0-9]]+?\.txt)}")]
|
||||
[Produces("text/plain")]
|
||||
public IActionResult GetLogFileResponse(string filename)
|
||||
{
|
||||
LogManager.Flush();
|
||||
|
@ -21,6 +21,7 @@ public ManualImportController(IManualImportService manualImportService)
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<ManualImportResource> GetMediaFiles(string folder, string downloadId, int? seriesId, int? seasonNumber, bool filterExistingFiles = true)
|
||||
{
|
||||
if (seriesId.HasValue)
|
||||
@ -32,6 +33,7 @@ public List<ManualImportResource> GetMediaFiles(string folder, string downloadId
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Consumes("application/json")]
|
||||
public object ReprocessItems([FromBody] List<ManualImportReprocessResource> items)
|
||||
{
|
||||
foreach (var item in items)
|
||||
|
@ -18,6 +18,7 @@ public ParseController(IParsingService parsingService)
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public ParseResource Parse(string title, string path)
|
||||
{
|
||||
if (title.IsNullOrWhiteSpace())
|
||||
|
@ -34,6 +34,7 @@ public DelayProfileController(IDelayProfileService delayProfileService, DelayPro
|
||||
}
|
||||
|
||||
[RestPostById]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<DelayProfileResource> Create(DelayProfileResource resource)
|
||||
{
|
||||
var model = resource.ToModel();
|
||||
@ -54,6 +55,7 @@ public void DeleteProfile(int id)
|
||||
}
|
||||
|
||||
[RestPutById]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<DelayProfileResource> Update(DelayProfileResource resource)
|
||||
{
|
||||
var model = resource.ToModel();
|
||||
@ -67,6 +69,7 @@ protected override DelayProfileResource GetResourceById(int id)
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<DelayProfileResource> GetAll()
|
||||
{
|
||||
return _delayProfileService.All().ToResource();
|
||||
|
@ -24,6 +24,7 @@ public LanguageProfileController(ILanguageProfileService profileService)
|
||||
}
|
||||
|
||||
[RestPostById]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<LanguageProfileResource> Create(LanguageProfileResource resource)
|
||||
{
|
||||
var model = resource.ToModel();
|
||||
@ -38,6 +39,7 @@ public void DeleteProfile(int id)
|
||||
}
|
||||
|
||||
[RestPutById]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<LanguageProfileResource> Update(LanguageProfileResource resource)
|
||||
{
|
||||
var model = resource.ToModel();
|
||||
@ -53,6 +55,7 @@ protected override LanguageProfileResource GetResourceById(int id)
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<LanguageProfileResource> GetAll()
|
||||
{
|
||||
return _profileService.All().ToResource();
|
||||
|
@ -15,6 +15,7 @@ public LanguageProfileSchemaController(ILanguageProfileService profileService)
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public LanguageProfileResource GetSchema()
|
||||
{
|
||||
var qualityProfile = _profileService.GetDefaultProfile(string.Empty);
|
||||
|
@ -43,6 +43,7 @@ public QualityProfileController(IQualityProfileService profileService, ICustomFo
|
||||
}
|
||||
|
||||
[RestPostById]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<QualityProfileResource> Create(QualityProfileResource resource)
|
||||
{
|
||||
var model = resource.ToModel();
|
||||
@ -57,6 +58,7 @@ public void DeleteProfile(int id)
|
||||
}
|
||||
|
||||
[RestPutById]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<QualityProfileResource> Update(QualityProfileResource resource)
|
||||
{
|
||||
var model = resource.ToModel();
|
||||
@ -72,6 +74,7 @@ protected override QualityProfileResource GetResourceById(int id)
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<QualityProfileResource> GetAll()
|
||||
{
|
||||
return _profileService.All().ToResource();
|
||||
|
@ -42,6 +42,7 @@ protected override TProviderResource GetResourceById(int id)
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<TProviderResource> GetAll()
|
||||
{
|
||||
var providerDefinitions = _providerFactory.All().OrderBy(p => p.ImplementationName);
|
||||
@ -59,6 +60,7 @@ public List<TProviderResource> GetAll()
|
||||
}
|
||||
|
||||
[RestPostById]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<TProviderResource> CreateProvider(TProviderResource providerResource)
|
||||
{
|
||||
var providerDefinition = GetDefinition(providerResource, true, false, false);
|
||||
@ -74,6 +76,7 @@ public ActionResult<TProviderResource> CreateProvider(TProviderResource provider
|
||||
}
|
||||
|
||||
[RestPutById]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<TProviderResource> UpdateProvider(TProviderResource providerResource)
|
||||
{
|
||||
var providerDefinition = GetDefinition(providerResource, true, false, false);
|
||||
@ -112,6 +115,7 @@ public object DeleteProvider(int id)
|
||||
}
|
||||
|
||||
[HttpGet("schema")]
|
||||
[Produces("application/json")]
|
||||
public List<TProviderResource> GetTemplates()
|
||||
{
|
||||
var defaultDefinitions = _providerFactory.GetDefaultDefinitions().OrderBy(p => p.ImplementationName).ToList();
|
||||
@ -135,6 +139,7 @@ public List<TProviderResource> GetTemplates()
|
||||
|
||||
[SkipValidation(true, false)]
|
||||
[HttpPost("test")]
|
||||
[Consumes("application/json")]
|
||||
public object Test([FromBody] TProviderResource providerResource)
|
||||
{
|
||||
var providerDefinition = GetDefinition(providerResource, true, true, true);
|
||||
@ -171,6 +176,7 @@ public IActionResult TestAll()
|
||||
|
||||
[SkipValidation]
|
||||
[HttpPost("action/{name}")]
|
||||
[Consumes("application/json")]
|
||||
public IActionResult RequestAction(string name, [FromBody] TProviderResource resource)
|
||||
{
|
||||
var providerDefinition = GetDefinition(resource, false, false, false);
|
||||
|
@ -55,6 +55,7 @@ public object UpdateMany([FromBody] List<QualityDefinitionResource> resource)
|
||||
.ToResource());
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public void Handle(CommandExecutedEvent message)
|
||||
{
|
||||
if (message.Command.Name == "ResetQualityDefinitions")
|
||||
|
@ -35,6 +35,7 @@ public object Grab(int id)
|
||||
}
|
||||
|
||||
[HttpPost("grab/bulk")]
|
||||
[Consumes("application/json")]
|
||||
public object Grab([FromBody] QueueBulkResource resource)
|
||||
{
|
||||
foreach (var id in resource.Ids)
|
||||
|
@ -99,6 +99,7 @@ public object RemoveMany([FromBody] QueueBulkResource resource, [FromQuery] bool
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public PagingResource<QueueResource> GetQueue(bool includeUnknownSeriesItems = false, bool includeSeries = false, bool includeEpisode = false)
|
||||
{
|
||||
var pagingResource = Request.ReadPagingResourceFromRequest<QueueResource>();
|
||||
|
@ -32,6 +32,7 @@ protected override QueueResource GetResourceById(int id)
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<QueueResource> GetQueue(int? seriesId, [FromQuery]List<int> episodeIds, bool includeSeries = false, bool includeEpisode = false)
|
||||
{
|
||||
var queue = _queueService.GetQueue();
|
||||
|
@ -36,6 +36,7 @@ protected override QueueStatusResource GetResourceById(int id)
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public QueueStatusResource GetQueueStatus()
|
||||
{
|
||||
_broadcastDebounce.Pause();
|
||||
|
@ -40,6 +40,7 @@ protected override RemotePathMappingResource GetResourceById(int id)
|
||||
}
|
||||
|
||||
[RestPostById]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<RemotePathMappingResource> CreateMapping(RemotePathMappingResource resource)
|
||||
{
|
||||
var model = resource.ToModel();
|
||||
@ -48,6 +49,7 @@ public ActionResult<RemotePathMappingResource> CreateMapping(RemotePathMappingRe
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<RemotePathMappingResource> GetMappings()
|
||||
{
|
||||
return _remotePathMappingService.All().ToResource();
|
||||
|
@ -49,6 +49,7 @@ protected override RootFolderResource GetResourceById(int id)
|
||||
}
|
||||
|
||||
[RestPostById]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<RootFolderResource> CreateRootFolder(RootFolderResource rootFolderResource)
|
||||
{
|
||||
var model = rootFolderResource.ToModel();
|
||||
@ -57,6 +58,7 @@ public ActionResult<RootFolderResource> CreateRootFolder(RootFolderResource root
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<RootFolderResource> GetRootFolders()
|
||||
{
|
||||
return _rootFolderService.AllWithUnmappedFolders().ToResource();
|
||||
|
@ -18,6 +18,7 @@ public SeasonPassController(ISeriesService seriesService, IEpisodeMonitoredServi
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Consumes("application/json")]
|
||||
public IActionResult UpdateAll(SeasonPassResource resource)
|
||||
{
|
||||
var seriesToUpdate = _seriesService.GetSeries(resource.Series.Select(s => s.Id));
|
||||
|
@ -98,6 +98,7 @@ public SeriesController(IBroadcastSignalRMessage signalRBroadcaster,
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<SeriesResource> AllSeries(int? tvdbId, bool includeSeasonImages = false)
|
||||
{
|
||||
var seriesStats = _seriesStatisticsService.SeriesStatistics();
|
||||
@ -129,6 +130,7 @@ protected override SeriesResource GetResourceById(int id)
|
||||
}
|
||||
|
||||
[RestPostById]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<SeriesResource> AddSeries(SeriesResource seriesResource)
|
||||
{
|
||||
var series = _addSeriesService.AddSeries(seriesResource.ToModel());
|
||||
@ -137,6 +139,7 @@ public ActionResult<SeriesResource> AddSeries(SeriesResource seriesResource)
|
||||
}
|
||||
|
||||
[RestPutById]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<SeriesResource> UpdateSeries(SeriesResource seriesResource)
|
||||
{
|
||||
var moveFiles = Request.GetBooleanQueryParameter("moveFiles");
|
||||
|
@ -54,6 +54,7 @@ public SystemController(IAppFolderInfo appFolderInfo,
|
||||
}
|
||||
|
||||
[HttpGet("status")]
|
||||
[Produces("application/json")]
|
||||
public object GetStatus()
|
||||
{
|
||||
return new
|
||||
@ -92,6 +93,7 @@ public object GetStatus()
|
||||
}
|
||||
|
||||
[HttpGet("routes")]
|
||||
[Produces("application/json")]
|
||||
public IActionResult GetRoutes()
|
||||
{
|
||||
using (var sw = new StringWriter())
|
||||
@ -103,6 +105,7 @@ public IActionResult GetRoutes()
|
||||
}
|
||||
|
||||
[HttpGet("routes/duplicate")]
|
||||
[Produces("application/json")]
|
||||
public object DuplicateRoutes()
|
||||
{
|
||||
return _detector.GetDuplicateEndpoints(_endpointData);
|
||||
|
@ -28,18 +28,21 @@ protected override TagResource GetResourceById(int id)
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<TagResource> GetAll()
|
||||
{
|
||||
return _tagService.All().ToResource();
|
||||
}
|
||||
|
||||
[RestPostById]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<TagResource> Create(TagResource resource)
|
||||
{
|
||||
return Created(_tagService.Add(resource.ToModel()).Id);
|
||||
}
|
||||
|
||||
[RestPutById]
|
||||
[Consumes("application/json")]
|
||||
public ActionResult<TagResource> Update(TagResource resource)
|
||||
{
|
||||
_tagService.Update(resource.ToModel());
|
||||
|
@ -22,6 +22,7 @@ protected override TagDetailsResource GetResourceById(int id)
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<TagDetailsResource> GetAll()
|
||||
{
|
||||
return _tagService.Details().ToResource();
|
||||
|
@ -22,6 +22,7 @@ public UpdateController(IRecentUpdateProvider recentUpdateProvider, IUpdateHisto
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<UpdateResource> GetRecentUpdates()
|
||||
{
|
||||
var resources = _recentUpdateProvider.GetRecentUpdatePackages()
|
||||
|
@ -26,6 +26,7 @@ public CutoffController(IEpisodeCutoffService episodeCutoffService,
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public PagingResource<EpisodeResource> GetCutoffUnmetEpisodes(bool includeSeries = false, bool includeEpisodeFile = false, bool includeImages = false)
|
||||
{
|
||||
var pagingResource = Request.ReadPagingResourceFromRequest<EpisodeResource>();
|
||||
|
@ -23,6 +23,7 @@ public MissingController(IEpisodeService episodeService,
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public PagingResource<EpisodeResource> GetMissingEpisodes(bool includeSeries = false, bool includeImages = false)
|
||||
{
|
||||
var pagingResource = Request.ReadPagingResourceFromRequest<EpisodeResource>();
|
||||
|
10641
src/Sonarr.Api.V3/openapi.json
Normal file
10641
src/Sonarr.Api.V3/openapi.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -39,6 +39,7 @@ protected RestController()
|
||||
}
|
||||
|
||||
[RestGetById]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<TResource> GetResourceByIdWithErrorHandler(int id)
|
||||
{
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user